attempting running cxxsim on ALU pipeline test
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 14 Jul 2020 10:41:41 +0000 (11:41 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 14 Jul 2020 11:01:02 +0000 (12:01 +0100)
src/soc/fu/alu/test/test_pipe_caller.py

index 9201c0085cd2eb5c86d864835139b72466078834..88b61b70abbbb302eabc26726b45d2d3a92ae6bd 100644 (file)
@@ -1,5 +1,11 @@
 from nmigen import Module, Signal
-from nmigen.back.pysim import Simulator, Delay, Settle
+from nmigen.back.pysim import Delay, Settle
+cxxsim = False
+if cxxsim:
+    from nmigen.sim.cxxsim import Simulator
+else:
+    from nmigen.back.pysim import Simulator
+
 from nmutil.formaltest import FHDLTestCase
 from nmigen.cli import rtlil
 import unittest
@@ -242,9 +248,12 @@ class TestRunner(FHDLTestCase):
                     yield from self.check_alu_outputs(alu, pdecode2, sim, code)
 
         sim.add_sync_process(process)
-        with sim.write_vcd("alu_simulator.vcd", "simulator.gtkw",
-                            traces=[]):
-            sim.run()
+        if cxxsim:
+             sim.run()
+        else:
+            with sim.write_vcd("alu_simulator.vcd", "simulator.gtkw",
+                                traces=[]):
+                sim.run()
 
     def check_alu_outputs(self, alu, dec2, sim, code):