Jump to content

Making a fresh start with a ready-made SystemC design


Recommended Posts

I am making a design using the timing facilities of SystemC only (not electronic design). The SystemC design is ready-made, and the parameters can be varied by the user. I am preparing a graphic  interface that starts the Run() method of the simulator, runs maybe not to the end. When seeing that some parameter is not perfect, the user quits the actual simulation; changes the respective parameter and starts the simulation again, from the very beginning. 


My questions:

1./ How can I reset SystemC engine to make a fresh start (i.e., no change in the design, only some (say, simulated delay or transmitted parameter) changes), so that it runs as it were the first sc_start() it sees?


(before executing the simulation steps, I perform sc_start( SC_ZERO_TIME ); as suggested in the Reference Book) The simulator proceeds event-by event, in a way like

        sc_start( sc_time_to_pending_activity() );
        MoreEvents = sc_pending_activity();    // Set flag if more to do

       sc_pause(); // Be sure there is no processing

      // Some update


Do I need to call scPause() after every single event, or, say if I want to update only after a certain number of events or after some (simulation) time passes, outside the "while" brackets?

Thanks in advance


Link to comment
Share on other sites

Restart is not possible and that is by design. See the fourth paragraph of section in IEEE-1666-2023 (download free copy via ). Also see figure 1 in section 4.6.10.

However, you could save your parameters in a file (e.g., YAML or JSON) on exiting and read them on subsequent runs.

Also, you possibly misunderstand sc_pause and sc_start. You should never call sc_pause() from sc_main(), but only within the context of SystemC processes (SC_THREAD, SC_CTHREAD or SC_METHOD).

With respect to sc_start, read section 4.6.8 carefully. The example code could significantly slow down your simulation, but it does allow for single stepping the simulation.

Observation: sc_start is sort of misnamed. The first time it is called, it "starts" the simulation. Subsequent calls "resume" the simulation. You should never attempt to advance time outside of SystemC processes. Also, time can never be negative or go backwards.




Link to comment
Share on other sites

Thanks for the clarification. 

Yes, the example code slows down the simulation by some 25-30%, but enables the GUI to access my objects without limitation, given that sc_time is not passing. Furthermore, if it runs in a separate thread, it can run in parallel with the GUI.

What I actually wanted, just to stop the original event processing, empty the event wait list (BTW: Is there any 'Cancel all events?'), and with issuing a special 'reset' signal to my simulator (initializing all my modules), from the point of my design, I am at a point where I was after I issued sc_start(SC_ZERO_TIME'); except that sc_time is not reset. Do you see any caveat with tis?


Link to comment
Share on other sites

The IEEE version is currently free from the IEEE because Accellera paid IEEE to have it so. However, you need a free IEEE account (i.e., you must register) and it is easy to then download the free version. Every copy is registered to the individuals login - the price for free).

https://ieeexplore.ieee.org/document/10246125 (you will need to login to access)


Link to comment
Share on other sites

I am sorry, but the best reply I can achieve is

This Content is Not Included in Your Subscription

The system creates an account for my gmail address, resets my university address. It allows to log me in with either my gmail address or my university address, welcomes me by name, but that is all.

Somehow the institutions are restricted. No access with institutional access, nor with free/paid IEEE account.


Link to comment
Share on other sites

  • 1 month later...

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.

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...