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.
This commit is contained in:
Cary R 2007-12-14 17:40:55 -08:00 committed by Stephen Williams
parent a83d6bb02c
commit f53f042553
3 changed files with 23 additions and 9 deletions

View File

@ -683,7 +683,7 @@ static int draw_scope(vpiHandle item)
{ {
int depth; int depth;
const char *name; const char *name;
char *type; // char *type; // Not needed, see below.
vpiHandle scope = vpi_handle(vpiScope, item); vpiHandle scope = vpi_handle(vpiScope, item);
if (!scope) if (!scope)
@ -692,15 +692,20 @@ static int draw_scope(vpiHandle item)
depth = 1 + draw_scope(scope); depth = 1 + draw_scope(scope);
name = vpi_get_str(vpiName, 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 vpiNamedBegin: type = "begin"; break;
case vpiTask: type = "task"; break; case vpiTask: type = "task"; break;
case vpiFunction: type = "function"; break; case vpiFunction: type = "function"; break;
case vpiNamedFork: type = "fork"; 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); push_scope(name);
return depth; return depth;

View File

@ -696,7 +696,7 @@ static int draw_scope(vpiHandle item)
{ {
int depth; int depth;
const char *name; const char *name;
char *type; // char *type; // Not needed, see below.
vpiHandle scope = vpi_handle(vpiScope, item); vpiHandle scope = vpi_handle(vpiScope, item);
if (!scope) return 0; if (!scope) return 0;
@ -704,15 +704,20 @@ static int draw_scope(vpiHandle item)
depth = 1 + draw_scope(scope); depth = 1 + draw_scope(scope);
name = vpi_get_str(vpiName, scope); name = vpi_get_str(vpiName, scope);
#if 0 /* The type information is not needed by the LXT2 dumper. */
switch (vpi_get(vpiType, item)) { switch (vpi_get(vpiType, item)) {
case vpiNamedBegin: type = "begin"; break; case vpiNamedBegin: type = "begin"; break;
case vpiTask: type = "task"; break; case vpiTask: type = "task"; break;
case vpiFunction: type = "function"; break; case vpiFunction: type = "function"; break;
case vpiNamedFork: type = "fork"; 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); push_scope(name);
return depth; return depth;

View File

@ -682,12 +682,16 @@ static int draw_scope(vpiHandle item)
depth = 1 + draw_scope(scope); depth = 1 + draw_scope(scope);
name = vpi_get_str(vpiName, scope); name = vpi_get_str(vpiName, scope);
switch (vpi_get(vpiType, item)) { switch (vpi_get(vpiType, scope)) {
case vpiNamedBegin: type = "begin"; break; case vpiNamedBegin: type = "begin"; break;
case vpiTask: type = "task"; break; case vpiTask: type = "task"; break;
case vpiFunction: type = "function"; break; case vpiFunction: type = "function"; break;
case vpiNamedFork: type = "fork"; 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); fprintf(dump_file, "$scope %s %s $end\n", type, name);