Question

I was going through some tutorial on SystemC and there was a mention that we cant put wait in SC_METHOD, it didn't explain why.

Was it helpful?

Solution

That is because SC_METHOD does not have its own thread of execution. Every time an event on an SC_METHOD sensitivity list is triggered, the SC_METHOD's code is (ideally) entirely executed. In other words, calling wait() in an SC_METHOD would freeze the simulation itself.

In contrast, an SC_THREAD has its own thread of execution and its activity is generally modeled inside a loop containing or not wait() statements, which pauses the execution of the thread. Whenever an event (of the sensitivity list) is triggered, the execution is resumed at the command that follows the previously issued wait().

OTHER TIPS

Its a feature of the language. SC_METHOD is meant to executed to completion without being deferred or losing context, unlike SC_THREAD.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top