gen/fhdl/verilog: fix signed init values
This commit is contained in:
parent
ff066a5e09
commit
d92bd8ffaa
|
@ -59,8 +59,8 @@ def _printsig(ns, s):
|
||||||
|
|
||||||
def _printconstant(node):
|
def _printconstant(node):
|
||||||
if node.signed:
|
if node.signed:
|
||||||
return (str(node.nbits) + "'sd" + str(2**node.nbits + node.value),
|
sign = "-" if node.value < 0 else ""
|
||||||
True)
|
return (sign + str(node.nbits) + "'d" + str(abs(node.value)), True)
|
||||||
else:
|
else:
|
||||||
return str(node.nbits) + "'d" + str(node.value), False
|
return str(node.nbits) + "'d" + str(node.value), False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue