mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-29 01:03:29 +02:00
Merge pull request #1023 from marlonjames/fix-escaped-vpi_handle_by_name
Fix vpi_handle_by_name() for toplevel modules with escaped identifiers
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
+12
-10
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user