Jump to content

How the argument of sc_start(arg) is interpreted


katang

Recommended Posts

I have a processor-like construction, and the execution time is simulated in the model using wait(time),

i.e. I indend to provide the simulated execution time as argument of sc_start(), to imitate step-wise execution.

Can I be sure, that in the model, the simulation will stop 'after' executing the simulated instruction; that is,

reaching limiting time will terminate execution at the very end of the delta cycle? The other possibility that timeout

is only one of the events, and by chance, it can be NOT the last.

BTW: as I understood, a second sc_start() will continue simulation "as it was", i.e. it makes no initialisation, uses no

maybe forgotten temporary variables, etc. It is correct?

BTW2: How can I find out (at the last instruction) that the simulation finished (no more events left in the engine),

and no use to issue another sc_start()?

 

Edited by katang
One more question added
Link to comment
Share on other sites

3 hours ago, katang said:

Can I be sure, that in the model, the simulation will stop 'after' executing the simulated instruction; that is,

reaching limiting time will terminate execution at the very end of the delta cycle? The other possibility that timeout

is only one of the events, and by chance, it can be NOT the last.

Your questions are answered by clause 4.3.4.2 "Function sc_start" in IEEE Std 1666-2011:

Quote

[...]

When a time is passed as an argument, the scheduler shall execute up to and including the latest timed notification phase with simulation time less than or equal to the end time (calculated by adding the time given as an argument to the simulation time when function sc_start is called). [...]

More details on the simulation cycle, you can find in clause 4.2 "Simulation".

3 hours ago, katang said:

BTW: as I understood, a second sc_start() will continue simulation "as it was", i.e. it makes no initialisation, uses no maybe forgotten temporary variables, etc. It is correct?

Yes, see clause 4.3.4.2 of IEEE Std 1666-2011: 

Quote

[...]

When called for the first time, function sc_start shall start the scheduler, which shall run up to the simulation time passed as an argument (if an argument was passed), unless otherwise interrupted, and as determined by the starvation policy argument. The scheduler shall execute the initialization phase before executing the first evaluation phase, as described in 4.2.1.1.

When called on the second and subsequent occasions, function sc_start shall resume the scheduler from the time it had reached at the end of the previous call to sc_start. [...]

 

3 hours ago, katang said:

BTW2: How can I find out (at the last instruction) that the simulation finished (no more events left in the engine), and no use to issue another sc_start()?

Clause 4.5.7 of IEEE Std 1666-2011 lists functions to detect pending activity: sc_pending_activity_at_current_time(), sc_pending_activity_at_future_time(), sc_pending_activity(), and sc_time_to_pending_activity().

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...