mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Fix VPI parameter iteration (#4798)
This commit is contained in:
parent
0195fe9dfd
commit
8ea814e4b4
@ -419,10 +419,19 @@ public:
|
||||
}
|
||||
if (m_onlyParams && !m_it->second.isParam()) continue;
|
||||
if (VL_UNLIKELY(m_topscopep)) {
|
||||
if (const VerilatedVar* topvarp = m_topscopep->varFind(m_it->second.name()))
|
||||
return ((new VerilatedVpioVar{topvarp, m_topscopep})->castVpiHandle());
|
||||
if (const VerilatedVar* topvarp = m_topscopep->varFind(m_it->second.name())) {
|
||||
if (topvarp->isParam()) {
|
||||
return ((new VerilatedVpioParam{topvarp, m_topscopep})->castVpiHandle());
|
||||
} else {
|
||||
return ((new VerilatedVpioVar{topvarp, m_topscopep})->castVpiHandle());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_it->second.isParam()) {
|
||||
return ((new VerilatedVpioParam{&(m_it->second), m_scopep})->castVpiHandle());
|
||||
} else {
|
||||
return ((new VerilatedVpioVar{&(m_it->second), m_scopep})->castVpiHandle());
|
||||
}
|
||||
return ((new VerilatedVpioVar{&(m_it->second), m_scopep})->castVpiHandle());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -75,7 +75,9 @@ int count_params(TestVpiHandle& handle, int expectedParams) {
|
||||
int params = 0;
|
||||
while (true) {
|
||||
TestVpiHandle handle = vpi_scan(it);
|
||||
if (handle == NULL) break;
|
||||
if (!handle) break;
|
||||
const int vpi_type = vpi_get(vpiType, handle);
|
||||
CHECK_RESULT(vpi_type, vpiParameter);
|
||||
params++;
|
||||
}
|
||||
it.freed();
|
||||
|
Loading…
Reference in New Issue
Block a user