heisba Posted March 13, 2014 Report Share Posted March 13, 2014 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! ;-) Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted March 13, 2014 Report Share Posted March 13, 2014 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 heisba, Hermanmeds and maehne 3 Quote Link to comment Share on other sites More sharing options...
heisba Posted March 13, 2014 Author Report Share Posted March 13, 2014 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 Quote Link to comment Share on other sites More sharing options...
dakupoto Posted March 14, 2014 Report Share Posted March 14, 2014 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.