veriloggen icon indicating copy to clipboard operation
veriloggen copied to clipboard

Slice in Wire with two dimension

Open LucasBraganca opened this issue 2 years ago • 1 comments

Hi, I'm trying to do the following structure in Veriloggen:

m  = Module('test')
my_wire0 = m.Wire('my_wire0',8,2)
my_wire1 = m.Output('my_wire1',2)
my_wire1.assign(my_wire0[0][0:2])
print(m.to_verilog())

But an exception is raised!

LucasBraganca avatar Mar 21 '22 23:03 LucasBraganca

I test this code, and found that the current Slice operator supports only raw variables (such as Input, Output, Reg, and Wire) as the first argument. I will fixed in the next version.

Please use this workaround:

m  = Module('test')
my_wire0 = m.Wire('my_wire0', 8, 2)
my_wire1 = m.Output('my_wire1', 2)
tmp = m.TmpWireLike(my_wire0[0])
my_wire1.assign(tmp[0:2])

shtaxxx avatar Apr 05 '22 10:04 shtaxxx