From bec2a9a1097f83c3414053307c8c72cf0c372bb3 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 30 Nov 2021 11:13:24 +0000 Subject: [PATCH] getting formerly unused test_core.py operational --- src/soc/simple/test/test_core.py | 82 +++++++++++++++++++++----------- src/soc/simple/test/teststate.py | 1 + 2 files changed, 56 insertions(+), 27 deletions(-) diff --git a/src/soc/simple/test/test_core.py b/src/soc/simple/test/test_core.py index dfafb2cb..14354873 100644 --- a/src/soc/simple/test/test_core.py +++ b/src/soc/simple/test/test_core.py @@ -19,6 +19,8 @@ from openpower.decoder.power_decoder import create_pdecode from openpower.decoder.power_decoder2 import PowerDecode2 from openpower.decoder.selectable_int import SelectableInt from openpower.decoder.isa.all import ISA +from openpower.decoder.decode2execute1 import IssuerDecode2ToOperand +from openpower.state import CoreState # note that using SPRreduced has to be done to match the # PowerDecoder2 SPR map @@ -26,6 +28,7 @@ from openpower.decoder.power_enums import SPRreduced as SPR from openpower.decoder.power_enums import spr_dict, Function, XER_bits from soc.config.test.test_loadstore import TestMemPspec from openpower.endian import bigendian +from soc.regfile.regfiles import StateRegs from soc.simple.core import NonProductionCore from soc.experiment.compalu_multi import find_ok # hack @@ -40,6 +43,7 @@ from soc.fu.shift_rot.test.test_pipe_caller import ShiftRotTestCase from soc.fu.cr.test.test_pipe_caller import CRTestCase from soc.fu.branch.test.test_pipe_caller import BranchTestCase from soc.fu.ldst.test.test_pipe_caller import LDSTTestCase +from openpower.test.general.overlap_hazards import HazardTestCase from openpower.util import spr_to_fast_reg from openpower.consts import StateRegsEnum @@ -189,8 +193,8 @@ def set_issue(core, dec2, sim): def wait_for_busy_clear(cu): while True: - busy_o = yield cu.busy_o - terminate_o = yield cu.core_terminate_o + busy_o = yield cu.o.busy_o + terminate_o = yield cu.o.core_terminate_o if not busy_o: print("busy/terminate:", busy_o, terminate_o) break @@ -207,7 +211,6 @@ class TestRunner(FHDLTestCase): m = Module() comb = m.d.comb instruction = Signal(32) - ivalid_i = Signal() pspec = TestMemPspec(ldst_ifacetype='testpi', imem_ifacetype='', @@ -215,24 +218,40 @@ class TestRunner(FHDLTestCase): mask_wid=8, reg_wid=64) + cur_state = CoreState("cur") # current state (MSR/PC/SVSTATE) + pdecode2 = PowerDecode2(None, state=cur_state, + opkls=IssuerDecode2ToOperand, + svp64_en=True, # self.svp64_en, + regreduce_en=False, #self.regreduce_en + ) + m.submodules.core = core = NonProductionCore(pspec) - pdecode2 = core.pdecode2 + m.submodules.pdecode2 = pdecode2 + core.pdecode2 = pdecode2 l0 = core.l0 - comb += core.raw_opcode_i.eq(instruction) - comb += core.ivalid_i.eq(ivalid_i) + comb += pdecode2.dec.raw_opcode_in.eq(instruction) + comb += pdecode2.dec.bigendian.eq(bigendian) # little / big? + comb += core.i.e.eq(pdecode2.e) + comb += core.i.state.eq(cur_state) + comb += core.i.raw_insn_i.eq(instruction) + comb += core.i.bigendian_i.eq(bigendian) + + # set the PC StateRegs read port to always send back the PC + stateregs = core.regs.state + pc_regnum = StateRegs.PC + comb += stateregs.r_ports['cia'].ren.eq(1<