Jump to content

Handling SystemC engine from a Qt5 thread


Recommended Posts

I have an educational-purpose GUI that displays the results of the simulation. The simulation is started in the run() method of a Qt5 thread.

1./ At some checkpoints the simulation suspends itself (receives an event, but does not execute it until the GUI sends a resume message),

and the GUI can display whatever it wants. I wonder if I need to make any special trick because the GUI and the simulation are in different threads?

(As I understood, the engine is just waiting, hopefully nothing happens that would interfere with the threading. I would prefer reading some values directly,

just to display them, and avoid sending messages, if not absolutely needed.)

2./ As it is a kind of debugger, it may happen that the user terminates the simulation in a way that the simulation is still waiting for a resume message,

but instead a new 'start' message arrives. What is the preferred way of quietly killing the engine? Is it OK, if I terminate and re-start the Qt thread?


Link to comment
Share on other sites

Esp. as educational project you should implement it in 2 threads which communicate with each other. Since they run in the same process space you can access data safely once the simulation is in paused state.

But you cannot restart the simulation without restarting the process it self. SystemC uses static global variables storing the simulation state and those get only initialized at program start.

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.

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