X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fopenpower%2Fdecoder%2Fpower_insn.py;h=c1fb4a2fcf6047f92b555ae08bdb15424e01bbbf;hb=8bd5556e723ed2761cc3a3f75af58e0e91e5c44a;hp=67be2d2ab35ccd63512f6dbe0c0fcf3439090194;hpb=f8e485050b21b2480d2b08bb673f1174d2d56533;p=openpower-isa.git diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index 67be2d2a..c1fb4a2f 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -421,7 +421,7 @@ class BitSel: (start, end) = value if start < 0 or end < 0 or start >= end: raise ValueError(value) - + self.__start = start self.__end = end @@ -659,10 +659,10 @@ class RegisterOperand(DynamicOperand): spec = _SelectableInt(value=spec.value, bits=bits) if vector: value = ((value << vector_shift) | (spec << spec_shift)) - span = (span + spec_span + ((spec_shift * ('{0}',)))) + span = (span + spec_span + ((spec_shift * ("{0}",)))) else: value = ((spec << scalar_shift) | value) - span = ((spec_shift * ('{0}',)) + spec_span + span) + span = ((spec_shift * ("{0}",)) + spec_span + span) (value, span) = self.sv_spec_leave(value=value, span=span, origin_value=origin_value, origin_span=origin_span) @@ -747,11 +747,11 @@ class TargetAddrOperand(RegisterOperand): value = insn[span] if verbosity >= Verbosity.VERBOSE: - span = tuple(map(str, span)) + span = (tuple(map(str, span)) + ("{0}", "{0}")) yield f"{indent}{self.name} = EXTS({field} || 0b00))" yield f"{indent}{indent}{field}" yield f"{indent}{indent}{indent}{int(value):0{value.bits}b}00" - yield f"{indent}{indent}{indent}{', '.join(span + ('{0}', '{0}'))}" + yield f"{indent}{indent}{indent}{', '.join(span)}" else: yield hex(_selectconcat(value, _SelectableInt(value=0b00, bits=2)).to_signed_int()) @@ -1089,9 +1089,11 @@ class Instruction(_Mapping): operands = "" if dynamic_operands: - operands += f" {','.join(dynamic_operands)}" + operands += " " + operands += ",".join(dynamic_operands) if static_operands: - operands += f" ({' '.join(static_operands)})" + operands += " " + operands += " ".join(static_operands) return f"{prefix}{record.name}{operands}" @@ -1163,7 +1165,8 @@ class WordInstruction(Instruction): operands = tuple(map(_operator.itemgetter(1), self.dynamic_operands(db=db, verbosity=verbosity))) if operands: - yield f"{blob}{record.name} {','.join(operands)}" + operands = ",".join(operands) + yield f"{blob}{record.name} {operands}" else: yield f"{blob}{record.name}" @@ -1292,27 +1295,19 @@ class BaseRM(_Mapping): def disassemble(self, verbosity=Verbosity.NORMAL): if verbosity >= Verbosity.VERBOSE: indent = (" " * 4) - for (name, value, members) in self.traverse(path="RM"): + for (name, span) in self.traverse(path="RM"): + value = self.storage[span] yield f"{name}" yield f"{indent}{int(value):0{value.bits}b}" - yield f"{indent}{', '.join(map(str, members))}" + yield f"{indent}{', '.join(map(str, span))}" class FFPRRc1BaseRM(BaseRM): def specifiers(self, record, mode): inv = _SelectableInt(value=int(self.inv), bits=1) CR = _SelectableInt(value=int(self.CR), bits=2) - mask = int(_selectconcat(inv, CR)) - predicate = { # exactly same table as in NormalLDSTBaseRM - 0b000: "lt", - 0b001: "ge", - 0b010: "gt", - 0b011: "le", - 0b100: "eq", - 0b101: "ne", - 0b110: "so", - 0b111: "ns", - }[mask] + mask = int(_selectconcat(CR, inv)) + predicate = PredicateBaseRM.predicate(True, mask) yield f"{mode}={predicate}" yield from super().specifiers(record=record) @@ -1371,65 +1366,97 @@ class MRBaseRM(BaseRM): yield from super().specifiers(record=record) -class NormalLDSTBaseRM(BaseRM): +class ElsBaseRM(BaseRM): def specifiers(self, record): - # these go in inverse order. calculable as: "8<<(3-width)" - # TODO later: fp operations would be ew=fp16 ew=bf16 ew=fp32 - widths = { + if self.els: + yield "els" + + yield from super().specifiers(record=record) + + +class WidthBaseRM(BaseRM): + @staticmethod + def width(FP, width): + width = { 0b11: "8", 0b10: "16", 0b01: "32", - } - predicates = { - # integer - (0, 0b001): "1< 0: # if any separate with a space - operands = " " + operands + operands = (" " + operands) yield f"{blob_prefix}{name}{specifiers}{operands}" if blob_suffix: