do abs slightly differently in SelectableInt
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 6 Jul 2020 19:48:26 +0000 (20:48 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 6 Jul 2020 19:48:26 +0000 (20:48 +0100)
src/soc/decoder/selectable_int.py

index 1bd2b94c1e353de8932d81a1a556bab603bee9bf..359afc97e48fe42316690449f7e1991aaf4f5231 100644 (file)
@@ -199,7 +199,7 @@ class SelectableInt:
     def __abs__(self):
         print ("abs", self.value & (1<<(self.bits-1)))
         if self.value & (1<<(self.bits-1)) != 0:
-            return SelectableInt(0, self.bits) - self
+            return -self
         return self
 
     def __rsub__(self, b):