From 0eac9f8e9deddd0665c4ba554b0aa75b7435e104 Mon Sep 17 00:00:00 2001 From: Cary R Date: Sat, 22 May 2010 14:53:16 -0700 Subject: [PATCH] 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. --- vpi/sys_fst.c | 3 ++- vpi/sys_lxt.c | 3 ++- vpi/sys_vcd.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vpi/sys_fst.c b/vpi/sys_fst.c index ca838a8fb..cfc9d8551 100644 --- a/vpi/sys_fst.c +++ b/vpi/sys_fst.c @@ -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); diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index ca20de692..efb88b42d 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -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(); } diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 559445cdb..0717d4858 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -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");