projects
/
nmigen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5702767
)
back.rtlil: always output negative values as two's complement.
author
whitequark
<whitequark@whitequark.org>
Mon, 24 Dec 2018 01:38:32 +0000
(
01:38
+0000)
committer
whitequark
<whitequark@whitequark.org>
Mon, 24 Dec 2018 01:38:32 +0000
(
01:38
+0000)
- is valid in RTLIL but means something entirely different.
nmigen/back/rtlil.py
patch
|
blob
|
history
diff --git
a/nmigen/back/rtlil.py
b/nmigen/back/rtlil.py
index 0bd5f08629321702fd7df06261a35abadebc4373..91bd1c1ffed4dce4df9eb46ca0a367b3c68578ee 100644
(file)
--- a/
nmigen/back/rtlil.py
+++ b/
nmigen/back/rtlil.py
@@
-361,7
+361,8
@@
class _RHSValueCompiler(_ValueCompiler):
if isinstance(value.value, str):
return "{}'{}".format(value.nbits, value.value)
else:
- return "{}'{:0{}b}".format(value.nbits, value.value, value.nbits)
+ value_twos_compl = value.value & ((1 << value.nbits) - 1)
+ return "{}'{:0{}b}".format(value.nbits, value_twos_compl, value.nbits)
def on_Signal(self, value):
wire_curr, wire_next = self.s.resolve(value)