@@ -238,8 +238,9 @@ def sim_test():
238
238
self .assertEqual ((yield dut .bus .stall ), 1 )
239
239
self .assertEqual ((yield dut .bus .dat_r ), 0x5678abcd )
240
240
241
- with Simulator (dut , vcd_file = open ("test.vcd" , "w" )) as sim :
242
- sim .add_process (sim_test ())
241
+ sim = Simulator (dut )
242
+ sim .add_process (sim_test )
243
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
243
244
sim .run ()
244
245
245
246
def test_addr_translate (self ):
@@ -348,8 +349,9 @@ def sim_test():
348
349
349
350
m = Module ()
350
351
m .submodules += dut , loop_1 , loop_2 , loop_3 , loop_4
351
- with Simulator (m , vcd_file = open ("test.vcd" , "w" )) as sim :
352
- sim .add_process (sim_test ())
352
+ sim = Simulator (m )
353
+ sim .add_process (sim_test )
354
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
353
355
sim .run ()
354
356
355
357
def test_coarse_granularity (self ):
@@ -369,8 +371,9 @@ def sim_test():
369
371
yield Delay (1e-6 )
370
372
self .assertEqual ((yield sub .cyc ), 0 )
371
373
372
- with Simulator (dut , vcd_file = open ("test.vcd" , "w" )) as sim :
373
- sim .add_process (sim_test ())
374
+ sim = Simulator (dut )
375
+ sim .add_process (sim_test )
376
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
374
377
sim .run ()
375
378
376
379
@@ -475,9 +478,10 @@ def sim_test():
475
478
self .assertEqual ((yield intr_2 .rty ), 1 )
476
479
self .assertEqual ((yield intr_2 .stall ), 0 )
477
480
478
- with Simulator (dut , vcd_file = open ("test.vcd" , "w" )) as sim :
479
- sim .add_clock (1e-6 )
480
- sim .add_sync_process (sim_test ())
481
+ sim = Simulator (dut )
482
+ sim .add_clock (1e-6 )
483
+ sim .add_sync_process (sim_test )
484
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
481
485
sim .run ()
482
486
483
487
def test_lock (self ):
@@ -526,9 +530,10 @@ def sim_test():
526
530
self .assertEqual ((yield intr_1 .ack ), 0 )
527
531
self .assertEqual ((yield intr_2 .ack ), 1 )
528
532
529
- with Simulator (dut , vcd_file = open ("test.vcd" , "w" )) as sim :
530
- sim .add_clock (1e-6 )
531
- sim .add_sync_process (sim_test ())
533
+ sim = Simulator (dut )
534
+ sim .add_clock (1e-6 )
535
+ sim .add_sync_process (sim_test )
536
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
532
537
sim .run ()
533
538
534
539
def test_stall (self ):
@@ -551,8 +556,9 @@ def sim_test():
551
556
self .assertEqual ((yield intr_1 .stall ), 1 )
552
557
self .assertEqual ((yield intr_2 .stall ), 1 )
553
558
554
- with Simulator (dut , vcd_file = open ("test.vcd" , "w" )) as sim :
555
- sim .add_process (sim_test ())
559
+ sim = Simulator (dut )
560
+ sim .add_process (sim_test )
561
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
556
562
sim .run ()
557
563
558
564
def test_stall_compat (self ):
@@ -574,8 +580,9 @@ def sim_test():
574
580
self .assertEqual ((yield intr_1 .stall ), 0 )
575
581
self .assertEqual ((yield intr_2 .stall ), 1 )
576
582
577
- with Simulator (dut , vcd_file = open ("test.vcd" , "w" )) as sim :
578
- sim .add_process (sim_test ())
583
+ sim = Simulator (dut )
584
+ sim .add_process (sim_test )
585
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
579
586
sim .run ()
580
587
581
588
def test_roundrobin (self ):
@@ -633,7 +640,8 @@ def sim_test():
633
640
self .assertEqual ((yield intr_2 .ack ), 0 )
634
641
self .assertEqual ((yield intr_3 .ack ), 1 )
635
642
636
- with Simulator (dut , vcd_file = open ("test.vcd" , "w" )) as sim :
637
- sim .add_clock (1e-6 )
638
- sim .add_sync_process (sim_test ())
643
+ sim = Simulator (dut )
644
+ sim .add_clock (1e-6 )
645
+ sim .add_sync_process (sim_test )
646
+ with sim .write_vcd (vcd_file = open ("test.vcd" , "w" )):
639
647
sim .run ()
0 commit comments