Add dict of spr properties to power_enums
authorMichael Nolan <mtnolan2640@gmail.com>
Wed, 6 May 2020 15:42:23 +0000 (11:42 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Wed, 6 May 2020 15:44:27 +0000 (11:44 -0400)
src/soc/decoder/power_enums.py

index 79805527b980a6e43d4ec34f98768bd1a6d7fd89..ef919ee1d359ac4783d0f90ece6f59a40f7f3c0c 100644 (file)
@@ -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)