From 8546eb24e9ae7649dccb51f512b9269f29aa15c7 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 8 Jul 2020 19:45:27 +0100 Subject: [PATCH] add spr to fast reg converter --- src/soc/regfile/util.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/soc/regfile/util.py b/src/soc/regfile/util.py index 1587e550..c7d691ce 100644 --- a/src/soc/regfile/util.py +++ b/src/soc/regfile/util.py @@ -12,3 +12,18 @@ def fast_reg_to_spr(spr_num): return SPR.SRR0.value elif spr_num == FastRegs.SRR1: return SPR.SRR1.value + + +def spr_to_fast_reg(spr_num): + if not isinstance(spr_num, str): + spr_num = spr_dict[spr_num].SPR + if spr_num == 'CTR': + return FastRegs.CTR + elif spr_num == 'LR': + return FastRegs.LR + elif spr_num == 'TAR': + return FastRegs.TAR + elif spr_num == 'SRR0': + return FastRegs.SRR0 + elif spr_num == 'SRR1': + return FastRegs.SRR1 -- 2.30.2