1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

Solved bug 28

This commit is contained in:
Jan Decaluwe 2013-04-10 14:30:45 +02:00
parent a1d8d83f97
commit 6e3df2c439
2 changed files with 17 additions and 1 deletions

View File

@ -604,7 +604,7 @@ class _ConvertVisitor(ast.NodeVisitor, _ConversionMixin):
else:
raise AssertionError("unexpected op %s" % op)
elif isinstance(left.vhd, vhd_int) and isinstance(right.vhd, vhd_vector):
if isinstance(op, ast.Add, ast.Sub, ast.Mod, ast.FloorDiv):
if isinstance(op, (ast.Add, ast.Sub, ast.Mod, ast.FloorDiv)):
right.vhd.size = ns
node.vhdOri.size = ns
elif isinstance(op, ast.Mult):

View File

@ -0,0 +1,16 @@
from myhdl import *
def bug_28(dout, channel):
@always_comb
def comb():
dout.next = 0x8030 + (channel << 10)
return comb
dout = Signal(intbv(0)[16:0])
channel = Signal(intbv(0)[4:0])
def test_bug_28():
try:
toVHDL(bug_28, dout, channel)
except:
raise