From 04dad392df2968aa3ac6bd2749b308bc8b176d87 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 4 Sep 2022 12:26:48 +0300 Subject: [PATCH] power_insn: support immediate operands --- src/openpower/decoder/power_insn.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) 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 -- 2.30.2