diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index c87ee4d58..87d01a1a6 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -759,8 +759,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(); } @@ -780,10 +781,10 @@ void sys_lxt_register() s_vpi_systf_data tf_data; - /* Scan the extended arguments, looking for lxt optimization - flags. */ + /* Scan the extended arguments, looking for lxt optimization flags. */ vpi_get_vlog_info(&vlog_info); + /* The "speed" option is not used in this dumper. */ for (idx = 0 ; idx < vlog_info.argc ; idx += 1) { if (strcmp(vlog_info.argv[idx],"-lxt-space") == 0) { lxm_optimum_mode = LXM_SPACE; diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index c44d2725b..4f9b8190e 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -770,8 +770,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 18f2a5fe9..8ea42b449 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -691,7 +691,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); @@ -822,6 +821,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");