From: Luke Kenneth Casson Leighton Date: Sun, 31 Jan 2021 20:28:27 +0000 (+0000) Subject: test SVP64 major opcode, start checking if it is EXT001 soon X-Git-Tag: convert-csv-opcode-to-binary~273 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e3f4f16cdf9de7ebdaf5971f586475f5c623ca6;p=soc.git test SVP64 major opcode, start checking if it is EXT001 soon --- diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index c1372a9a..38a439f0 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -242,14 +242,14 @@ class SVP64RMFields: # SVP64 Prefix fields: see https://libre-soc.org/openpower/sv/svp64/ -class SPP64PrefixFields: +class SVP64PrefixFields: def __init__(self): self.insn = SelectableInt(0, 32) # 6 bit major opcode EXT001, 2 bits "identifying" (7, 9), 24 SV ReMap self.major = FieldSelectableInt(self.insn, tuple(range(0,6))) self.pid = FieldSelectableInt(self.insn, (7, 9)) # must be 0b11 rmfields = [6, 8] + list(range(10,32)) # SVP64 24-bit RM - self.rm = FieldSelectableInt(self.spr, rmfields) + self.rm = FieldSelectableInt(self.insn, rmfields) class SPR(dict): @@ -611,6 +611,10 @@ class ISACaller: # SVP64. first, check if the opcode is EXT001 yield Settle() opcode = yield self.dec2.dec.opcode_in + pfx = SVP64PrefixFields() + pfx.insn.value = opcode + major = pfx.major.asint(msb0=True) # MSB0 inversion + print ("prefix test: opcode:", major, bin(major)) def execute_one(self): """execute one instruction diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index 575d1d87..53e85036 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -114,6 +114,13 @@ class FieldSelectableInt: def __repr__(self): return "FieldSelectableInt(si=%s, br=%s)" % (self.si, self.br) + def asint(self, msb0=False): + res = 0 + brlen = len(self.br) + for i, key in enumerate(self.br): + res |= self.si[key].value << ((brlen-i-1) if msb0 else i) + return res + class FieldSelectableIntTestCase(unittest.TestCase): def test_arith(self):