Handle empty INSTANCE name

Handle the special case that the SDF CELL instance is empty. In this
case, the SDF file is requesting the current scope instead of an
instance within the scope.

Signed-off-by: Stephen Williams <steve@icarus.com>
This commit is contained in:
Stephen Williams 2007-11-28 18:17:01 -08:00
parent 6416a799c9
commit fde334a5d2
1 changed files with 12 additions and 3 deletions

View File

@ -74,14 +74,23 @@ void sdf_select_instance(const char*celltype, const char*cellinst)
strncpy(buffer, src, len);
buffer[len] = 0;
scope = find_scope(scope, buffer);
assert(scope);
vpiHandle tmp_scope = find_scope(scope, buffer);
if (tmp_scope == 0) {
vpi_printf("SDF WARNING: Cannot find %s in %s?\n",
buffer, vpi_get_str(vpiName,scope));
break;
}
assert(tmp_scope);
scope = tmp_scope;
src = dp + 1;
}
/* Now find the cell. */
sdf_cur_cell = find_scope(scope, src);
if (src[0] == 0)
sdf_cur_cell = sdf_scope;
else
sdf_cur_cell = find_scope(scope, src);
if (sdf_cur_cell == 0) {
vpi_printf("SDF WARNING: Unable to find %s in current scope\n",
cellinst);