regs = ['RA', 'RS', 'RB', 'RC', 'RT']
fregs = ['FRA', 'FRS', 'FRB', 'FRC', 'FRT', 'FRS']
+HELPERS = {
+ "EXTS",
+ "EXTS128",
+ "EXTS64",
+ "EXTZ64",
+ "FPADD32",
+ "FPADD64",
+ "FPCOS32",
+ "FPDIV32",
+ "FPDIV64",
+ "FPMUL32",
+ "FPMUL64",
+ "FPMULADD32",
+ "FPSIN32",
+ "FPSUB32",
+ "FPSUB64",
+ "MASK",
+ "MASK32",
+ "MULS",
+ "ROTL32",
+ "ROTL64",
+ "SHL64",
+ "SINGLE",
+ "SVSTATE_NEXT",
+ "TRAP",
+}
def Assign(autoassign, assignname, left, right, iea_mode):
names = []
name = arg.id
if name in regs + fregs:
read_regs.add(name)
- # special-case, function named "SVSTATE_NEXT" must be made "self.xxxx"
- if atom.id == 'SVSTATE_NEXT':
+ # special-case, these functions must be made "self.xxxx"
+ if atom.id in HELPERS:
name = ast.Name("self", ast.Load())
atom = ast.Attribute(name, atom, ast.Load())
return ast.Call(atom, trailer[1], [])
| expr_stmt"""
if isinstance(p[1], ast.Call):
p[0] = ast.Expr(p[1])
- elif isinstance(p[1], ast.Name) and p[1].id in ['TRAP', 'SVSTATE_NEXT']:
+ elif isinstance(p[1], ast.Name) and p[1].id in HELPERS:
fname = p[1].id
- # TRAP and SVSTATE_NEXT needs to actually be a function
name = ast.Name("self", ast.Load())
name = ast.Attribute(name, fname, ast.Load())
p[0] = ast.Call(name, [], [])
EXTS128, undefined,
bitrev, SHL64,
RANGE,
+ ISACallerHelper,
)
from openpower.decoder.selectable_int import SelectableInt
from openpower.decoder.selectable_int import selectconcat as concat
with open(fname, "w") as f:
f.write('# auto-generated by pywriter.py: do not edit or commit\n')
f.write('from openpower.decoder.isa.caller import ISACaller\n')
+ f.write('from openpower.decoder.helpers import ISACallerHelper\n')
for page in self.pages_written:
f.write('from openpower.decoder.isa.%s ' \
'import %s\n' % (page, page))
f.write('\n')
- classes = ', '.join(['ISACaller'] + self.pages_written)
+ classes = ', '.join(['ISACaller', 'ISACallerHelper'] + self.pages_written)
f.write('class ISA(%s):\n' % classes)
f.write(' def __init__(self, *args, **kwargs):\n')
f.write(' super().__init__(*args, **kwargs)\n')