diff --git a/ivtest/vpi/br_gh317.c b/ivtest/vpi/br_gh317.c index 94f3d251d..651d7f690 100644 --- a/ivtest/vpi/br_gh317.c +++ b/ivtest/vpi/br_gh317.c @@ -17,6 +17,7 @@ static PLI_INT32 CompileTF(PLI_BYTE8 *x) vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle scope = vpi_handle(vpiScope, callh); + get_type("\\esc.mod ", NULL); get_type("\\esc.port", scope); get_type("\\esc.port ", scope); get_type("\\esc.mod .\\esc.inm .\\esc.port", NULL); diff --git a/ivtest/vpi_gold/br_gh317.gold b/ivtest/vpi_gold/br_gh317.gold index e88b6c526..98cf2a5c7 100644 --- a/ivtest/vpi_gold/br_gh317.gold +++ b/ivtest/vpi_gold/br_gh317.gold @@ -1,5 +1,6 @@ Compiling vpi/br_gh317.c... Making br_gh317.vpi from br_gh317.o... +Looking for "\esc.mod ": found "esc.mod" Looking for "\esc.port": found "esc.port" Looking for "\esc.port ": found "esc.port" Looking for "\esc.mod .\esc.inm .\esc.port": found "esc.port" diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 6d6422d56..eddc0d8fe 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -1473,16 +1473,6 @@ vpiHandle vpi_handle_by_name(const char *name, vpiHandle scope) *(nm_base-1) = 0; } - if (*nm_base == '\\') { - // Skip the \ at the beginning - ++nm_base; - - // Drop the space at the end if it exists - if ((next = strchr(nm_base, ' '))) { - *next = 0; - } - } - // If there is no escaped identifier then just look for the last '.' } else { nm_base = strrchr(nm_path, '.'); @@ -1554,6 +1544,18 @@ vpiHandle vpi_handle_by_name(const char *name, vpiHandle scope) hand = tmp; } + // find_name() expects escaped identifiers to be stripped + if (*nm_base == '\\') { + // Skip the \ at the beginning + ++nm_base; + + // Drop the space at the end if it exists + char *next; + if ((next = strchr(nm_base, ' '))) { + *next = 0; + } + } + // Now we have the correct scope, look for the item. vpiHandle out = find_name(nm_base, hand);