resolve spr names in ISACaller
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 4 Jul 2020 16:59:52 +0000 (17:59 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 4 Jul 2020 16:59:52 +0000 (17:59 +0100)
src/soc/decoder/isa/caller.py

index 12cb66478cca422e5261abc2650801706ef62a45..a57194bec41ab28490d0df91d75362b7f62d88f8 100644 (file)
@@ -188,8 +188,6 @@ class SPR(dict):
         self.sd = dec2
         dict.__init__(self)
         for key, v in initial_sprs.items():
-            if isinstance(key, str):
-                key = spr_byname[key].SPR
             if isinstance(key, SelectableInt):
                 key = key.value
             key = special_sprs.get(key, key)
@@ -207,6 +205,8 @@ class SPR(dict):
         # if key in special_sprs get the special spr, otherwise return key
         if isinstance(key, SelectableInt):
             key = key.value
+        if isinstance(key, int):
+            key = spr_dict[key].SPR
         key = special_sprs.get(key, key)
         if key in self:
             res = dict.__getitem__(self, key)
@@ -220,6 +220,9 @@ class SPR(dict):
     def __setitem__(self, key, value):
         if isinstance(key, SelectableInt):
             key = key.value
+        if isinstance(key, int):
+            key = spr_dict[key].SPR
+            print ("spr key", key)
         key = special_sprs.get(key, key)
         print ("setting spr", key, value)
         dict.__setitem__(self, key, value)