Add an --inorder option to test_issuer.py
authorCesar Strauss <cestrauss@gmail.com>
Tue, 28 Dec 2021 21:06:02 +0000 (18:06 -0300)
committerCesar Strauss <cestrauss@gmail.com>
Tue, 28 Dec 2021 21:42:02 +0000 (18:42 -0300)
To use, add "--inorder" as the last option, before the test list
It's using the newly added pspec flag (see openpower-isa repo)

src/soc/simple/issuer.py
src/soc/simple/test/test_issuer.py
src/soc/simple/test/test_runner.py

index 732cfcf788726c3c3cfd82386357b22a8ed443ad..1384616089190b409a2cbe7e6bccea76bbca7963 100644 (file)
@@ -1517,9 +1517,6 @@ class TestIssuerInternal(TestIssuerBase):
 class TestIssuer(Elaboratable):
     def __init__(self, pspec):
         self.ti = TestIssuerInternal(pspec)
-        # XXX TODO: make this a command-line selectable option from pspec
-        #from soc.simple.inorder import TestIssuerInternalInOrder
-        #self.ti = TestIssuerInternalInOrder(pspec)
         self.pll = DummyPLL(instance=True)
 
         self.dbg_rst_i = Signal(reset_less=True)
index 5d22ca09d82a57c87200aca264d072c67e34bd31..b5799ecf1bc7af30f8f41b8a155f4138fa5bd1ef 100644 (file)
@@ -46,6 +46,12 @@ if __name__ == "__main__":
         allow_overlap = True
         del sys.argv[1]
 
+    # use in-order issuer, instead of the original FSM based one
+    inorder = False
+    if len(sys.argv) >= 2 and sys.argv[1] == '--inorder':
+        inorder = True
+        del sys.argv[1]
+
     # allow list of testing to be selected by command-line
     testing = []
     for i in reversed(range(1, len(sys.argv))):
@@ -58,7 +64,7 @@ if __name__ == "__main__":
                    'branch', 'div', 'mul', 'hazard']
 
     print("SVP64 test mode enabled", svp64, "overlap",
-          allow_overlap, "testing", testing)
+          allow_overlap, "in-order", inorder, "testing", testing)
 
     unittest.main(exit=False)
     suite = unittest.TestSuite()
@@ -83,7 +89,7 @@ if __name__ == "__main__":
     # walk through all tests, those requested get added
     for tname, data in tests.items():
         if tname in testing:
-            suite.addTest(TestRunner(data, svp64=svp64,
+            suite.addTest(TestRunner(data, svp64=svp64, inorder=inorder,
                                      allow_overlap=allow_overlap))
 
     runner = unittest.TextTestRunner()
index 2daa86a5c5f8663151eb52a83d635e2282d5b8eb..b4458c0ca561a45ad7bfa38764def4e7febad5e9 100644 (file)
@@ -19,6 +19,7 @@ from openpower.decoder.isa.all import ISA
 from openpower.endian import bigendian
 
 from soc.simple.issuer import TestIssuerInternal
+from soc.simple.inorder import TestIssuerInternalInOrder
 
 from soc.simple.test.test_core import (setup_regs, check_regs, check_mem,
                                        wait_for_busy_clear,
@@ -178,7 +179,10 @@ class HDLRunner(StateRunner):
         self.svstate_i = Signal(64)
 
         #hard_reset = Signal(reset_less=True)
-        self.issuer = TestIssuerInternal(pspec)
+        if pspec.inorder:
+            self.issuer = TestIssuerInternalInOrder(pspec)
+        else:
+            self.issuer = TestIssuerInternal(pspec)
         # use DMI RESET command instead, this does actually work though
         # issuer = ResetInserter({'coresync': hard_reset,
         #                        'sync': hard_reset})(issuer)
@@ -384,11 +388,11 @@ class HDLRunner(StateRunner):
 
 class TestRunner(TestRunnerBase):
     def __init__(self, tst_data, microwatt_mmu=False, rom=None,
-                 svp64=True, run_hdl=True, run_sim=True,
+                 svp64=True, inorder=False, run_hdl=True, run_sim=True,
                  allow_overlap=False):
         if run_hdl:
             run_hdl = HDLRunner
         super().__init__(tst_data, microwatt_mmu=microwatt_mmu,
-                         rom=rom,
+                         rom=rom, inorder=inorder,
                          svp64=svp64, run_hdl=run_hdl, run_sim=run_sim,
                          allow_overlap=allow_overlap)