Re: [myhdl-list] StopIteration caught?
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2009-03-18 08:56:36
|
Neal Becker wrote: > My stimulus will read from the input vectors using .next(). Eventually > raising StopIteration. It appears this is being caught? And, does not stop > the simulation. Is this the expected behavior? Yes. A MyHDL simulation consists of a number of "simultaneously" running generators. If StopIteration weren't caught, the simulation would stop as soon as one of them runs out of steam. Instead, a simulation has to run as long as some generator remains active. Of course, the problem then is that you can easily create simulations that run forever. Not unlike VHDL and Verilog, you have to make sure that the simulation stops when you know you're done. For this reason, StopSimulation is explicitly exported by myhdl and it is the intention that users raise it. > I guess I need to catch StopIteration myself, and raise StopSimulation if I > want to stop? Yes. Note that you would probably have to raise StopSimulation also in other cases, for example when using a for-loop instead of a generator. Otherwise the simulation runs as long as there are events e.g. from a clock generator. Alternatively you can give a time duration to Simulation.run(). Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com Analog design automation: http://www.mephisto-da.com World-class digital design: http://www.easics.com |