Markus Posted November 22, 2015 Report Share Posted November 22, 2015 Hi, I'm trying to integrate SystemC into a software project in order to periodically simulate hardware parts. At the entry point of the simulation, I tried a minimalistic example: SC_MODULE(test){ SC_CTOR(test){}; }; test testObj("test"); sc_start(1, SC_US); // this is where the error occurs Ther error message is Error (E529) insert module failed runninIn file ../../src/sysc/kernel/sc_module_registry.cpp:47" thrown in the test body. I tried utilizing sc_main and played around with sc_elab_and_sim() a bit, but it doesn't seem to make a difference. Thanks in advance, Markus Quote Link to comment Share on other sites More sharing options...
ivan.bodrov Posted November 23, 2015 Report Share Posted November 23, 2015 Hi, Example you provided works fine for me. I think it is not complete (definetly not, since it has no sc_main or main). And I think it is previous line that throws in your case. Full code (works fine): #include <systemc.h> int sc_main(int, char *[]) { SC_MODULE(test){ SC_CTOR(test){}; }; test testObj("test"); sc_start(1, SC_US); return 0; } This error means that you try to instantiate module after calling sc_start() (so you do this in simulation phase, not elaboration phase). From LRM (5.2 sc_module): 5.2.3 Constraints on usage Objects of class sc_module can only be constructed during elaboration. It shall be an error to instantiate a module during simulation. You can also check chapter 4. Elaboration and simulation semantics Code that reproduces your error should be: #include <systemc.h> int sc_main(int, char *[]) { SC_MODULE(test){ SC_CTOR(test){}; }; sc_start(); test testObj("test"); sc_start(1, SC_US); return 0; } Quote Link to comment Share on other sites More sharing options...
saeed isa Posted November 26, 2019 Report Share Posted November 26, 2019 On 11/23/2015 at 2:51 AM, ivan.bodrov said: Hi, Example you provided works fine for me. I think it is not complete (definetly not, since it has no sc_main or main). And I think it is previous line that throws in your case. Full code (works fine): #include <systemc.h> int sc_main(int, char *[]) { SC_MODULE(test){ SC_CTOR(test){}; }; test testObj("test"); sc_start(1, SC_US); return 0; } This error means that you try to instantiate module after calling sc_start() (so you do this in simulation phase, not elaboration phase). From LRM (5.2 sc_module): You can also check chapter 4. Elaboration and simulation semantics Code that reproduces your error should be: #include <systemc.h> int sc_main(int, char *[]) { SC_MODULE(test){ SC_CTOR(test){}; }; sc_start(); test testObj("test"); sc_start(1, SC_US); return 0; } Thanks for explaning How can I register new model after sc_start such as: test testObj("test"); sc_start(1,...); del test; test testObj("test2"); sc_start(1,...); Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted November 26, 2019 Report Share Posted November 26, 2019 4 hours ago, saeed isa said: How can I register new model after sc_start Short answer: You can't. See this answer from a related discussion: Greetings from Duisburg, Philipp 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.