cleaner way to test link register ok
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 May 2020 18:52:55 +0000 (19:52 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 May 2020 18:52:55 +0000 (19:52 +0100)
src/soc/fu/branch/formal/proof_main_stage.py

index 218e4dfa94b0cf84c6bae138d81701739d988e02..699efd574d7d9c592ec9df9de4b32ae00af17a97 100644 (file)
@@ -128,11 +128,9 @@ class Driver(Elaboratable):
                         comb += Assert(nia_o.data == imm)
                     with m.Else():
                         comb += Assert(nia_o.data == (cia + imm)[0:64])
+                    comb += Assert(lr_o.ok == rec.lk)
                     with m.If(rec.lk):
                         comb += Assert(lr_o.data == (cia + 4)[0:64])
-                        comb += Assert(lr_o.ok == 1)
-                    with m.Else():
-                        comb += Assert(lr_o.ok == 0)
 
                 # Check that CTR is decremented
                 with m.If(~BO[2]):
@@ -146,11 +144,9 @@ class Driver(Elaboratable):
                     comb += Assert(nia_o.data == spr1)
 
                     # make sure branch+link works
+                    comb += Assert(lr_o.ok == rec.lk)
                     with m.If(rec.lk):
                         comb += Assert(lr_o.data == (cia + 4)[0:64])
-                        comb += Assert(lr_o.ok == 1)
-                    with m.Else():
-                        comb += Assert(lr_o.ok == 0)
 
                 # Check that CTR is decremented
                 with m.If(~BO[2]):