Re: [myhdl-list] Global state and multiple instances
Brought to you by:
jandecaluwe
From: Henry G. <he...@ca...> - 2015-05-07 16:54:54
|
On 07/05/15 17:44, Juan Pablo Caram wrote: > So nothing changed on the user side. That's great. > It will take me a while to go through the code and fully understand > how you accomplished it before I can provide any useful feedback. Yes, nothing much is changed in terms of the user API. The only real change is if you want to access the simulation parameters from outside the simulation (say after the sim has run, getting the value from now() ). Then it is necessary to renter the context. The simulation instance is used as the context id, so it's something like: sim.run(200) with _simulate.simulation_context(sim): print now() will print out the time corresponding to the simulation instance `sim`. In a running sim, this is not necessary as the context is set up by the simulator (so you can merrily place now() inside instances without worrying, as in the example). Cheers, Henry |