From: Luke Kenneth Casson Leighton Date: Mon, 1 Jun 2020 04:50:28 +0000 (+0100) Subject: decode SPRs for branch X-Git-Tag: div_pipeline~696 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=590b2d88fad8fa943e8d7aabe0502a6a8caa9402;p=soc.git decode SPRs for branch --- diff --git a/src/soc/decoder/power_enums.py b/src/soc/decoder/power_enums.py index b294324e..a9e4c745 100644 --- a/src/soc/decoder/power_enums.py +++ b/src/soc/decoder/power_enums.py @@ -273,5 +273,6 @@ if __name__ == '__main__': print ("sprs", len(SPR)) print (dir(SPR)) print (dir(Enum)) + print (SPR.__members__['TAR']) for x in SPR: - print (x, x.value) + print (x, x.value, str(x), x.name) diff --git a/src/soc/fu/compunits/test/test_branch_compunit.py b/src/soc/fu/compunits/test/test_branch_compunit.py index 256d9cc0..c7cd772a 100644 --- a/src/soc/fu/compunits/test/test_branch_compunit.py +++ b/src/soc/fu/compunits/test/test_branch_compunit.py @@ -1,5 +1,5 @@ import unittest -from soc.decoder.power_enums import (XER_bits, Function) +from soc.decoder.power_enums import (XER_bits, Function, spr_dict) # XXX bad practice: use of global variables from soc.fu.branch.test.test_pipe_caller import BranchTestCase @@ -47,14 +47,16 @@ class BranchTestRunner(TestRunner): res['cr_a'] = sim.crl[cr1_sel].get_range().value # SPR1 - cr1_en = yield dec2.e.read_spr1.ok - res['spr1'] = sim.spr['CTR'].value - - # RB (or immediate) - reg2_ok = yield dec2.e.read_reg2.ok - if reg2_ok: - data2 = yield dec2.e.read_reg2.data - res['b'] = sim.gpr(data2).value + spr_ok = yield dec2.e.read_spr1.ok + spr_num = yield dec2.e.read_spr1.data + if spr_ok: + res['spr1'] = sim.spr[spr_dict[spr_num].SPR].value + + # SPR2 + spr_ok = yield dec2.e.read_spr2.ok + spr_num = yield dec2.e.read_spr2.data + if spr_ok: + res['spr2'] = sim.spr[spr_dict[spr_num].SPR].value print ("get inputs", res) return res