From: Dmitry Selyutin Date: Sun, 20 Nov 2022 14:49:44 +0000 (+0300) Subject: power_insn: support sea specifier assembly X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ce7c277df6e75566d64dc592316698a9104b6284;p=openpower-isa.git power_insn: support sea specifier assembly --- diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index 58190b46..a382e146 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -2833,6 +2833,33 @@ class SpecifierEls(Specifier): rm.mode.sel = 1 +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierSEA(Specifier): + @classmethod + def match(cls, desc, record): + if desc != "els": + return None + + return cls(record=record) + + def validate(self, others): + if self.record.svp64.mode is not _SVMode.LDST_IDX: + raise ValueError("sea is only valid in ld/st modes") + + items = list(others) + while items: + spec = items.pop() + if isinstance(spec, SpecifierFF): + raise ValueError(f"sea cannot be used in ff mode") + spec.validate(others=items) + + def assemble(self, insn): + rm = insn.prefix.rm.select(record=self.record) + if rm.mode.sel not in (0b00, 0b01): + raise ValueError("sea is only valid for normal and els modes") + rm.sea = 1 + + class Specifiers(tuple): SPECS = ( SpecifierW,