add individual field-detection where field spec is "d0,d1,d2"
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 6 Apr 2020 11:15:28 +0000 (12:15 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 6 Apr 2020 11:15:28 +0000 (12:15 +0100)
libreriscv
src/soc/decoder/power_fields.py

index 9a4012b31563923b466ea4889ee8c8847527ff16..1804334535fcfbe92a0f8abf5fb5399963032cf1 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9a4012b31563923b466ea4889ee8c8847527ff16
+Subproject commit 1804334535fcfbe92a0f8abf5fb5399963032cf1
index 26b59d46863fcd313e6d952b8f5fab22129afef0..4e7bee0951ed6263265cb010a2935a72c75c18c6 100644 (file)
@@ -208,9 +208,18 @@ class DecodeFields:
         res = {}
         for field in fields:
             f, spec = field.strip().split(" ")
+            ss = spec[1:-1].split(",")
+            fs = f.split(",")
+            if len(fs) > 1:
+                individualfields = []
+                for f0, s0 in zip(fs, ss):
+                    txt = "%s (%s)" % (f0, s0)
+                    individualfields.append(txt)
+                if len(fs) > 1:
+                  res.update(self.decode_instruction_fields(individualfields))
             d = self.bitkls(*self.bitargs)
             idx = 0
-            for s in spec[1:-1].split(","):
+            for s in ss:
                 s = s.split(':')
                 if len(s) == 1:
                     d[idx] = int(s[0])
@@ -233,3 +242,7 @@ if __name__ == '__main__':
     dec = DecodeFields()
     dec.create_specs()
     forms, instrs = dec.forms, dec.instrs
+    for form, fields in instrs.items():
+        print ("Form", form)
+        for field, bits in fields.items():
+            print ("\tfield", field, bits)