Start of simulation event needed to be run after initialization events.

This patch splits the end of compile and the start of simulation call
backs code into two different procedures. The end of compile events are
still executed at the same time they alway were. The start of simulation
events are now run after initialization.
This commit is contained in:
Cary R 2007-08-23 18:24:51 -07:00 committed by Stephen Williams
parent fa1c0ae2a2
commit c7538386fc
2 changed files with 21 additions and 4 deletions

View File

@ -565,7 +565,8 @@ static vvp_time64_t schedule_time;
vvp_time64_t schedule_simtime(void)
{ return schedule_time; }
extern void vpiPresim();
extern void vpiEndOfCompile();
extern void vpiStartOfSim();
extern void vpiPostsim();
extern void vpiNextSimTime(void);
@ -600,8 +601,8 @@ void schedule_simulate(void)
{
schedule_time = 0;
// Execute pre-simulation callbacks
vpiPresim();
// Execute end of compile callbacks
vpiEndOfCompile();
// Execute initialization events.
while (schedule_init_list) {
@ -612,6 +613,9 @@ void schedule_simulate(void)
delete cur;
}
// Execute start of simulation callbacks
vpiStartOfSim();
signals_capture();
while (sched_list) {

View File

@ -286,7 +286,7 @@ static struct __vpiCallback*EndOfCompile = NULL;
static struct __vpiCallback*StartOfSimulation = NULL;
static struct __vpiCallback*EndOfSimulation = NULL;
void vpiPresim(void) {
void vpiEndOfCompile(void) {
struct __vpiCallback* cur;
/*
@ -303,6 +303,19 @@ void vpiPresim(void) {
delete_vpi_callback(cur);
}
vpi_mode_flag = VPI_MODE_NONE;
}
void vpiStartOfSim(void) {
struct __vpiCallback* cur;
/*
* Walk the list of register callbacks, executing them and
* freeing them when done.
*/
assert(vpi_mode_flag == VPI_MODE_NONE);
vpi_mode_flag = VPI_MODE_RWSYNC;
while (StartOfSimulation) {
cur = StartOfSimulation;
StartOfSimulation = cur->next;