Jump to content

Error (E529) at sc_start()


Markus

Recommended Posts

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

Link to comment
Share on other sites

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;
}
Link to comment
Share on other sites

  • 4 years later...
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!

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.

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