From: Michael Nolan Date: Wed, 6 May 2020 15:42:23 +0000 (-0400) Subject: Add dict of spr properties to power_enums X-Git-Tag: div_pipeline~1370 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dde58b15968299b3113c245bd4880b2f11a2f87e;p=soc.git Add dict of spr properties to power_enums --- 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)