sysreg.py: Add sysreg_name() helper

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-05-12 21:19:50 +09:00
parent a519af2ca8
commit 5bea278509

View file

@ -14,6 +14,11 @@ sysreg_fwd = dict(load_registers())
sysreg_rev = {v: k for k, v in sysreg_fwd.items()}
globals().update(sysreg_fwd)
def sysreg_name(enc):
if enc in sysreg_rev:
return sysreg_rev[enc]
return f"s{enc[0]}_{enc[1]}_c{enc[2]}_c{enc[3]}_{enc[4]}"
class ESR_EC(IntEnum):
UNKNOWN = 0b000000
WFI = 0b000001