Use overflow definition from microwatt
authorMichael Nolan <mtnolan2640@gmail.com>
Wed, 20 May 2020 17:04:43 +0000 (13:04 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Wed, 20 May 2020 17:11:39 +0000 (13:11 -0400)
src/soc/fu/alu/formal/proof_main_stage.py

index 52237aeb6b3ab722abe8d66b24d7efb81dc11273..6e6b1c8540f3a8c7a0d141eaae0342f1de4d0936 100644 (file)
@@ -80,14 +80,11 @@ class Driver(Elaboratable):
                 comb += Assert((a[0:32] + b[0:32] + carry_in)[32]
                                == carry_out32)
 
-                with m.If(a[-1] == b[-1]):
-                    comb += Assert(ov_out == (o[-1] != a[-1]))
-                with m.Else():
-                    comb += Assert(ov_out == 0)
-                with m.If(a[31] == b[31]):
-                    comb += Assert(ov_out32 == (o[31] != a[31]))
-                with m.Else():
-                    comb += Assert(ov_out32 == 0)
+                # From microwatt execute1.vhdl line 130
+                comb += Assert(ov_out == ((carry_out ^ o[-1]) &
+                                          ~(a[-1] ^ b[-1])))
+                comb += Assert(ov_out32 == ((carry_out32 ^ o[31]) &
+                                            ~(a[31] ^ b[31])))
             with m.Case(InternalOp.OP_EXTS):
                 for i in [1, 2, 4]:
                     with m.If(rec.data_len == i):