Use def or val in Chisle to define some "const-macro" value?

41 Views Asked by At

I want to define some constants in Chisel and have them produce an effect similar to macro expansion in C, replacing them at compile time where they are used. Should I use val or def for this purpose?

// which one should I use?
def DATA_WIDTH = 32 
val DATA_WIDTH = 32

val reg = Reg(Vec(CPUConfig.DATA_WIDTH, UInt(CPUConfig.DATA_WIDTH.W)))

Can someone explain this to me?

0

There are 0 best solutions below