From f53f042553fee1a1600f0300c8ed461ee643086d Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 14 Dec 2007 17:40:55 -0800 Subject: [PATCH] Fix scope type calculation error in draw_scope (all dumpers). This patch fixes the calculation of the scope type in draw_scope. This code is really only used in the VCD dumper so I commented it out in the other two. The problem was that the lower scope was used to calculate the scope type. It is also now an error to try to draw an invalid scope type. --- vpi/sys_lxt.c | 13 +++++++++---- vpi/sys_lxt2.c | 11 ++++++++--- vpi/sys_vcd.c | 8 ++++++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index 2ceaa383e..ef1f93927 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -683,7 +683,7 @@ static int draw_scope(vpiHandle item) { int depth; const char *name; - char *type; +// char *type; // Not needed, see below. vpiHandle scope = vpi_handle(vpiScope, item); if (!scope) @@ -692,15 +692,20 @@ static int draw_scope(vpiHandle item) depth = 1 + draw_scope(scope); name = vpi_get_str(vpiName, scope); - switch (vpi_get(vpiType, item)) { +#if 0 /* The type information is not needed by the LXT dumper. */ + switch (vpi_get(vpiType, scope)) { case vpiNamedBegin: type = "begin"; break; case vpiTask: type = "task"; break; case vpiFunction: type = "function"; break; case vpiNamedFork: type = "fork"; break; - default: type = "module"; break; + case vpiModule: type = "module"; break; + default: + vpi_mcd_printf(1, "LXT Error: $dumpvars: Unsupported scope " + "type (%d)\n", vpi_get(vpiType, item)); + assert(0); } +#endif - /* keep in type info determination for possible future usage */ push_scope(name); return depth; diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index bdaebc885..5e28fc077 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -696,7 +696,7 @@ static int draw_scope(vpiHandle item) { int depth; const char *name; - char *type; +// char *type; // Not needed, see below. vpiHandle scope = vpi_handle(vpiScope, item); if (!scope) return 0; @@ -704,15 +704,20 @@ static int draw_scope(vpiHandle item) depth = 1 + draw_scope(scope); name = vpi_get_str(vpiName, scope); +#if 0 /* The type information is not needed by the LXT2 dumper. */ switch (vpi_get(vpiType, item)) { case vpiNamedBegin: type = "begin"; break; case vpiTask: type = "task"; break; case vpiFunction: type = "function"; break; case vpiNamedFork: type = "fork"; break; - default: type = "module"; break; + case vpiModule: type = "module"; break; + default: + vpi_mcd_printf(1, "LXT2 Error: $dumpvars: Unsupported scope " + "type (%d)\n", vpi_get(vpiType, item)); + assert(0); } +#endif - /* keep in type info determination for possible future usage */ push_scope(name); return depth; diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index a4f4d1e5d..ffb86f06b 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -682,12 +682,16 @@ static int draw_scope(vpiHandle item) depth = 1 + draw_scope(scope); name = vpi_get_str(vpiName, scope); - switch (vpi_get(vpiType, item)) { + switch (vpi_get(vpiType, scope)) { case vpiNamedBegin: type = "begin"; break; case vpiTask: type = "task"; break; case vpiFunction: type = "function"; break; case vpiNamedFork: type = "fork"; break; - default: type = "module"; break; + case vpiModule: type = "module"; break; + default: + vpi_mcd_printf(1, "VCD Error: $dumpvars: Unsupported scope " + "type (%d)\n", vpi_get(vpiType, item)); + assert(0); } fprintf(dump_file, "$scope %s %s $end\n", type, name);