From 915797c8b044055d9b8be972cf7bfb5f118149f2 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Mon, 21 Nov 2022 20:58:15 +0300 Subject: [PATCH] power_insn: support ctr/cti specifiers --- src/openpower/decoder/power_insn.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index a3d4cd47..d0799952 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -3037,6 +3037,35 @@ class SpecifierVSbi(SpecifierVS): rm.VSb = 1 +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierCTR(SpecifierVS): + @classmethod + def match(cls, desc, record): + if desc != "ctr": + return None + + return cls(record=record) + + def assemble(self, insn): + rm = insn.prefix.rm.select(record=self.record) + rm.CTR = 1 + + +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierCTi(SpecifierVS): + @classmethod + def match(cls, desc, record): + if desc != "cti": + return None + + return cls(record=record) + + def assemble(self, insn): + rm = insn.prefix.rm.select(record=self.record) + rm.CTR = 1 + rm.CTi = 1 + + class Specifiers(tuple): SPECS = ( SpecifierW, @@ -3066,6 +3095,8 @@ class Specifiers(tuple): SpecifierVSi, SpecifierVSb, SpecifierVSbi, + SpecifierCTR, + SpecifierCTi, ) def __new__(cls, items, record): -- 2.30.2