aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/trellis_import.py
diff options
context:
space:
mode:
Diffstat (limited to 'ecp5/trellis_import.py')
-rwxr-xr-xecp5/trellis_import.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ecp5/trellis_import.py b/ecp5/trellis_import.py
index aabcffb1..62aa4d81 100755
--- a/ecp5/trellis_import.py
+++ b/ecp5/trellis_import.py
@@ -297,7 +297,7 @@ class BinaryBlobAssembler:
assert len(self.data) % 2 == 0
if self.nodebug:
comment = None
- c2val = (~v + 1) if v < 0 else v
+ c2val = (((-v) ^ 0xffff) + 1) if v < 0 else v
if self.endianness == "le":
self.data.append(c2val & 255)
self.data.append((c2val >> 8) & 255)