Internals: Add isForceable() to VerilatedVarProps

Allows runtime checking whether a signal is forceable without needing to
check the existence of the `__VforceEn` and `__VforceVal` signals. This
will be useful for a later implementation of `vpiForceFlag` for
`vpi_put_value`.
This commit is contained in:
Christian Hecken 2025-11-12 02:38:11 +01:00
parent fe5d6b213c
commit 1f0c1d47a9
3 changed files with 6 additions and 1 deletions

View File

@ -154,7 +154,8 @@ enum VerilatedVarFlags {
// Flags
VLVF_PUB_RD = (1 << 8), // Public readable
VLVF_PUB_RW = (1 << 9), // Public writable
VLVF_DPI_CLAY = (1 << 10) // DPI compatible C standard layout
VLVF_DPI_CLAY = (1 << 10), // DPI compatible C standard layout
VLVF_FORCEABLE = (1 << 11) // Forceable
};
// IEEE 1800-2023 Table 20-6

View File

@ -156,6 +156,7 @@ public:
return bits;
}
bool isPublicRW() const { return ((m_vlflags & VLVF_PUB_RW) != 0); }
bool isForceable() const { return ((m_vlflags & VLVF_FORCEABLE) != 0); }
// DPI compatible C standard layout
bool isDpiCLayout() const { return ((m_vlflags & VLVF_DPI_CLAY) != 0); }
int udims() const VL_MT_SAFE { return m_unpacked.size(); }

View File

@ -630,6 +630,9 @@ string AstVar::vlEnumDir() const {
} else if (isSigUserRdPublic()) {
out += "|VLVF_PUB_RD";
}
if (isForceable()) {
out += "|VLVF_FORCEABLE";
}
//
if (const AstBasicDType* const bdtypep = basicp()) {
if (bdtypep->keyword().isDpiCLayout()) out += "|VLVF_DPI_CLAY";