Fix test_isel to properly examine registers
authorMichael Nolan <mtnolan2640@gmail.com>
Thu, 28 May 2020 14:51:31 +0000 (10:51 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Thu, 28 May 2020 14:51:31 +0000 (10:51 -0400)
src/soc/fu/cr/test/test_pipe_caller.py

index 5a5c20350a955d126b171e07db23452af8a92614..afe7745c69a074677268f65ca93392e9e5c28112 100644 (file)
@@ -121,6 +121,8 @@ class CRTestCase(FHDLTestCase):
             initial_regs = [0] * 32
             initial_regs[2] = random.randint(0, (1<<64)-1)
             initial_regs[3] = random.randint(0, (1<<64)-1)
+            self.run_tst_program(Program(lst),
+                                 initial_regs=initial_regs, initial_cr=cr)
             self.run_tst_program(Program(lst), initial_cr=cr)
 
             
@@ -167,6 +169,17 @@ class TestRunner(FHDLTestCase):
             reg3 = simulator.gpr(reg3_sel).value
             yield alu.p.data_i.a.eq(reg3)
 
+        reg1_ok = yield dec2.e.read_reg1.ok
+        if reg1_ok:
+            reg1_sel = yield dec2.e.read_reg1.data
+            reg1 = simulator.gpr(reg1_sel).value
+            yield alu.p.data_i.a.eq(reg1)
+        reg2_ok = yield dec2.e.read_reg2.ok
+        if reg2_ok:
+            reg2_sel = yield dec2.e.read_reg2.data
+            reg2 = simulator.gpr(reg2_sel).value
+            yield alu.p.data_i.b.eq(reg2)
+
     def assert_outputs(self, alu, dec2, simulator, code):
         whole_reg = yield dec2.e.write_cr_whole
         cr_en = yield dec2.e.write_cr.ok