From b707625f23cebfeb279c56c5153760ddba22e318 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 13 Jun 2023 22:51:14 -0700 Subject: [PATCH] cache SVP64Instruction.Prefix instance since it's slow to construct --- src/openpower/decoder/isa/caller.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index 56560433..b5688c92 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -1679,6 +1679,14 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): pc, insn = self.get_next_insn() yield from self.setup_next_insn(pc, insn) + # cache since it's really slow to construct + __PREFIX_CACHE = SVP64Instruction.Prefix(SelectableInt(value=0, bits=32)) + + def __decode_prefix(self, opcode): + pfx = self.__PREFIX_CACHE + pfx.storage.eq(opcode) + return pfx + def setup_next_insn(self, pc, ins): """set up next instruction """ @@ -1698,7 +1706,7 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): yield Settle() opcode = yield self.dec2.dec.opcode_in opcode = SelectableInt(value=opcode, bits=32) - pfx = SVP64Instruction.Prefix(opcode) + pfx = self.__decode_prefix(opcode) log("prefix test: opcode:", pfx.PO, bin(pfx.PO), pfx.id) self.is_svp64_mode = bool((pfx.PO == 0b000001) and (pfx.id == 0b11)) self.pc.update_nia(self.is_svp64_mode) -- 2.30.2