From 4adfb9105786dcd64874eedd8b774912ee9cc5d0 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 4 Apr 2020 22:00:51 +0100 Subject: [PATCH] add dump function for regs --- src/soc/decoder/isa/caller.py | 5 +++++ src/soc/decoder/power_pseudo.py | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index 24ce2a63..d83d3354 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -62,6 +62,11 @@ class GPR(dict): rnum = self._get_regnum(attr) return self.regfile[rnum] + def dump(self): + for i in range(len(self)): + print("reg", i, hex(self[i].value)) + + class ISACaller: # decoder2 - an instance of power_decoder2 diff --git a/src/soc/decoder/power_pseudo.py b/src/soc/decoder/power_pseudo.py index 3ac60c14..188ef0c2 100644 --- a/src/soc/decoder/power_pseudo.py +++ b/src/soc/decoder/power_pseudo.py @@ -139,13 +139,13 @@ do i = 0 to 7 print(i) """ -code = testdo +#code = testdo #code = _bpermd #code = testmul #code = testgetzero #code = testcat #code = testgpr -#code = testmem +code = testmem #code = testgprslice #code = testreg #code = cnttzd @@ -251,14 +251,14 @@ def test(): # uninitialised regs, drop them into dict for function for rname in gsc.parser.uninit_regs: d[rname] = SelectableInt(0, 64) # uninitialised (to zero) - print("uninitialised", rname, get_reg_hex(d[rname])) + print("uninitialised", rname, hex(d[rname].value)) # read regs, drop them into dict for function for rname in gsc.parser.read_regs: regidx = yield getattr(decode.sigforms['X'], rname) d[rname] = gsc.gpr[regidx] # contents of regfile d["_%s" % rname] = regidx # actual register value - print("read reg", rname, regidx, get_reg_hex(d[rname])) + print("read reg", rname, regidx, hex(d[rname].value)) exec(compiled_code, d) # code gets executed here in dict "d" print("Done") @@ -284,8 +284,7 @@ def test(): traces=decode.ports()): sim.run() - for i in range(len(gsc.gpr)): - print("regfile", i, get_reg_hex(gsc.gpr[i])) + gsc.gpr.dump() for i in range(0, len(gsc.mem.mem), 16): hexstr = [] -- 2.30.2