From 132d38b3e273919b5cb963194a7233035b7e0897 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 27 May 2021 11:28:38 +0100 Subject: [PATCH] add setting of qemu GPRs/FPRs in pypowersim --- src/openpower/decoder/isa/pypowersim.py | 7 +++++++ src/openpower/simulator/qemu.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/openpower/decoder/isa/pypowersim.py b/src/openpower/decoder/isa/pypowersim.py index 6f561309..9bdec27b 100644 --- a/src/openpower/decoder/isa/pypowersim.py +++ b/src/openpower/decoder/isa/pypowersim.py @@ -132,6 +132,13 @@ def run_tst(args, generator, qemu, qemu = run_program(generator, initial_mem=mem, bigendian=False, start_addr=initial_pc, continuous_run=False) + # TODO: SPRs. how?? + if initial_regs is not None: + for reg, val in enumerate(initial_regs): + qemu.set_gpr(reg, val) + if initial_fprs is not None: + for fpr, val in enumerate(initial_fprs): + qemu.set_fpr(fpr, val) m = Module() comb = m.d.comb diff --git a/src/openpower/simulator/qemu.py b/src/openpower/simulator/qemu.py index 830851e3..cdbee4f6 100644 --- a/src/openpower/simulator/qemu.py +++ b/src/openpower/simulator/qemu.py @@ -125,11 +125,11 @@ class QemuController: def set_gpr(self, reg, val): self._rcache_trash('x %d' % reg) - self.gdb_eval('$r%d=%d' % (reg, pc)) + self.gdb_eval('$r%d=%d' % (reg, val)) def set_fpr(self, reg, val): self._rcache_trash('x %d' % (reg+32)) - self.gdb_eval('$fp%d=%d' % (reg, pc)) + self.gdb_eval('$fp%d=%d' % (reg, val)) def set_pc(self, pc): self._rcache_trash('x 64') -- 2.30.2