Start a new self-contained test suite for LDSTCompUnit
authorCesar Strauss <cestrauss@gmail.com>
Sun, 6 Jun 2021 22:00:46 +0000 (19:00 -0300)
committerCesar Strauss <cestrauss@gmail.com>
Sun, 6 Jun 2021 22:17:21 +0000 (19:17 -0300)
The idea is to use parallel processes, like on the new ALU CompUnit tests.
In this case, it will include PortInterface emulation as well.
The current goal is to ensure that exception support is properly
implemented.

src/soc/experiment/test/test_compldst_multi.py [new file with mode: 0644]

diff --git a/src/soc/experiment/test/test_compldst_multi.py b/src/soc/experiment/test/test_compldst_multi.py
new file mode 100644 (file)
index 0000000..f173714
--- /dev/null
@@ -0,0 +1,33 @@
+"""Self-contained unit test for the Load/Store CompUnit
+"""
+
+import unittest
+from nmigen import Module
+from nmigen.sim import Simulator
+from soc.experiment.compldst_multi import LDSTCompUnit
+from soc.experiment.pimem import PortInterface
+from soc.fu.ldst.pipe_data import LDSTPipeSpec
+
+
+class TestLDSTCompUnit(unittest.TestCase):
+
+    def test_ldst_compunit(self):
+        m = Module()
+        pi = PortInterface(name="pi")
+        regspec = LDSTPipeSpec.regspec
+        dut = LDSTCompUnit(pi, regspec)
+        m.submodules.dut = dut
+        sim = Simulator(m)
+        sim.add_clock(1e-6)
+
+        def process():
+            yield
+
+        sim.add_sync_process(process)
+        sim_writer = sim.write_vcd("test_ldst_compunit.vcd")
+        with sim_writer:
+            sim.run()
+
+
+if __name__ == '__main__':
+    unittest.main()