[myhdl-list] Reusability and encapsulation
Brought to you by:
jandecaluwe
From: Juan P. C. <jp...@gm...> - 2015-05-02 19:40:47
|
Hi, I use iPython a lot and need to launch multiple simulations of different models (and signals) within the same interpreter. And MyHDL does not play nicely with this. I've found a way to clean the environment in order to be able to run a new simulation: I import from myhdl import _simulator from myhdl import _traceSignals in the beginning, and before every simulation (and signal tracing) I do: _simulator._signals = [] _simulator._siglist = [] _simulator._futureEvents = [] _simulator._time = 0 _simulator._cosim = 0 _simulator._tracing = 0 _simulator._tf = None _traceSignals._tracing = 0 which is what is done upon importing the mentioned files. I would love if some re-structuring was done to the code providing better encapsulation of variables. It would alleviate a lot of problems that arise when trying to build upon the base myhdl library. As it stands, it's fine for end-user digital designers, but makes it hard to create software that use myhdl as a feature. Specifically, moving the above-mentioned variables to Simulation instances would be great, and in general, to not have any shared states. I would happily contribute towards these changes. I'd rather contribute to the project than be implementing my own ad-hoc fixes. Thanks, JP |