Jump to content
SystemCInDepth

wait in SC_CTOR()

Recommended Posts

Hello @SystemCInDepth,

The wait() call can only be used in SC_THREAD/SC_CTHREAD registered processes in SystemC library.

You are trying to call wait even before the elaboration happens and you have started the simulation.

It would be better if you could go through the book: SystemC from Ground Up by David Black to have a better understanding.

Hope it helps.

Regards,

Ameya Vikram Singh

 

Share this post


Link to post
Share on other sites

Hi,

if you want to map the Verilog initial block you can use the  start_of_simulation() callback function. This one us called automatically by the kernel at simulation start. But you cannot call wait()  either in this function. If you need to execute somethin delayed you can post a sc_event in the start_of_simulation() function and register a method/trhead being sensitive to this event.

Cheers

Share this post


Link to post
Share on other sites

Or, a more simple solution: you may put a "call" to an initialization routine, like

   SC_THREAD(Initialize_method);  

If you do NOT use  dont_initialize() after that line, the SystemC engine waits until the constructor finishes (and gets registered), and after that executes the thread 'Initialize_method' where you are enabled to use wait(). This happens at the same (simulated) time, so I think it closely matches 'initial', which you want to imitate.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×