mirror of
https://github.com/verilator/verilator.git
synced 2026-10-05 17:43:31 +02:00
Support vpi_handle_by_name with $root..
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user