test: move to sim = Simulator(dut) instead of context manager.
[lambdasoc.git] / lambdasoc / test / test_periph_sram.py
index 7e4b95e5e2d607da809f169eacf285d7e6c91ae3..266de6d6b7624e2a649d56b569989dd3959a08fe 100644 (file)
@@ -13,9 +13,10 @@ from ..periph.sram import SRAMPeripheral
 
 
 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()