User guide
17-35
Using the PLI
static void do_cleanup(int code)
{
/* do simv post-processing work */
}
int main(int argc, char *argv[])
{
/* Startup code (if any) goes here. */
vcs_atexit(do_cleanup); /* Register callback */
SimvMain(argc, argv); /* Run simv */
return 0; /* Never gets here */
}
Note that SimvMain does not return, it calls exit() directly. If you need
to do any post-processing, you can register at-exit functions using
vcs_atexit().
The function you pass to vcs_atexit() is called with the exit status. If
you make multiple calls to vcs_atexit(), your functions are called in
the reverse order of registration.
Note:
You cannot use this feature when using the VCS/ SystemC
cosimulation interface.