only check regs right at the end in test_core.py overlap mode
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 30 Nov 2021 12:03:29 +0000 (12:03 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 30 Nov 2021 12:03:29 +0000 (12:03 +0000)
src/soc/simple/test/test_core.py

index 0c1be1411fa5e357d1356ba29cb9a1287be19f2a..cdc844823cbb3784003510914d64f9616412c535 100644 (file)
@@ -216,6 +216,7 @@ class TestRunner(FHDLTestCase):
                              imem_ifacetype='',
                              addr_wid=48,
                              mask_wid=8,
+                             allow_overlap=True,
                              reg_wid=64)
 
         cur_state = CoreState("cur") # current state (MSR/PC/SVSTATE)
@@ -307,12 +308,32 @@ class TestRunner(FHDLTestCase):
                         # set operand and get inputs
                         yield from wait_for_busy_clear(core)
 
+                        # synchronised (non-overlap) is fine to check
+                        if not core.allow_overlap:
+                            # register check
+                            yield from check_regs(self, sim, core, test, code)
+
+                            # Memory check
+                            yield from check_mem(self, sim, core, test, code)
+
+                    # non-overlap mode is only fine to check right at the end
+                    if core.allow_overlap:
+                        # wait until all settled
+                        # XXX really this should be in DMI, which should in turn
+                        # use issuer.any_busy to not send back "stopped" signal
+                        while (yield core.o.any_busy_o):
+                            yield
+
                         # register check
                         yield from check_regs(self, sim, core, test, code)
 
                         # Memory check
                         yield from check_mem(self, sim, core, test, code)
 
+            # give a couple extra clock cycles for gtkwave display to be happy
+            yield
+            yield
+
         sim.add_sync_process(process)
         with sim.write_vcd("core_simulator.vcd", "core_simulator.gtkw",
                            traces=[]):