make svp64 isa caller unit tests more obvious
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 24 Mar 2021 16:10:00 +0000 (16:10 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 24 Mar 2021 16:10:00 +0000 (16:10 +0000)
src/soc/decoder/isa/test_caller_svp64.py

index 7875dc089c638d717c5ea87c45288b837aaf4c93..7cc04f403c0e0632de42440960fe221b333aaa42 100644 (file)
@@ -53,19 +53,19 @@ class DecoderTestCase(FHDLTestCase):
 
         # initial values in GPR regfile
         initial_regs = [0] * 32
+        initial_regs[5] = 0x4321
         initial_regs[9] = 0x1234
         initial_regs[10] = 0x1111
-        initial_regs[5] = 0x4321
         initial_regs[6] = 0x2223
         # SVSTATE (in this case, VL=2)
         svstate = SVP64State()
         svstate.vl[0:7] = 2 # VL
         svstate.maxvl[0:7] = 2 # MAXVL
         print ("SVSTATE", bin(svstate.spr.asint()))
-        # copy before running
+        # copy before running, then compute answers
         expected_regs = deepcopy(initial_regs)
-        expected_regs[1] = 0x5555
-        expected_regs[2] = 0x3334
+        expected_regs[1] = initial_regs[5] + initial_regs[9]  # 0x5555
+        expected_regs[2] = initial_regs[6] + initial_regs[10] # 0x3334
 
         with Program(lst, bigendian=False) as program:
             sim = self.run_tst_program(program, initial_regs, svstate)
@@ -93,7 +93,7 @@ class DecoderTestCase(FHDLTestCase):
         print ("SVSTATE", bin(svstate.spr.asint()))
         # copy before running
         expected_regs = deepcopy(initial_regs)
-        expected_regs[1] = 0x5555
+        expected_regs[1] = initial_regs[5] + initial_regs[9] # 0x5555
 
         with Program(lst, bigendian=False) as program:
             sim = self.run_tst_program(program, initial_regs, svstate)
@@ -121,8 +121,8 @@ class DecoderTestCase(FHDLTestCase):
         print ("SVSTATE", bin(svstate.spr.asint()))
         # copy before running
         expected_regs = deepcopy(initial_regs)
-        expected_regs[1] = 0x5555
-        expected_regs[2] = 0x5432
+        expected_regs[1] = initial_regs[5] + initial_regs[9]   # 0x5555
+        expected_regs[2] = initial_regs[5] + initial_regs[10]  # 0x5432
 
         with Program(lst, bigendian=False) as program:
             sim = self.run_tst_program(program, initial_regs, svstate)
@@ -176,8 +176,8 @@ class DecoderTestCase(FHDLTestCase):
         print ("SVSTATE", bin(svstate.spr.asint()))
         # copy before running
         expected_regs = deepcopy(initial_regs)
-        expected_regs[1] = 0
-        expected_regs[2] = 0x3334
+        expected_regs[1] = initial_regs[5] + initial_regs[9]  # 0x0
+        expected_regs[2] = initial_regs[6] + initial_regs[10] # 0x3334
 
         with Program(lst, bigendian=False) as program:
             sim = self.run_tst_program(program, initial_regs, svstate)