Do not return a handle to a port when searching by name

The standard explicitly states that only object with a full name
can be searched for by name. A port does not have a full name and
hence should be skipped so that a different object (the signal,
etc.) can be returned. This patch adds code to skip ports when
searching for an object handle by name.
This commit is contained in:
Cary R 2013-12-06 18:22:52 -08:00
parent bf9781e8fd
commit 077bd5b7ef
1 changed files with 4 additions and 0 deletions

View File

@ -1232,6 +1232,10 @@ static vpiHandle find_name(const char *name, vpiHandle handle)
/* brute force search for the name in all objects in this scope */
for (unsigned i = 0 ; i < ref->nintern ; i += 1) {
/* The standard says that since a port does not have a full
* name it cannot be found by name. Because of this we need
* to skip ports here so the correct handle can be located. */
if (vpi_get(vpiType, ref->intern[i]) == vpiPort) continue;
char *nm = vpi_get_str(vpiName, ref->intern[i]);
if (!strcmp(name, nm)) {
rtn = ref->intern[i];