@@ -15,7 +15,7 @@ def simulation_test(dut, process):
1515 sim = Simulator (dut )
1616 with sim .write_vcd ("test.vcd" ):
1717 sim .add_clock (1e-6 )
18- sim .add_sync_process (process )
18+ sim .add_testbench (process )
1919 sim .run ()
2020
2121
@@ -111,7 +111,7 @@ def test_wrong_parity(self):
111111class AsyncSerialRXTestCase (TestCase ):
112112 def tx_period (self ):
113113 for _ in range ((yield self .dut .divisor )):
114- yield
114+ yield Tick ()
115115
116116 def tx_bits (self , bits , pins = None ):
117117 if pins is not None :
@@ -128,7 +128,7 @@ def process():
128128 yield self .dut .ack .eq (1 )
129129 yield from self .tx_bits (bits , pins )
130130 while not (yield self .dut .rdy ):
131- yield
131+ yield Tick ()
132132 if data is not None :
133133 self .assertFalse ((yield self .dut .err .overflow ))
134134 self .assertFalse ((yield self .dut .err .frame ))
@@ -202,7 +202,7 @@ def process():
202202 self .assertFalse ((yield self .dut .rdy ))
203203 yield from self .tx_bits ([0 , 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , 1 ])
204204 yield from self .tx_period ()
205- yield
205+ yield Tick ()
206206 self .assertFalse ((yield self .dut .rdy ))
207207 self .assertTrue ((yield self .dut .err .overflow ))
208208 simulation_test (self .dut , process )
@@ -224,12 +224,11 @@ def process():
224224 self .assertTrue ((yield self .fifo .r_rdy ))
225225 self .assertEqual ((yield self .fifo .r_data ), 0x55 )
226226 yield self .fifo .r_en .eq (1 )
227- yield
228- yield
227+ yield Tick ()
229228 while not (yield self .fifo .r_rdy ):
230- yield
229+ yield Tick ()
231230 self .assertEqual ((yield self .fifo .r_data ), 0xAA )
232- yield
231+ yield Tick ()
233232 self .assertFalse ((yield self .fifo .r_rdy ))
234233 simulation_test (m , process )
235234
@@ -315,7 +314,7 @@ def test_wrong_parity(self):
315314class AsyncSerialTXTestCase (TestCase ):
316315 def tx_period (self ):
317316 for _ in range ((yield self .dut .divisor )):
318- yield
317+ yield Tick ()
319318
320319 def tx_test (self , data , * , bits , pins = None ):
321320 if pins is not None :
@@ -327,7 +326,7 @@ def process():
327326 yield self .dut .data .eq (data )
328327 yield self .dut .ack .eq (1 )
329328 while (yield self .dut .rdy ):
330- yield
329+ yield Tick ()
331330 for bit in bits :
332331 yield from self .tx_period ()
333332 self .assertEqual ((yield tx_o ), bit )
@@ -396,16 +395,15 @@ def process():
396395 self .assertTrue ((yield self .fifo .w_rdy ))
397396 yield self .fifo .w_en .eq (1 )
398397 yield self .fifo .w_data .eq (0x55 )
399- yield
398+ yield Tick ()
400399 self .assertTrue ((yield self .fifo .w_rdy ))
401400 yield self .fifo .w_data .eq (0xAA )
402- yield
401+ yield Tick ()
403402 yield self .fifo .w_en .eq (0 )
404- yield
405403 for bit in [0 , 1 ,0 ,1 ,0 ,1 ,0 ,1 ,0 , 1 ]:
406404 yield from self .tx_period ()
407405 self .assertEqual ((yield self .dut .o ), bit )
408- yield
406+ yield Tick ()
409407 for bit in [0 , 0 ,1 ,0 ,1 ,0 ,1 ,0 ,1 , 1 ]:
410408 yield from self .tx_period ()
411409 self .assertEqual ((yield self .dut .o ), bit )
@@ -525,12 +523,12 @@ def process():
525523 self .assertTrue ((yield self .dut .tx .rdy ))
526524 yield self .dut .tx .data .eq (0xAA )
527525 yield self .dut .tx .ack .eq (1 )
528- yield
526+ yield Tick ()
529527 yield self .dut .tx .ack .eq (0 )
530528 yield self .dut .rx .ack .eq (1 )
531- yield
529+ yield Tick ()
532530 while not (yield self .dut .rx .rdy ):
533- yield
531+ yield Tick ()
534532 self .assertEqual ((yield self .dut .rx .data ), 0xAA )
535533 simulation_test (m , process )
536534
@@ -544,11 +542,11 @@ def process():
544542 self .assertTrue ((yield self .dut .tx .rdy ))
545543 yield self .dut .tx .data .eq (0xAA )
546544 yield self .dut .tx .ack .eq (1 )
547- yield
545+ yield Tick ()
548546 yield self .dut .tx .ack .eq (0 )
549547 yield self .dut .rx .ack .eq (1 )
550- yield
548+ yield Tick ()
551549 while not (yield self .dut .rx .rdy ):
552- yield
550+ yield Tick ()
553551 self .assertEqual ((yield self .dut .rx .data ), 0xAA )
554552 simulation_test (m , process )
0 commit comments