Jump to content

Recommended Posts

Hi everybody,

 

I have a simple question (not so sure if the answer is simple too). Is it possible to "pause"/"halt" the simulation temporarily?

It would be useful for me in two scenarios:

 

  • Whenever the simulation reaches a specified point in the code. Just like a breakpoint, but not having the need to use a debugger. So whenever the user presses a key, the simulation goes on.
  • Whenever the simulation reaches a point, where a user needs to send an input. It is similar to the previous one, but the here the user would need to enter an input (int, double, string, etc.). I understand that this may be harder for the simulation.

 

So, any ideas? Is there any sc_pause? I know that there is a sc_halt, but it looks like it works only with threads, which would not be suitable to be called from an AMS module.

 

Thanks a lot! ;-)

Share this post


Link to post
Share on other sites

Yes, there is an sc_pause in SystemC (since IEEE 1666-2011 / 2.3.0).  By calling this function from within your simulation, you can return to sc_main (see IEEE 1666-2011, Section 4.5.2).
 
Please note that in the context of the SystemC AMS extension, pausing the simulation may be somewhat dangerous, as noted in Section 5.1.1 of the AMS extensions 2.0 LRM:
 

An application may pause and resume the simulation using the function sc_core::sc_pause followed by the function sc_core::sc_start. The time of each individual TDF, LSF, and ELN module after pausing is implementation-defined. The time domain simulation is resumed from these individual module times.

 

That said, the use cases you have described seem to be blocking in nature.  Why not simply call the code to ask for user input directly from the "specified point in the code"?  In this case, you don't need to interfere with the simulator directly.

 

NB: sc_halt is not part of IEEE 1666 and is not meant to be used in new code.

 

Greetings from Oldenburg,
  Philipp

Share this post


Link to post
Share on other sites

Hi Philipp,

 

Great! Yes, it is better asking for the user input directly instead of pausing. Anyway, I was interested about this sc_pause, so I can do some testing with it.

 

Vielen dank :)

Share this post


Link to post
Share on other sites

Hi everybody,

 

I have a simple question (not so sure if the answer is simple too). Is it possible to "pause"/"halt" the simulation temporarily?

It would be useful for me in two scenarios:

 

  • Whenever the simulation reaches a specified point in the code. Just like a breakpoint, but not having the need to use a debugger. So whenever the user presses a key, the simulation goes on.
  • Whenever the simulation reaches a point, where a user needs to send an input. It is similar to the previous one, but the here the user would need to enter an input (int, double, string, etc.). I understand that this may be harder for the simulation.

 

So, any ideas? Is there any sc_pause? I know that there is a sc_halt, but it looks like it works only with threads, which would not be suitable to be called from an AMS module.

 

Thanks a lot! ;-)

 

Hello Sir,

A very useful trick is to run the simulator in discrete time

steps, with diagnostic print statements in between. This

also allows changing input, and checking to see what

the effect of these changes might be. For example

sc_core::sc_start(<some time duration>, sc_core::<chosen_time_unit>);

/* print statements */

sc_core::sc_start(<some time duration>, sc_core::<chosen_time_unit>);

.....

HTH

Share this post


Link to post
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...