mirror of
https://github.com/verilator/verilator.git
synced 2024-12-29 10:47:34 +00:00
Fix duplicate scope identifiers decoding (#5584)
Signed-off-by: Bartłomiej Chmiel <bchmiel@antmicro.com> Co-authored-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
parent
b3348a38d0
commit
4e71f359bf
@ -156,7 +156,6 @@ class EmitCSyms final : EmitCBaseVisitorConst {
|
||||
}
|
||||
|
||||
static string scopeDecodeIdentifier(const string& scpname) {
|
||||
string out = scpname;
|
||||
string::size_type pos = string::npos;
|
||||
|
||||
// Remove hierarchy
|
||||
@ -172,17 +171,7 @@ class EmitCSyms final : EmitCBaseVisitorConst {
|
||||
}
|
||||
}
|
||||
|
||||
if (pos != std::string::npos) out.erase(0, pos + 1);
|
||||
|
||||
// Decode all escaped characters
|
||||
while ((pos = out.find("__0")) != string::npos) {
|
||||
unsigned int x;
|
||||
std::stringstream ss;
|
||||
ss << std::hex << out.substr(pos + 3, 2);
|
||||
ss >> x;
|
||||
out.replace(pos, 5, 1, (char)x);
|
||||
}
|
||||
return out;
|
||||
return pos != string::npos ? scpname.substr(pos + 1) : scpname;
|
||||
}
|
||||
|
||||
/// (scp, m_vpiScopeCandidates, m_scopeNames) -> m_scopeNames
|
||||
|
@ -135,6 +135,16 @@ int _mon_check_iter() {
|
||||
TEST_CHECK_CSTR(p, "<null>"); // Unsupported
|
||||
}
|
||||
|
||||
TestVpiHandle vh_null_name = MY_VPI_HANDLE("___0_");
|
||||
TEST_CHECK_NZ(vh_null_name);
|
||||
p = vpi_get_str(vpiName, vh_null_name);
|
||||
TEST_CHECK_CSTR(p, "___0_");
|
||||
|
||||
TestVpiHandle vh_hex_name = MY_VPI_HANDLE("___0F_");
|
||||
TEST_CHECK_NZ(vh_hex_name);
|
||||
p = vpi_get_str(vpiName, vh_hex_name);
|
||||
TEST_CHECK_CSTR(p, "___0F_");
|
||||
|
||||
TestVpiHandle vh10 = vpi_iterate(vpiReg, vh2);
|
||||
TEST_CHECK_NZ(vh10);
|
||||
TEST_CHECK_EQ(vpi_get(vpiType, vh10), vpiIterator);
|
||||
|
@ -63,6 +63,10 @@ extern "C" int mon_check();
|
||||
|
||||
sub \mod.with_dot (.cyc(cyc));
|
||||
|
||||
// Check if scope names are not decoded twice
|
||||
sub ___0F_ (.cyc(cyc));
|
||||
sub ___0_ (.cyc(cyc));
|
||||
|
||||
initial begin
|
||||
|
||||
`ifdef VERILATOR
|
||||
|
Loading…
Reference in New Issue
Block a user