test/SyncFIFOCase: better test bench termination
authorRobert Jordens <jordens@gmail.com>
Sun, 6 Apr 2014 22:04:36 +0000 (00:04 +0200)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Sun, 6 Apr 2014 22:05:08 +0000 (00:05 +0200)
migen/test/test_fifo.py

index 6aac2483b1ef75dd45dd739cc0009d90fef5d5a0..ac5ec46476236c33b4a161f1b16e6715063de706 100644 (file)
@@ -29,7 +29,11 @@ class SyncFIFOCase(SimCase, unittest.TestCase):
                        tbp.dut.re = tbp.simulator.cycle_counter % 3 == 0
                        # the output if valid must be correct
                        if tbp.dut.readable and tbp.dut.re:
-                               i = seq.pop(0)
+                               try:
+                                       i = seq.pop(0)
+                               except IndexError:
+                                       print(tbp.dut.level)
+                                       raise StopSimulation
                                self.assertEqual(tbp.dut.dout.a, i)
                                self.assertEqual(tbp.dut.dout.b, i*2)
-               self.run_with(cb, 20)
+               self.run_with(cb)