get trap compunit test working, adding bigendian and msr
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 16 Jul 2020 09:41:13 +0000 (10:41 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 16 Jul 2020 09:41:13 +0000 (10:41 +0100)
src/soc/decoder/isa/caller.py
src/soc/fu/compunits/test/test_compunit.py
src/soc/fu/compunits/test/test_trap_compunit.py

index f2ba7b28d9612765dd3dcdbb37ef38918edfdfe0..ad4318ecbe24b5c4f528153e419d8a225614f1c7 100644 (file)
@@ -598,10 +598,11 @@ class ISACaller:
             illegal = name != asmop
 
         if illegal:
-            print ("name %s != %s - calling ILLEGAL trap" % (name, asmop))
             self.TRAP(0x700, PI.ILLEG)
             self.namespace['NIA'] = self.trap_nia
             self.pc.update(self.namespace)
+            print ("name %s != %s - calling ILLEGAL trap, PC: %x" % \
+                    (name, asmop, self.pc.CIA.value))
             return
 
         info = self.instrs[name]
index 7a73cb83f5f61d29d612b18a0b522e68ff2738ef..1935817625ec19136f29bd5eada3c249e6aac138 100644 (file)
@@ -202,7 +202,7 @@ class TestRunner(FHDLTestCase):
                 instructions = list(zip(gen, insncode))
                 sim = ISA(simdec2, test.regs, test.sprs, test.cr, test.mem,
                           test.msr,
-                          initial_insns=gen, respect_pc=False,
+                          initial_insns=gen, respect_pc=True,
                           disassembly=insncode,
                           bigendian=self.bigendian)
 
@@ -211,7 +211,9 @@ class TestRunner(FHDLTestCase):
                     yield from setup_test_memory(l0, sim)
 
                 index = sim.pc.CIA.value//4
+                msr = sim.msr.value
                 while True:
+                    print("instr index", index)
                     try:
                         yield from sim.setup_one()
                     except KeyError: # indicates instruction not in imem: stop
@@ -222,6 +224,7 @@ class TestRunner(FHDLTestCase):
 
                     # ask the decoder to decode this binary data (endian'd)
                     yield pdecode2.dec.bigendian.eq(self.bigendian)  # le / be?
+                    yield pdecode2.msr.eq(msr)
                     yield instruction.eq(ins)          # raw binary instr.
                     yield Settle()
                     fn_unit = yield pdecode2.e.do.fn_unit
@@ -268,6 +271,7 @@ class TestRunner(FHDLTestCase):
                     yield from sim.execute_one()
                     yield Settle()
                     index = sim.pc.CIA.value//4
+                    msr = sim.msr.value
 
                     # get all outputs (one by one, just "because")
                     res = yield from get_cu_outputs(cu, code)
index 86ea94784591453603bfefe9b68f9efe820b5680..7857b828e66215f0f8688045a093943fa8fe97d8 100644 (file)
@@ -7,12 +7,12 @@ from soc.fu.trap.test.test_pipe_caller import TrapTestCase # creates the tests
 from soc.fu.test.common import ALUHelpers
 from soc.fu.compunits.compunits import TrapFunctionUnit
 from soc.fu.compunits.test.test_compunit import TestRunner
-
+from soc.config.endian import bigendian
 
 class TrapTestRunner(TestRunner):
     def __init__(self, test_data):
         super().__init__(test_data, TrapFunctionUnit, self,
-                         Function.TRAP)
+                         Function.TRAP, bigendian)
 
     def get_cu_inputs(self, dec2, sim):
         """naming (res) must conform to TrapFunctionUnit input regspec