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:
parent
bf9781e8fd
commit
077bd5b7ef
|
|
@ -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 */
|
/* brute force search for the name in all objects in this scope */
|
||||||
for (unsigned i = 0 ; i < ref->nintern ; i += 1) {
|
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]);
|
char *nm = vpi_get_str(vpiName, ref->intern[i]);
|
||||||
if (!strcmp(name, nm)) {
|
if (!strcmp(name, nm)) {
|
||||||
rtn = ref->intern[i];
|
rtn = ref->intern[i];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue