PLI/VPI questions

E

EdA

Guest
Hi,

Q1:

I have a callback as follows:

cbData.reason = cbEndOfSimulation;
cbData.user_data = (char *) ptr;
cbData.time = &time_callback;
cbData.value = NULL;
cbData.obj = NULL;
cbData.cb_rtn = myFinishSim;
vpi_register_cb(&cbData);

In the function "myFinishSim()" I have a "return(0)" at the end.
My feeling is I should let the simulator call "exit()" but users
of my library are complaining that the simulator is hanging. I
know my routine is being called.

Is there a better way? (Simulators are NC & VCS, VCS hangs)


Q2:

I register a task as follows:

static int something = 0;
static int something_else = 1;

systf.type = vpiSysTask;
systf.sysfunctype = 0;
systf.tfname = "$myModel";
systf.calltf = myModelCall;
systf.compiletf = myModelCompile;
systf.sizetf = NULL;
systf.user_data = (char *) &something;

I decided to get clever and register it again passing in
"something_else".
This works great in NC. I also am using VCS. And a TAB file with the
same call but different data so I've had to do the following:

#ifdef VPI_COMPLIANT
static int myModelCall(char *data)
#else
int myModelCall(int data, int reason)
#endif

Is there a better way?

Thanks,
/Ed
 
On 3 Mar 2005 13:53:28 -0800, "EdA" <ed.arthur@gmail.com> wrote:

Hi,

Q1:

I have a callback as follows:

cbData.reason = cbEndOfSimulation;
cbData.user_data = (char *) ptr;
cbData.time = &time_callback;
cbData.value = NULL;
cbData.obj = NULL;
cbData.cb_rtn = myFinishSim;
vpi_register_cb(&cbData);

In the function "myFinishSim()" I have a "return(0)" at the end.
My feeling is I should let the simulator call "exit()" but users
of my library are complaining that the simulator is hanging. I
know my routine is being called.

Is there a better way? (Simulators are NC & VCS, VCS hangs)
I went through the same process recently. My eventual conclusion was
that the sim is in charge, so it has to call exit, and I'm doing
exactly the same as you are. However, I haven't got as far as testing
this on multiple sims yet, so this is worrying. Having said that, I
can't immediately see how VCS could hang in this situation. It sounds
very much like your users are doing something that they shouldn't be.

My guess is that it's got something to do with user_data and time -
can you put in NULL instead? What are your users doing with them?

No idea on Q2.

Evan
----------------------------
ku.oc.senihcam-edisrevir@lme
 

Welcome to EDABoard.com

Sponsor

Back
Top