Open loopyK1ng opened 2 years ago
I think inc_value
should not be the first class object of Python.
In the following case, Minus
object of Pyverilog is better.
# original
inc_value = p[5]
inc_value.value = str(int(inc_value.value)-1)
p[0] = Partselect(p[1], p[3], Plus(p[3], inc_value), lineno=p.lineno(1))
# proposal
inc_value = Minus(p[5], IntConst('1'))
p[0] = Partselect(p[1], p[3], Plus(p[3], inc_value), lineno=p.lineno(1))
You are right. Included your suggestions.
Fixed the MSB or LSB computation for the indexed vector partselect for Verilog. The second value is not a direct offset but the width of the selected part. So the value needs to be decreased by 1 before adding or subtracting it from the base.
Example Code: module.v
The first indices for OUT result in 15 (MSB) and -1 (LSB). Same for the first in. Additionally, 0+:16 results in 0 (LSB) and 16 (MSB).
Also contributed and a big thanks to: @GorgeousWalrus