SystemCInDepth Posted March 26, 2018 Report Share Posted March 26, 2018 Hi All, I want to understand whether we can use wait() inside SC_CTOR() or not. I was just trying to map the initial block of verilog to SC_CTOR. Thanks for help !! Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted March 26, 2018 Report Share Posted March 26, 2018 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 David Black 1 Quote Link to comment Share on other sites More sharing options...
Eyck Posted March 26, 2018 Report Share Posted March 26, 2018 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 Quote Link to comment Share on other sites More sharing options...
SystemCInDepth Posted March 26, 2018 Author Report Share Posted March 26, 2018 Use of event will work for me. Thank you all for your responses. Quote Link to comment Share on other sites More sharing options...
katang Posted April 5, 2018 Report Share Posted April 5, 2018 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. 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.