From dad902a77535a947cc3d1f275414256dc48ad35e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 6 May 2023 14:31:13 +0100 Subject: [PATCH] add FPSCR to Test API (ExpectedState, SimState). untested --- src/openpower/test/state.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/openpower/test/state.py b/src/openpower/test/state.py index 07827e76..aa61d94b 100644 --- a/src/openpower/test/state.py +++ b/src/openpower/test/state.py @@ -73,6 +73,7 @@ class State: memory - stored as a dictionary {location: data} """ def get_state(self): + yield from self.get_fpscr() yield from self.get_fpregs() yield from self.get_intregs() yield from self.get_crregs() @@ -130,6 +131,11 @@ class State: self.dut.assertEqual(self.pc, s2.pc, "pc mismatch (%s != %s) %s" % (self.state_type, s2.state_type, repr(self.code))) + # fpscr + self.dut.assertEqual(self.fpscr, s2.fpscr, + "fpscr mismatch (%s != %s) %s" % + (self.state_type, s2.state_type, repr(self.code))) + def compare_mem(self, s2): # copy dics to preserve state mem then pad empty locs since # different Power ISA objects may differ how theystore memory @@ -210,6 +216,12 @@ class SimState(State): self.fpregs = _get_regs(self.sim.fpr) log("class sim fp regs", list(map(hex, self.fpregs))) + def get_fpscr(self): + if False: + yield + self.fpscr = self.sim.fpscr.value + log("class sim fpscr", hex(self.fpscr)) + def get_intregs(self): if False: yield @@ -267,12 +279,13 @@ class ExpectedState(State): see openpower/test/shift_rot/shift_rot_cases2.py for examples """ def __init__(self, int_regs=None, pc=0, crregs=None, - so=0, ov=0, ca=0, fp_regs=None): + so=0, ov=0, ca=0, fp_regs=None, fpscr=0): if fp_regs is None: fp_regs = 32 if isinstance(fp_regs, int): fp_regs = [0] * fp_regs self.fpregs = deepcopy(fp_regs) + self.fpscr = fpscr if int_regs is None: int_regs = 32 if isinstance(int_regs, int): @@ -290,6 +303,8 @@ class ExpectedState(State): def get_fpregs(self): if False: yield + def get_fpscr(self): + if False: yield def get_intregs(self): if False: yield def get_crregs(self): -- 2.30.2