From 474eb33cddcb7453720907732a2b2944681e4e6f Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Wed, 18 Mar 2020 09:30:03 -0400 Subject: [PATCH] Create SPR enum from sprs.csv --- src/soc/decoder/power_enums.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/soc/decoder/power_enums.py b/src/soc/decoder/power_enums.py index 9a3253fa..cfa0bacb 100644 --- a/src/soc/decoder/power_enums.py +++ b/src/soc/decoder/power_enums.py @@ -155,9 +155,9 @@ class InternalOp(Enum): @unique class In1Sel(Enum): - RA = 0 - RA_OR_ZERO = 1 - NONE = 2 + NONE = 0 + RA = 1 + RA_OR_ZERO = 2 SPR = 3 @@ -220,21 +220,6 @@ class CryIn(Enum): # TODO: make this read the sprs.csv file # http://bugs.libre-riscv.org/show_bug.cgi?id=261 -@unique -class SPR(Enum): - XER = 1 - LR = 8 - CTR = 9 - TB = 268 - SRR0 = 26 - SRR1 = 27 - HSRR0 = 314 - HSRR1 = 315 - SPRG0 = 272 - SPRG1 = 273 - SPRG2 = 274 - SPRG3 = 275 - SPRG3U = 259 - HSPRG0 = 304 - HSPRG1 = 305 - +spr_csv = get_csv("sprs.csv") +fields = [(row['SPR'], row['Idx']) for row in spr_csv] +SPR = Enum('SPR', fields) -- 2.30.2