From 3a40cddd16f77259c9f15edaa5aecb12f1a1324d Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 6 Apr 2020 12:15:28 +0100 Subject: [PATCH] add individual field-detection where field spec is "d0,d1,d2" --- libreriscv | 2 +- src/soc/decoder/power_fields.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libreriscv b/libreriscv index 9a4012b3..18043345 160000 --- a/libreriscv +++ b/libreriscv @@ -1 +1 @@ -Subproject commit 9a4012b31563923b466ea4889ee8c8847527ff16 +Subproject commit 1804334535fcfbe92a0f8abf5fb5399963032cf1 diff --git a/src/soc/decoder/power_fields.py b/src/soc/decoder/power_fields.py index 26b59d46..4e7bee09 100644 --- a/src/soc/decoder/power_fields.py +++ b/src/soc/decoder/power_fields.py @@ -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) -- 2.30.2