Jump to content
Elvis Shera

SC_TIME_UNIT issues

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

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