Jump to content

Recommended Posts

Hi, 

I am calling SC model from a program with its own unit... While calling a function which advances the simulation time I noticed the following behaviour: 

 

--- the function which is called from outside is: 

void advance_sim(double simtime) {
    cout<<"@"<<sc_time_stamp()<<". Advancing Simulation time by "<<simtime<<" ns"<<endl;
    sc_core::sc_start(simtime, sc_core::SC_NS);
}

When  I use SC_FS/PS/NS as time unit all is ok. 

When I use SC_US/MS/SEC  I get a segmentation fault (core dump). 

Has anybody seen this before? It looks wired to me. If my code was not correct, why would this work for unit <=  NS ?

Thanks,

Elvis

Share this post


Link to post
Share on other sites

It is hard to guess a reason for the segmentation fault from the information that you provide. Have you tested that your simulation works properly if you convert the time range, which you passed in us/ms/sec to ns?

You should also check out the core dump in the debugger. It contains a stack trace so that you can check at which point in the execution the segfault was provoked. Of course, the segfault might have occurred in some internal/standard library function, but in many cases the cause for it happened in user code. Therefore, you will have to step up stack frame per stack frame until you reached the code you have written. While doing this, examine the arguments and local variables of the current function. They might give you a hint what is going on.

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

×