allow qemu to stop at specified end point
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 8 Jul 2020 16:22:35 +0000 (17:22 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 8 Jul 2020 16:22:35 +0000 (17:22 +0100)
src/soc/fu/test/common.py
src/soc/simulator/test_helloworld_sim.py
src/soc/simulator/test_sim.py

index 39a1fd90e26cfbc1bb7679f97297ae8285ab99ce..dac8c170bea0a578825b7d71fe0f68088a17cbab 100644 (file)
@@ -11,7 +11,8 @@ from soc.regfile.regfiles import FastRegs
 class TestCase:
     def __init__(self, program, name, regs=None, sprs=None, cr=0, mem=None,
                        msr=0,
-                       do_sim=True):
+                       do_sim=True,
+                       extra_break_addr=None):
 
         self.program = program
         self.name = name
@@ -28,6 +29,7 @@ class TestCase:
         self.mem = mem
         self.msr = msr
         self.do_sim = do_sim
+        self.extra_break_addr = extra_break_addr
 
 
 class ALUHelpers:
index 97d1e9983f3faea504fcb3c5c3ef73f5ee88f08f..8801844de039f346b802ab1a0c68bcd7cff1bc55 100644 (file)
@@ -38,13 +38,14 @@ class HelloTestCases(FHDLTestCase):
                 "mtspr   9, 12",     # mtctr r12
                 "bcctrl  20,0,0", # bctrl
                 ]
-        self.run_tst_program(Program(lst), [1,12])
+        self.run_tst_program(Program(lst), [1,12], extra_break_addr=0x1014)
 
     def run_tst_program(self, prog, initial_regs=None, initial_sprs=None,
-                                    initial_mem=None):
+                                    initial_mem=None, extra_break_addr=None):
         initial_regs = [0] * 32
         tc = TestCase(prog, self.test_name, initial_regs, initial_sprs, 0,
-                                            initial_mem, 0)
+                                            initial_mem, 0,
+                                            extra_break_addr=extra_break_addr)
         self.test_data.append(tc)
 
 
index 51d4e7a182230f5ab091561d1c4c89e990f6a022..387803c3dddff0774311bb2d1491b4b5f2ac2dee 100644 (file)
@@ -276,12 +276,13 @@ class DecoderBase:
 
         return simulator
 
-    def run_tst_program(self, prog, reglist, initial_mem=None):
+    def run_tst_program(self, prog, reglist, initial_mem=None,
+                                             extra_break_addr=None):
         import sys
         simulator = self.run_tst(prog, initial_mem=initial_mem,
                                  initial_pc=0x20000000)
         prog.reset()
-        with run_program(prog, initial_mem) as q:
+        with run_program(prog, initial_mem, extra_break_addr) as q:
             self.qemu_register_compare(simulator, q, reglist)
             self.qemu_mem_compare(simulator, q, True)
         print(simulator.gpr.dump())