fixed bug in value_bits_sign of mul operatiors
authorYves Delley <hack@delley.net>
Wed, 9 Sep 2015 13:32:09 +0000 (15:32 +0200)
committerYves Delley <hack@delley.net>
Wed, 9 Sep 2015 13:32:09 +0000 (15:32 +0200)
migen/fhdl/bitcontainer.py

index 381afc3501a5c8243a5c311692b24a351a4315cf..9763845f126138ce4843523216a2a7e2cff9c16f 100644 (file)
@@ -50,13 +50,13 @@ def value_bits_sign(v):
         elif v.op == "*":
             if not obs[0][1] and not obs[1][1]:
                 # both operands unsigned
-                return obs[0][0] + obs[1][0]
+                return obs[0][0] + obs[1][0], False
             elif obs[0][1] and obs[1][1]:
                 # both operands signed
-                return obs[0][0] + obs[1][0] - 1
+                return obs[0][0] + obs[1][0] - 1, True
             else:
                 # one operand signed, the other unsigned (add sign bit)
-                return obs[0][0] + obs[1][0] + 1 - 1
+                return obs[0][0] + obs[1][0] + 1 - 1, True
         elif v.op == "<<<":
             if obs[1][1]:
                 extra = 2**(obs[1][0] - 1) - 1