test: move to sim = Simulator(dut) instead of context manager.
[lambdasoc.git] / lambdasoc / test / test_periph_event.py
index 69aacf2923f123c5376698643c7bb0cdb0f006d5..4dfea235e44bd9ee3fccfa8b4333553fc3caae62 100644 (file)
@@ -8,9 +8,10 @@ from ..periph.event import *
 
 
 def simulation_test(dut, process):
-    with Simulator(dut, vcd_file=open("test.vcd", "w")) as sim:
-        sim.add_clock(1e-6)
-        sim.add_sync_process(process)
+    sim = Simulator(dut)
+    sim.add_clock(1e-6)
+    sim.add_sync_process(process)
+    with sim.write_vcd("test.vcd"):
         sim.run()