From: Dmitry Selyutin Date: Mon, 21 Nov 2022 16:34:06 +0000 (+0300) Subject: power_insn: support sats/satu specifiers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=409dee882bfae98a35983b00a2bb53cd004eb614;p=openpower-isa.git power_insn: support sats/satu specifiers --- diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index ac07e627..21347503 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -2834,6 +2834,40 @@ class SpecifierSEA(Specifier): rm.sea = 1 +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierSat(Specifier): + desc: str + sign: bool + + @classmethod + def match(cls, desc, record, etalon, sign): + if desc != etalon: + return None + + return cls(record=record, desc=desc, sign=sign) + + def assemble(self, insn): + rm = insn.prefix.rm.select(record=self.record) + rm.mode.sel = 2 + rm.sat = 1 if self.sign else 0 + + +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierSatS(Specifier): + @classmethod + def match(cls, desc, record): + return super().match(desc=desc, record=record, + etalon="sats", sign=True) + + +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierSatU(Specifier): + @classmethod + def match(cls, desc, record): + return super().match(desc=desc, record=record, + etalon="satu", sign=False) + + class Specifiers(tuple): SPECS = ( SpecifierW, @@ -2849,6 +2883,8 @@ class Specifiers(tuple): SpecifierSZ, SpecifierDZ, SpecifierEls, + SpecifierSatS, + SpecifierSatU, ) def __new__(cls, items, record):