remove hard-coded width
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 19 Feb 2019 07:41:35 +0000 (07:41 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 19 Feb 2019 07:41:35 +0000 (07:41 +0000)
src/add/nmigen_add_experiment.py

index 38cd8d78658d2f2af1a2b6c26364a11e55b8fdda..26c779ff7231c0bc97112a7654d94025fd7c87d5 100644 (file)
@@ -29,7 +29,7 @@ class FPADD(FPBase):
         b = FPNum(self.width)
         z = FPNum(self.width, False)
 
-        w = {32: 28, 64:57}[self.width]
+        w = z.m_width + 4
         tot = Signal(w) # sticky/round/guard, {mantissa} result, 1 overflow
 
         of = Overflow()