cli: update use of deprecated code.
authorwhitequark <whitequark@whitequark.org>
Wed, 12 Feb 2020 14:42:24 +0000 (14:42 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 12 Feb 2020 14:42:24 +0000 (14:42 +0000)
nmigen/cli.py

index 3914182ea5766b797489262af4ab45c9d81f39f3..e6757a07fd5d708f6a803bcc5a4c035ab9cab13b 100644 (file)
@@ -63,11 +63,9 @@ def main_runner(parser, args, design, platform=None, name="top", ports=()):
 
     if args.action == "simulate":
         fragment = Fragment.get(design, platform)
-        with pysim.Simulator(fragment,
-                vcd_file=args.vcd_file,
-                gtkw_file=args.gtkw_file,
-                traces=ports) as sim:
-            sim.add_clock(args.sync_period)
+        sim = pysim.Simulator(fragment)
+        sim.add_clock(args.sync_period)
+        with sim.write_vcd(vcd_file=args.vcd_file, gtkw_file=args.gtkw_file, traces=ports):
             sim.run_until(args.sync_period * args.sync_clocks, run_passive=True)