For VCD and FST dumpers only sort scope list when needed.

We keep a scope list that is checked to verify that we do not try
to dump duplicate scopes or variables. Since the scan_item routine
can not add duplicate scopes we only need to sort the list after
the scan_item routine is called. Calling it every time a scope
was added was creating a significant startup delay for gate level
simulations since the sort routine is called for every scope in
the design (possibly thousands of times).

This mostly matches what was done for the LXT dumper except the
LXT dumper was incorrectly sorting before not after scan_item
was called. This would not catch a duplicate variable just
after a scope was added in a $dumpvars call.
This commit is contained in:
Cary R 2010-05-22 14:53:16 -07:00 committed by Stephen Williams
parent f268af3580
commit 0eac9f8e9d
3 changed files with 6 additions and 3 deletions

View File

@ -650,7 +650,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
"previously scanned scope %s.\n", fullname);
} else {
vcd_names_add(&fst_tab, fullname);
vcd_names_sort(&fst_tab);
}
name = vpi_get_str(vpiName, item);
@ -781,6 +780,8 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
dep = draw_scope(item, callh);
scan_item(depth, item, 0);
/* The scope list must be sorted after we scan an item. */
vcd_names_sort(&fst_tab);
while (dep--) fstWriterSetUpscope(dump_file);

View File

@ -757,8 +757,9 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
int dep = draw_scope(item);
vcd_names_sort(&lxt_tab);
scan_item(depth, item, 0);
/* The scope list must be sorted after we scan an item. */
vcd_names_sort(&lxt_tab);
while (dep--) pop_scope();
}

View File

@ -690,7 +690,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
"previously scanned scope %s.\n", fullname);
} else {
vcd_names_add(&vcd_tab, fullname);
vcd_names_sort(&vcd_tab);
}
name = vpi_get_str(vpiName, item);
@ -821,6 +820,8 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
dep = draw_scope(item, callh);
scan_item(depth, item, 0);
/* The scope list must be sorted after we scan an item. */
vcd_names_sort(&vcd_tab);
while (dep--) fprintf(dump_file, "$upscope $end\n");