fhdl: do not attempt slicing non-array signals to keep Verilog happy

This commit is contained in:
Sebastien Bourdeauducq 2012-02-06 18:07:02 +01:00
parent fcd6583cbb
commit 1eb348c573
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,12 @@ def _printexpr(ns, node):
raise TypeError
return "(" + r + ")"
elif isinstance(node, _Slice):
# Verilog does not like us slicing non-array signals...
if isinstance(node.value, Signal) \
and node.value.bv.width == 1 \
and node.start == 0 and node.stop == 1:
return _printexpr(ns, node.value)
if node.start + 1 == node.stop:
sr = "[" + str(node.start) + "]"
else: