Skip to content

Commit d11a575

Browse files
authored
Merge pull request #342 from antmicro/missing-typespecs
Systemverilog: Handle missing typespecs
2 parents 0f72816 + 4d987ef commit d11a575

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

systemverilog-plugin/UhdmAst.cc

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,6 +1709,8 @@ void UhdmAst::process_typespec_member()
17091709
current_node->str = current_node->str.substr(1);
17101710
vpiHandle typespec_h = vpi_handle(vpiTypespec, obj_h);
17111711
int typespec_type = vpi_get(vpiType, typespec_h);
1712+
const uhdm_handle *const handle = (const uhdm_handle *)typespec_h;
1713+
const UHDM::BaseClass *const object = (const UHDM::BaseClass *)handle->object;
17121714
switch (typespec_type) {
17131715
case vpiBitTypespec:
17141716
case vpiLogicTypespec: {
@@ -1736,6 +1738,13 @@ void UhdmAst::process_typespec_member()
17361738
shared.report.mark_handled(typespec_h);
17371739
break;
17381740
}
1741+
case vpiTimeTypespec:
1742+
case vpiLongIntTypespec: {
1743+
current_node->is_signed = true;
1744+
packed_ranges.push_back(make_range(63, 0));
1745+
shared.report.mark_handled(typespec_h);
1746+
break;
1747+
}
17391748
case vpiStructTypespec:
17401749
case vpiUnionTypespec:
17411750
case vpiEnumTypespec: {
@@ -1797,9 +1806,13 @@ void UhdmAst::process_typespec_member()
17971806
}
17981807
});
17991808
break;
1809+
case vpiVoidTypespec: {
1810+
report_error("%s:%d: Void typespecs are currently unsupported", object->VpiFile().c_str(), object->VpiLineNo());
1811+
}
1812+
case vpiClassTypespec: {
1813+
report_error("%s:%d: Class typespecs are unsupported", object->VpiFile().c_str(), object->VpiLineNo());
1814+
}
18001815
default: {
1801-
const uhdm_handle *const handle = (const uhdm_handle *)typespec_h;
1802-
const UHDM::BaseClass *const object = (const UHDM::BaseClass *)handle->object;
18031816
report_error("%s:%d: Encountered unhandled typespec in process_typespec_member: '%s' of type '%s'\n", object->VpiFile().c_str(),
18041817
object->VpiLineNo(), object->VpiName().c_str(), UHDM::VpiTypeName(typespec_h).c_str());
18051818
break;
@@ -1838,6 +1851,7 @@ void UhdmAst::process_enum_typespec()
18381851
shared.report.mark_handled(typespec_h);
18391852
break;
18401853
}
1854+
case vpiByteTypespec:
18411855
case vpiIntTypespec:
18421856
case vpiIntegerTypespec: {
18431857
current_node->is_signed = true;
@@ -3737,6 +3751,12 @@ void UhdmAst::process_parameter()
37373751
shared.report.mark_handled(typespec_h);
37383752
break;
37393753
}
3754+
case vpiTimeTypespec:
3755+
case vpiLongIntTypespec: {
3756+
packed_ranges.push_back(make_range(63, 0));
3757+
shared.report.mark_handled(typespec_h);
3758+
break;
3759+
}
37403760
case vpiStructTypespec: {
37413761
visit_one_to_one({vpiTypespec}, obj_h, [&](AST::AstNode *node) {
37423762
if (node && !node->str.empty()) {

0 commit comments

Comments
 (0)