rpc: fix parsing of negative signed parameters
authorRobin Ole Heinemann <robin.ole.heinemann@gmail.com>
Tue, 18 May 2021 18:43:16 +0000 (20:43 +0200)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 15:28:05 +0000 (15:28 +0000)
nmigen/rpc.py

index a03ec23c44d64cf8e5c2be31e1bdf402776abdff..f3455e6d62808b79e5e6ba7f6d840b5bca79b797 100644 (file)
@@ -50,7 +50,7 @@ def _serve_yosys(modules):
                     width = len(parameter["value"])
                     parameter_value = int(parameter["value"], 2)
                     if parameter_value & (1 << (width - 1)):
-                        parameter_value = -((1 << width) - value)
+                        parameter_value = -((1 << width) - parameter_value)
                 elif parameter["type"] == "string":
                     parameter_value = parameter["value"]
                 elif parameter["type"] == "real":