From: Dmitry Selyutin Date: Sun, 4 Sep 2022 09:26:48 +0000 (+0300) Subject: power_insn: support immediate operands X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=04dad392df2968aa3ac6bd2749b308bc8b176d87;p=openpower-isa.git power_insn: support immediate operands --- diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index 990aff18..a3226a81 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -552,20 +552,27 @@ class Operands: if "=" in operand: (name, value) = operand.split("=") operand = static_cls(name=name, value=int(value)) + operands.append(operand) else: - if insn in branches and operand in branches[insn]: - dynamic_cls = branches[insn][operand] + if operand.endswith(")"): + operand = operand.replace("(", " ").replace(")", "") + all_operands = operand.split(" ") + else: + all_operands = [operand] - if operand in _RegType.__members__: - regtype = _RegType[operand] - if regtype is _RegType.GPR: - dynamic_cls = DynamicOperandGPR - elif regtype is _RegType.FPR: - dynamic_cls = DynamicOperandFPR + for operand in all_operands: + if insn in branches and operand in branches[insn]: + dynamic_cls = branches[insn][operand] - operand = dynamic_cls(name=operand) + if operand in _RegType.__members__: + regtype = _RegType[operand] + if regtype is _RegType.GPR: + dynamic_cls = DynamicOperandGPR + elif regtype is _RegType.FPR: + dynamic_cls = DynamicOperandFPR - operands.append(operand) + operand = dynamic_cls(name=operand) + operands.append(operand) self.__operands = operands