amaranth-lang / amaranth

A modern hardware definition language and toolchain based on Python
https://amaranth-lang.org/docs/amaranth/
BSD 2-Clause "Simplified" License
1.56k stars 174 forks source link

Simulation : abort simulation when step() does not converge #703

Open sporniket opened 2 years ago

sporniket commented 2 years ago

Context

Done with writing my code and running a simulation, the simulator is stuck in an infinite loop. After the last yield of the added sync process, PySimEngine.step() is stuck in while not converged.

Summary

whitequark commented 2 years ago

In general, if the simulator doesn't converge, it means an issue with the input netlist. I'd say that the appropriate way to handle this is to reject such netlists before they can be simulated, since by the time the simulator is stuck, the original issue (a logic loop of some kind) becomes very hard to find.

sporniket commented 2 years ago

I understand. Then, as a failsafe, I would not mind to still have a capped number of iterations for the cases that the issue in the netlist is not recognized.

whitequark commented 1 year ago

I think this doesn't need an RFC, it's a simple internal change to the engine. We don't even have to make the configuration mechanism public.

sporniket commented 1 year ago

Ok, I will try to propose something by next week.

edit : life got in the way, will do asap.