mirror of
https://github.com/verilator/verilator.git
synced 2025-07-31 07:56:10 +00:00
Support vpi_handle_by_name with $root.
.
This commit is contained in:
parent
833c31b031
commit
2ff6ee9613
@ -2059,7 +2059,10 @@ vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) {
|
||||
const VerilatedScope* scopep;
|
||||
const VerilatedVpioScope* const voScopep = VerilatedVpioScope::castp(scope);
|
||||
std::string scopeAndName = namep;
|
||||
if (voScopep) {
|
||||
if (0 == std::strncmp(namep, "$root.", std::strlen("$root."))) {
|
||||
namep += std::strlen("$root.");
|
||||
scopeAndName = namep;
|
||||
} else if (voScopep) {
|
||||
const bool scopeIsPackage = VerilatedVpioPackage::castp(scope) != nullptr;
|
||||
scopeAndName = std::string{voScopep->fullname()} + (scopeIsPackage ? "" : ".") + namep;
|
||||
namep = const_cast<PLI_BYTE8*>(scopeAndName.c_str());
|
||||
|
@ -120,6 +120,7 @@ int mon_check() {
|
||||
|
||||
CHECK_RESULT_Z(check_handle(const_cast<PLI_BYTE8*>("someOtherInt"), tHandle))
|
||||
CHECK_RESULT_Z(check_handle(const_cast<PLI_BYTE8*>("t.someOtherInt"), NULL))
|
||||
CHECK_RESULT_Z(check_handle(const_cast<PLI_BYTE8*>("$root.t.someOtherInt"), NULL))
|
||||
CHECK_RESULT_Z(check_handle(const_cast<PLI_BYTE8*>("someString"), tHandle))
|
||||
CHECK_RESULT_Z(check_handle(const_cast<PLI_BYTE8*>("t.someString"), NULL))
|
||||
CHECK_RESULT_Z(check_handle(const_cast<PLI_BYTE8*>("someInt"), pkgHandle))
|
||||
|
Loading…
Reference in New Issue
Block a user