From aceb10a5053c82c35b97b9228a6af89a4e6b8a98 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 11 May 2023 23:35:41 -0700 Subject: [PATCH] add support for *_flag global variables needed by bfp_* functions --- src/openpower/decoder/isa/caller.py | 6 +++++- src/openpower/decoder/power_enums.py | 17 +++++++++++++++++ src/openpower/decoder/pseudo/parser.py | 3 ++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index 6a4882c8..da25bd1e 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -33,7 +33,8 @@ from openpower.decoder.power_enums import (FPTRANS_INSNS, CRInSel, CROutSel, SVP64LDSTmode, SVP64PredCR, SVP64PredInt, SVP64PredMode, SVP64RMMode, SVPType, XER_bits, - insns, spr_byname, spr_dict) + insns, spr_byname, spr_dict, + BFP_FLAG_NAMES) from openpower.decoder.power_insn import SVP64Instruction from openpower.decoder.power_svp64 import SVP64RM, decode_extra from openpower.decoder.selectable_int import (FieldSelectableInt, @@ -1255,6 +1256,9 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): 'XLEN': 64 # elwidth overrides }) + for name in BFP_FLAG_NAMES: + setattr(self, name, 0) + # update pc to requested start point self.set_pc(initial_pc) diff --git a/src/openpower/decoder/power_enums.py b/src/openpower/decoder/power_enums.py index ed635424..3bd7eee1 100644 --- a/src/openpower/decoder/power_enums.py +++ b/src/openpower/decoder/power_enums.py @@ -1109,6 +1109,23 @@ XER_bits = { MSRSpec = namedtuple("MSRSpec", ["dr", "pr", "sf"]) +# flags for bfp_* functions +BFP_FLAG_NAMES = ( + 'vxsnan_flag', + 'vximz_flag', + 'vxidi_flag', + 'vxisi_flag', + 'vxzdz_flag', + 'vxsqrt_flag', + 'vxcvi_flag', + 'vxvc_flag', + 'ox_flag', + 'ux_flag', + 'xx_flag', + 'zx_flag', + 'inc_flag', +) + if __name__ == '__main__': # find out what the heck is in SPR enum :) print("sprs full", len(SPRfull)) diff --git a/src/openpower/decoder/pseudo/parser.py b/src/openpower/decoder/pseudo/parser.py index d9dd7cdd..48b5e82a 100644 --- a/src/openpower/decoder/pseudo/parser.py +++ b/src/openpower/decoder/pseudo/parser.py @@ -17,6 +17,7 @@ from openpower.decoder.power_decoder import create_pdecode from openpower.decoder.pseudo.lexer import ( IndentLexer, raise_syntax_error, SyntaxError2) from openpower.decoder.orderedset import OrderedSet +from openpower.decoder.power_enums import BFP_FLAG_NAMES # I use the Python AST #from compiler import ast @@ -671,7 +672,7 @@ class PowerParser: 'SVSHAPE0', 'SVSHAPE1', 'SVSHAPE2', 'SVSHAPE3']: self.special_regs.add(name) self.write_regs.add(name) # and add to list to write - if name in ('XLEN', 'FPSCR'): + if name in ('XLEN', 'FPSCR') or name in BFP_FLAG_NAMES: attr = ast.Name("self", ast.Load()) p[0] = ast.Attribute(attr, name, ast.Load(), lineno=p.lineno(1)) else: -- 2.30.2