From 077bd5b7ef2c1ec86e9d4046af7b64b81978ad66 Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 6 Dec 2013 18:22:52 -0800 Subject: [PATCH] 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. --- vvp/vpi_priv.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 4e020e43b..43e0cde7a 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -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];