From dde58b15968299b3113c245bd4880b2f11a2f87e Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Wed, 6 May 2020 11:42:23 -0400 Subject: [PATCH] Add dict of spr properties to power_enums --- src/soc/decoder/power_enums.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/soc/decoder/power_enums.py b/src/soc/decoder/power_enums.py index 79805527..ef919ee1 100644 --- a/src/soc/decoder/power_enums.py +++ b/src/soc/decoder/power_enums.py @@ -221,6 +221,11 @@ class CryIn(Enum): # http://bugs.libre-riscv.org/show_bug.cgi?id=261 spr_csv = get_csv("sprs.csv") -spr_info = namedtuple('spr_info', 'SPR priv_mtspr priv_mfspr len') +spr_info = namedtuple('spr_info', 'SPR priv_mtspr priv_mfspr length') +spr_dict = {} +for row in spr_csv: + info = spr_info(SPR=row['SPR'], priv_mtspr=row['priv_mtspr'], + priv_mfspr=row['priv_mfspr'], length=int(row['len'])) + spr_dict[int(row['Idx'])] = info fields = [(row['SPR'], int(row['Idx'])) for row in spr_csv] SPR = Enum('SPR', fields) -- 2.30.2