add support for setting initial FPSCR in unit tests
authorJacob Lifshay <programmerjake@gmail.com>
Wed, 17 May 2023 04:51:39 +0000 (21:51 -0700)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:18 +0000 (19:51 +0100)
src/openpower/test/common.py
src/openpower/test/runner.py

index d9a846d24de74ede5ddfa2b999fe949b80f851fe..e4bded79cc9cb0dae41106bfbad3fc3bc4b8d73c 100644 (file)
@@ -122,6 +122,7 @@ class TestAccumulatorBase:
                  expected=None,
                  stop_at_pc=None,
                  fpregs=None,
+                 initial_fpscr=None,
                  src_loc_at=0):
 
         # name of caller of this function
@@ -138,7 +139,8 @@ class TestAccumulatorBase:
                       stop_at_pc=stop_at_pc,
                       test_file=test_file,
                       subtest_args=self.__subtest_args.copy(),
-                      fpregs=fpregs)
+                      fpregs=fpregs,
+                      initial_fpscr=initial_fpscr)
 
         self.test_data.append(tc)
 
@@ -155,7 +157,8 @@ class TestCase:
                  stop_at_pc=None,
                  test_file=None,
                  subtest_args=None,
-                 fpregs=None):
+                 fpregs=None,
+                 initial_fpscr=None):
 
         self.program = program
         self.name = name
@@ -181,6 +184,9 @@ class TestCase:
         self.stop_at_pc = stop_at_pc # hard-stop address (do not attempt to run)
         self.test_file = test_file
         self.subtest_args = {} if subtest_args is None else dict(subtest_args)
+        if initial_fpscr is None:
+            initial_fpscr = 0
+        self.initial_fpscr = initial_fpscr
 
 
 class ALUHelpers:
index 4068d1ab10c117f348ff0dc8eca62ed7c276fd59..656e2b5bf948f15162c6d37ead2df22201f62582 100644 (file)
@@ -74,7 +74,8 @@ class SimRunner(StateRunner):
                   bigendian=bigendian,
                   initial_svstate=test.svstate,
                   mmu=self.mmu,
-                  fpregfile=test.fpregs)
+                  fpregfile=test.fpregs,
+                  initial_fpscr=test.initial_fpscr)
 
         # run the loop of the instructions on the current test
         index = sim.pc.CIA.value//4