Re: [myhdl-list] Module uses globals
Brought to you by:
jandecaluwe
From: Henry G. <he...@ca...> - 2015-04-16 08:11:31
|
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. That said, it is possible to run multiple simulation instances using the multiprocess module (as in the example I gave). This is arguable better anyway as it makes it absolutely clear that you're dealing with separate circuits (inter process communication being much harder than communicating between threads, there is little risk of inadvertent state transfer). Cheers, Henry |