John, Philip,
I agree with immediate notification of reset_event.
Comments below on rest of discussion.
________________________________
From: john.aynsley@doulos.com [mailto:john.aynsley@doulos.com]
Sent: Monday, November 15, 2010 3:57 PM
To: Philipp A. Hartmann; Bishnupriya Bhattacharya; systemc-p1666-technical@eda.org
Subject: Re: reset_event
Philipp, All,
You raise some interesting questions.
Re. when reset_event() is notified, I cannot see that it makes any difference "when" it is notified relative to the reset action (assuming notify() is called from reset(), of course, which it has to be) because the effect of an immediate event notification is merely to make some processes runnable. Any such processes will not actually be executed until the current process yields (the one calling reset()).
>>> [bpriya: or the resetee itself has gotten the chance to execute from beginning and yield, in case of synchronous reset, where the kernel will immediately notify the resume_event]
When sc_pause() is called (or sc_stop() is called, for that matter) all kinds of activity can indeed be scheduled before the calling process yields. This activity includes event notifications (immediate, delta, and timed) and process control calls (including immediate ones). Any activity scheduled for the current evaluation phase will be executed before simulation is paused or stopped, so there could be a long chain of immediate notifications. sc_get_status() == SC_RUNNING during such execution. On return from sc_start(), the set of runnable processes will be empty, although there may exists update requests and delta notifications.
>>> [bpriya: this is option 1 - essentially sc_start() is returning in the middle of a delta cycle, after eval but before update(). Another option (option 2) would be to finish the delta cycle, including update phase and probably delta notification phase too before returning from sc_start(). In this case, one delta cycle has finished, and the other hasn't started yet, and there maybe processes in runnable q for next eval phase when sc_start returns.]
When sc_start() is called again, the set of runnable processes will still be empty, so the schedule will jump to processing request_updates and delta notifications. We must specify that the delta_cycle count shall only get incremented once between evaluation phases across the pause.
>>> [bpriya: things are a little more iffy here. When sc_start() is called again, the set of runnable processes is not necessarily empty because sc_main() can immediately notify an event, and make sensitive processes runnable, right? This is already true today. This sitn. is awkard for option 1, because we broke in the middle of delta after eval with an empty runnable q, and now the q is no longer empty - where do the new processes execute? As a continuation of last eval, or as part of next eval? For option 2), it is cleaner. A delta had finished, possibly with existing processes in runnable q for next eval - The new processes in runnable q from sc_main also become part of next eval.]
After return from sc_start() the main scheduler loop is not running, although request_update() may be called to schedule update requests.
We do need to consider which process control methods may be called when simulation is paused:
suspend - yes?
resume - yes?
disable - yes?
enable - yes?
sync_reset_on/off - yes?
>>> [bpriya: yes on all of the above]
kill - no? (permitted during elaboration, but during elaboration there is no call stack to unwind)
reset - no? (permitted during elaboration, but during elaboration there is no call stack to unwind)
throw_it - no! (may only be called from a process)
In other words, I am proposing that the immediate semantics of the process control methods can only be executed during simulation.
>>> [bpriya: Agreed. It will be strange to have stack unwinding code execute in between sc_start() calls when a delta cycle is not active, and even stranger to execute process code itself (in case of reset). Note that it is ok to write to signals that trigger async_reset_signal_is() since the effect will not kick in immediately.]
After calling sc_pause() or sc_stop(), simulation is still running until return from sc_start(). Right now there is no way to ask the kernel whether sc_pause() or sc_stop() have been called. It is legal (a warning) to call sc_stop() more than once. So, what should happen if sc_stop() is called after sc_pause() or sc_pause() after sc_stop() before the calling process has yielded?
Should sc_stop() take precedence over sc_pause()?
>>> [bpriya: yes]
Do we want to add:
bool sc_stop_called() const;
bool sc_pause_called() const;
>>> [bpriya: no, not really necessary]
Thanks,
-Bishnupriya
Thanks,
John A
From: "Philipp A. Hartmann" <philipp.hartmann@offis.de>
To: john.aynsley@doulos.com
Cc: bpriya@cadence.com, systemc-p1666-technical@eda.org
Date: 12/11/2010 23:46
Subject: Re: reset_event
________________________________
John, Bishnupriya,
I agree with having immediate notification of reset_event. We should
probably require, that this event is notified "after" the reset action
has been performed, though.
But I'm somewhat puzzled about the interaction of sc_pause and the
reset/terminated events. Due to the immediate semantics and the
immediate notification of these events, all kinds of model activity
could be triggered during SC_PAUSED, when processes are reset from
within sc_main.
This feels indeed worrisome to me, as Bishnupriya put it in an earlier
mail. Do we need to require, that this implicit/immediate evaluation
phase at least sets the status back to SC_RUNNING? Or do we want to
prohibit this use of kill/reset/throw_it from in between calls to sc_start?
Thanks,
Philipp
On 12/11/10 16:40, john.aynsley@doulos.com wrote:
> Bishnupriya,
>
> I am just trying to pin down the semantics of reset_event().
>
> Every flavor of reset, namely
>
> * reset()
> * resumption while in the synchronous reset state
> * async_reset_signal()
>
> is ultimately equivalent to a call to reset() happening during an
> evaluation phase. We want this to cause the notification of the event that
> will be returned by the new method reset_event(). I can see two
> possibilities:
>
> * The reset event is notified using an immediate notification, in which
> case any processes sensitive to the reset event will become runnable in
> the same evaluation phase in which reset() is called
>
> or
>
> * The reset event is notified using a delta notification, in which case
> any processes sensitive to the reset event will become runnable one delta
> cycle later.
>
> The immediate notification feels right to me.
>
> What do you think?
>
> Thanks,
>
> John A
>
>
>
-- Philipp A. Hartmann Hardware/Software Design Methodology Group OFFIS Institute for Information Technology R&D Division Transportation * FuE-Bereich Verkehr Escherweg 2 * 26121 Oldenburg * Germany Phone/Fax: +49-441-9722-420/282 * PGP: 0x9161A5C0 * http://www.offis.de/ -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Nov 15 11:13:42 2010
This archive was generated by hypermail 2.1.8 : Mon Nov 15 2010 - 11:13:44 PST