From 20fd00f3563930152217351f96ea0ebd49e3a11c Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 16 May 2023 21:51:39 -0700 Subject: [PATCH] add support for setting initial FPSCR in unit tests --- src/openpower/test/common.py | 10 ++++++++-- src/openpower/test/runner.py | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/openpower/test/common.py b/src/openpower/test/common.py index d9a846d2..e4bded79 100644 --- a/src/openpower/test/common.py +++ b/src/openpower/test/common.py @@ -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: diff --git a/src/openpower/test/runner.py b/src/openpower/test/runner.py index 4068d1ab..656e2b5b 100644 --- a/src/openpower/test/runner.py +++ b/src/openpower/test/runner.py @@ -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 -- 2.30.2