[myhdl-list] the path not taken
Brought to you by:
jandecaluwe
|
From: Neal B. <ndb...@gm...> - 2009-04-24 12:52:14
|
I'm having a problem with this code:
def rnd (x, bits, output):
min_val = x.min
max_val = x.max
@always_comb
def rnd_logic():
if (bits < 1):
output.next = x
else:
y1 = intbv (int (x >> (bits-1)), min_val, max_val)
#y1 = intbv (int(x), min_val, max_val)
y2 = intbv (int (y1 + 1), min_val, max_val)
y3 = intbv (int (y2 >> 1), min_val, max_val)
output.next = y3
return rnd_logic
When translating to verilog:
ValueError: negative shift count
If the commented line #y1 is used, no error.
So myhdl is complaining about neg shift count if bits < 1, even though I
tried to eliminate that with the if (bits < 1).
What can I do?
|