back.pysim: Simulator({gtkw_signals→traces}=).
authorwhitequark <whitequark@whitequark.org>
Fri, 14 Dec 2018 15:23:22 +0000 (15:23 +0000)
committerwhitequark <whitequark@whitequark.org>
Fri, 14 Dec 2018 15:23:22 +0000 (15:23 +0000)
examples/ctrl.py
nmigen/back/pysim.py
nmigen/test/test_sim.py

index b2d352d07493c404b068bc98c0334bd0c064ed11..64c3b5dbc580c2c905225b0f5078111183f4fcd2 100644 (file)
@@ -24,7 +24,7 @@ print(verilog.convert(frag, ports=[ctr.o, ctr.ce]))
 with pysim.Simulator(frag,
         vcd_file=open("ctrl.vcd", "w"),
         gtkw_file=open("ctrl.gtkw", "w"),
-        gtkw_signals=[ctr.ce, ctr.v, ctr.o]) as sim:
+        traces=[ctr.ce, ctr.v, ctr.o]) as sim:
     sim.add_clock(1e-6)
     def ce_proc():
         yield; yield; yield
index 3b72d778d7f4313c92ff3f4c190c165aee3d22e7..ba32dbf2c858f80dbf7be6f728065d49749e9dc9 100644 (file)
@@ -191,7 +191,7 @@ class _StatementCompiler(StatementTransformer):
 
 
 class Simulator:
-    def __init__(self, fragment, vcd_file=None, gtkw_file=None, gtkw_signals=()):
+    def __init__(self, fragment, vcd_file=None, gtkw_file=None, traces=()):
         self._fragment        = fragment
 
         self._domains         = {}            # str/domain -> ClockDomain
@@ -221,9 +221,8 @@ class Simulator:
         self._vcd_writer      = None
         self._vcd_signals     = ValueDict()   # signal -> set(vcd_signal)
         self._vcd_names       = ValueDict()   # signal -> str/name
-
         self._gtkw_file       = gtkw_file
-        self._gtkw_signals    = gtkw_signals
+        self._traces          = traces
 
     def _check_process(self, process):
         if inspect.isgeneratorfunction(process):
@@ -578,7 +577,7 @@ class Simulator:
                         add_trace(cd.rst)
                     add_trace(cd.clk)
 
-            for signal in self._gtkw_signals:
+            for signal in self._traces:
                 add_trace(signal)
 
         if self._vcd_file:
index c0bec556ad2e3b6c3a452fc55e586e4dc7c06660..4b29c75f9b4ce1baa3b9971eab6f51730972b5b6 100644 (file)
@@ -19,7 +19,7 @@ class SimulatorUnitTestCase(FHDLTestCase):
         with Simulator(frag,
                 vcd_file =open("test.vcd",  "w"),
                 gtkw_file=open("test.gtkw", "w"),
-                gtkw_signals=[*isigs, osig]) as sim:
+                traces=[*isigs, osig]) as sim:
             def process():
                 for isig, input in zip(isigs, inputs):
                     yield isig.eq(input)