Skip to content

Reg width inheritance issue with porting Chisel 2 to Chisel 3

kshalle edited this page Apr 15, 2018 · 4 revisions

Chisel 2 is able to calculate the width of a Reg through inheritance. But this does seem to work when the code is ported to Chisel 3.

For example, in Chisel 2, "a_reg = b+c"

a_reg width shall equal the width of "b" or "c". Chisel 2 was able to understand that, and we do not need to set the width of a_reg explicitly.

So the following register was defined like: val prodP1_reg = Reg(UInt(0))

it is initialized to zero, but no width is given.

that works fine with Chisel 2

However, with the new environment, the width of prodP1_reg is only one bit

which cause functionality and compiling problems

And I had to set the width explicitly for those registers.

val prodP1_reg = Reg(UInt(0, part1Size+1))

I do not know if this issue is the normal behavior for Chisel 3, or this just due to the complexity of the code

Note that, 2017 version contains the same code. The only difference is the equivalent of prodP1_reg is a wire (not a register.)

Clone this wiki locally