From fde334a5d2633de9833970cb62376944a031dd3e Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 28 Nov 2007 18:17:01 -0800 Subject: [PATCH] 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 --- vpi/sys_sdf.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/vpi/sys_sdf.c b/vpi/sys_sdf.c index cf7550057..10e5c95cf 100644 --- a/vpi/sys_sdf.c +++ b/vpi/sys_sdf.c @@ -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);