back.rtlil: explicitly pad constants with zeroes.

I'm not sure what exactly RTLIL does when a constant isn't as long
as its bit width, and there's no reason to keep the ambiguity.
This commit is contained in:
whitequark 2018-12-21 01:51:18 +00:00
parent 221f108fbe
commit 6672ab2e3f

View file

@ -353,7 +353,7 @@ class _RHSValueCompiler(_ValueCompiler):
if isinstance(value.value, str):
return "{}'{}".format(value.nbits, value.value)
else:
return "{}'{:b}".format(value.nbits, value.value)
return "{}'{:0{}b}".format(value.nbits, value.value, value.nbits)
def on_Signal(self, value):
wire_curr, wire_next = self.s.resolve(value)