[Libre-soc-dev] daily kan-ban update 30oct2020

Cesar Strauss cestrauss at gmail.com
Sat Oct 31 11:46:03 GMT 2020


Em 30/10/2020 21:00, Luke Kenneth Casson Leighton escreveu:
>> Since it seems to be the first use of "yield Passive()" in libre-soc,
>> I'll make a comment on it.
>>
>> What it does, is to automatically terminate the corresponding process
>> when all the other "normal" (active by default) processes terminate.
> 
> does Passive() terminate *all* processes?

Actually, Passive() by itself doesn't terminate any process.

Let me try a better explanation.

By default, Python simulation processes are active. The simulation ends
when the last active process finishes, even if there are still some
passive processes running. Any existing passive process is killed
naturally, as the simulation shuts down.

Any process can declare itself passive by calling "yield Passive()",
hereby removing itself from the set of active processes. It will no
longer influence the shutdown of the simulation. A good place to put the
statement is at the beginning of the process.

As a result, a passive process can have an infinite outer loop, not ever
worrying about terminating. This is why they are good for
replacing/emulating RTL Modules, which are passive themselves.

Of course, it doesn't work if the process itself needs to do any cleanup
at the end of the simulation, since it is forcefully killed.

> interesting.  i use a "stop" variable in a common class (or a global)

Add a "yield Passive()" at the top of you process, and you can forget
about these "stop" variables.

Regards,

Cesar



More information about the Libre-soc-dev mailing list