[myhdl-list] Re: Generators semantics
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2005-03-30 21:07:29
|
Jean Demartini wrote: > Generators used in MyDHL (and Python) ressemble strongly to co-routines > used to model some real-time systems. > > Is this view true and relevant or is it false and illusory ? Without having any hands-on experience with coroutines, I believe this is true, in the sense that both concepts can emulate light-weight parallellism. As I understand it, coroutines are things that pass control to each other, at certain points. Generators pass control to whatever called them, in Python with the yield statement. The way MyHDL uses generators is special in the sense that the behavior of the "caller" (a.k.a. the Simulation object) is "hidden" from the user. The Simuulation object acts as a predefined scheduler, suited for hardware simulations (e.g. achieving determinism in cooperation with Signal objects.) For the purposes of hardware modelling therefore, I believe the functionality offered by generators is sufficient. Best regards, Jan -- Jan Decaluwe - Resources bvba - http://jandecaluwe.com Losbergenlaan 16, B-3010 Leuven, Belgium Using Python as a hardware description language: http://jandecaluwe.com/Tools/MyHDL/Overview.html |