import os
from os.path import dirname, join
from collections import namedtuple
+import functools
def find_wiki_dir():
VL = 1 << 13 # setvl
FPU = 1 << 14 # FPU
+ @functools.lru_cache(maxsize=None)
+ def __repr__(self):
+ counter = 0
+ value = int(self.value)
+ if value != 0:
+ while value != 0:
+ counter += 1
+ value >>= 1
+ counter -= 1
+ desc = f"(1 << {counter})"
+ else:
+ desc = "0"
+ return f"<{self.__class__.__name__}.{self.name}: {desc}>"
+
@unique
class Form(Enum):
P1 = 1
P2 = 2
+ @classmethod
+ def _missing_(cls, value):
+ return {"1P": SVPtype.P1, "2P": SVPtype.P2}[value]
+
@unique
class SVEtype(Enum):
UNITSTRIDE = 3
+class RegType(Enum):
+ GPR = 0
+ RA = GPR
+ RB = GPR
+ RC = GPR
+ RS = GPR
+ RT = GPR
+
+ FPR = 1
+ FRA = FPR
+ FRB = FPR
+ FRC = FPR
+ FRS = FPR
+ FRT = FPR
+
+ CR_REG = 2
+ BF = CR_REG
+ BFA = CR_REG
+
+ CR_BIT = 3
+ BA = CR_BIT
+ BB = CR_BIT
+ BC = CR_BIT
+ BI = CR_BIT
+ BT = CR_BIT
+ BFT = CR_BIT
+
+
# supported instructions: make sure to keep up-to-date with CSV files
# just like everything else
_insns = [