projects
/
soc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
620ddd2
)
add spr to fast reg converter
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Wed, 8 Jul 2020 18:45:27 +0000
(19:45 +0100)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Wed, 8 Jul 2020 18:45:27 +0000
(19:45 +0100)
src/soc/regfile/util.py
patch
|
blob
|
history
diff --git
a/src/soc/regfile/util.py
b/src/soc/regfile/util.py
index 1587e550d0a445406bee600cb2215af16044b5b9..c7d691cefda9873b1eb084f4ec458566d90e0bce 100644
(file)
--- 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