Re: [myhdl-list] Module uses globals
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2015-04-19 15:36:37
|
On 4/16/15 3:11 AM, Henry Gomersall wrote: > On 15/04/15 21:29, Christopher Felton wrote: >> <snip> >>>>>>>> >>>>>>>> This totally defeats the beauty of object orientation in Python. For >>>>>>>> example you cannot have two instances of a Simulation() at the same time. >>>>>> >>>>>> What is the rationale for more than one simulation >>>>>> running at a time? Why have two simulators running? >>>>>> >>>> >>>> What is great about having a HDL simulation within a full blown language >>>> like Python is the possibility of doing unconventional things. Some that I >>>> can think of are, first, running a same model in delayed and asynchronous >>>> versions, with a controlled, time varying delay and comparing states. >> Sure, folks have experiment with aysnc simulations before >> but did not require two simulation instances. >> > > One thing that is quite hard to do is making blocking calls without > pausing the simulator. It is always possible to run the blocking code in > its own thread with polling on every tick, but there is plausibly a neat > model with separate simulations representing entities that are not > synchronous to one another. In my opinion, you would not want to make "blocking" calls because you are mixing the thread scheduling and the simulator scheduling - bad idea. Now, you might want to leverage some of the Python communication objects like Queue but I would not use them blocking (because of the mixed scheduling). Taking the Queue as an example, I have wrapped it to works with the Simulator: https://github.com/cfelton/test_jpeg/blob/master/test/support/_SignalQueue.py This way I can uses a Queue (non-blocking) with the simulator scheduler. Regards, Chris |