mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 18:13:50 +02:00
Internals: Use single source of truth VCMethod enumeration (#8249)
This commit is contained in:
+5
-15
@@ -49,26 +49,16 @@ bool VNUser4InUse::s_userBusy = false;
|
||||
|
||||
int AstNodeDType::s_uniqueNum = 0;
|
||||
|
||||
V3AST_VCMETHOD_ITEMDATA_DECL;
|
||||
|
||||
//======================================================================
|
||||
// VCMethod information
|
||||
|
||||
VCMethod VCMethod::arrayMethod(const string& name) {
|
||||
for (const auto& it : s_itemData)
|
||||
if (it.m_name == name) return it.m_e;
|
||||
v3fatalSrc("Not a method name known to VCMethod::s_itemData: '" << name << '\'');
|
||||
return VCMethod{};
|
||||
}
|
||||
void VCMethod::selfTest() {
|
||||
int i = 0;
|
||||
for (const auto& it : s_itemData) {
|
||||
const VCMethod exp{i};
|
||||
UASSERT_STATIC(it.m_e == exp,
|
||||
"VCMethod::s_itemData table rows are out-of-order, starting at row "s
|
||||
+ cvtToStr(i) + " '" + +it.m_name + '\'');
|
||||
++i;
|
||||
for (int i = 0; i < _ENUM_MAX; ++i) {
|
||||
const VCMethod method{i};
|
||||
if (name == method.ascii()) return method;
|
||||
}
|
||||
v3fatalSrc("Not a method name known to VCMethod: '" << name << '\'');
|
||||
return VCMethod{};
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
|
||||
Reference in New Issue
Block a user