whoops need to read RS in CR inputs test
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 1 Jun 2020 04:20:08 +0000 (05:20 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 1 Jun 2020 04:20:08 +0000 (05:20 +0100)
src/soc/fu/compunits/test/test_cr_compunit.py
src/soc/fu/cr/pipe_data.py

index b230be13d9ab6dd00358a4976536f6a28e83e498..b1b6332d36df21791d062ad57e84694bad9493f0 100644 (file)
@@ -41,11 +41,15 @@ class CRTestRunner(TestRunner):
                 cr3_sel = yield dec2.e.read_cr3.data
                 res['cr_c'] = sim.crl[cr3_sel].get_range().value
 
-        # RA
+        # RA/RC
         reg1_ok = yield dec2.e.read_reg1.ok
+        reg3_ok = yield dec2.e.read_reg3.ok
         if reg1_ok:
             data1 = yield dec2.e.read_reg1.data
             res['a'] = sim.gpr(data1).value
+        if reg3_ok:
+            data1 = yield dec2.e.read_reg3.data
+            res['a'] = sim.gpr(data1).value
 
         # RB (or immediate)
         reg2_ok = yield dec2.e.read_reg2.ok
@@ -53,13 +57,14 @@ class CRTestRunner(TestRunner):
             data2 = yield dec2.e.read_reg2.data
             res['b'] = sim.gpr(data2).value
 
+        print ("get inputs", res)
         return res
 
     def check_cu_outputs(self, res, dec2, sim, code):
         """naming (res) must conform to CRFunctionUnit output regspec
         """
 
-        print ("check extra output", repr(code))
+        print ("check extra output", repr(code), res)
 
         # full CR
         whole_reg = yield dec2.e.write_cr_whole
@@ -67,6 +72,7 @@ class CRTestRunner(TestRunner):
         if whole_reg:
             full_cr = res['full_cr']
             expected_cr = sim.cr.get_range().value
+            print(f"expected cr {expected_cr:x}, actual: {full_cr:x}")
             self.assertEqual(expected_cr, full_cr, code)
 
         # part-CR
index 9879955ceff9e599ecdd1888b85edfbc58d1e6b0..c22a3b1ecd19172eb2a898b1df2dbb29e6f1fcee 100644 (file)
@@ -51,8 +51,8 @@ class CROutputData(IntegerData):
     def __init__(self, pspec):
         super().__init__(pspec)
         self.o = Data(64, name="o") # RA
-        self.full_cr = Data(32, name="cr_out") # CR in
-        self.cr = Data(4, name="cr_o")
+        self.full_cr = Data(32, name="full_cr")
+        self.cr = Data(4, name="cr")
 
     def __iter__(self):
         yield from super().__iter__()