From: Luke Kenneth Casson Leighton Date: Tue, 9 Jan 2024 13:39:28 +0000 (+0000) Subject: bug 1248: add a stack of missing CR 3/5-bit operand vector naming X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=72181c4b033a03fdef9240bca0a7de761806ea1a;p=openpower-isa.git bug 1248: add a stack of missing CR 3/5-bit operand vector naming --- diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index 8e476a28..df09f6ca 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -560,6 +560,9 @@ def get_cr_in(dec2, name): if name == 'BI': if in_sel == CRInSel.BI.value: return in1, cr_isvec + if name in ['BA', 'BB']: + if in_sel == CRInSel.BA_BB.value: + return in1, cr_isvec log("get_cr_in not found", name) return None, False @@ -584,6 +587,9 @@ def get_cr_out(dec2, name): if name == 'BF': if out_sel == CROutSel.BF.value: return out, o_isvec + if name == 'BT': + if out_sel == CROutSel.BT.value: + return out, o_isvec if name == 'CR0': if out_sel == CROutSel.CR0.value: return out, o_isvec @@ -1634,16 +1640,24 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): for name in op_fields: # CR immediates. deal with separately. needs modifying # pseudocode - if self.is_svp64_mode and name in ['BI']: # TODO, more CRs - # BI is a 5-bit, must reconstruct the value - regnum, is_vec = yield from get_cr_in(self.dec2, name) + crlen5 = ['BC', 'BA', 'BB', 'BT', 'BI'] # 5-bit + crlen3 = ['BF', 'BFA'] # 3-bit (BF: bit-field) + if self.is_svp64_mode and name in crlen5: + # 5-bit, must reconstruct the value + if name in ['BT']: + regnum, is_vec = yield from get_cr_out(self.dec2, name) + else: + regnum, is_vec = yield from get_cr_in(self.dec2, name) sig = getattr(fields, name) val = yield sig # low 2 LSBs (CR field selector) remain same, CR num extended assert regnum <= 7, "sigh, TODO, 128 CR fields" val = (val & 0b11) | (regnum << 2) - elif self.is_svp64_mode and name in ['BF']: # TODO, more CRs - regnum, is_vec = yield from get_cr_out(self.dec2, "BF") + elif self.is_svp64_mode and name in crlen3: + if name in ['BF']: + regnum, is_vec = yield from get_cr_out(self.dec2, name) + else: + regnum, is_vec = yield from get_cr_in(self.dec2, name) log('hack %s' % name, regnum, is_vec) val = regnum else: @@ -1652,10 +1666,11 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): # these are all opcode fields involved in index-selection of CR, # and need to do "standard" arithmetic. CR[BA+32] for example # would, if using SelectableInt, only be 5-bit. - if name in ['BF', 'BFA', 'BC', 'BA', 'BB', 'BT', 'BI']: - self.namespace[name] = val - else: - self.namespace[name] = SelectableInt(val, sig.width) + if name not in crlen3 and name not in crlen5: + val = SelectableInt(val, sig.width) + + # finally put the field into the namespace + self.namespace[name] = val self.namespace['XER'] = self.spr['XER'] self.namespace['CA'] = self.spr['XER'][XER_bits['CA']].value