Lint check posedge of nonintegral

This commit is contained in:
Wilson Snyder 2023-02-26 12:08:10 -05:00
parent a93b344096
commit b039f246df
3 changed files with 19 additions and 5 deletions

View File

@ -5496,9 +5496,15 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
} else {
userIterateChildren(nodep, WidthVP{SELF, BOTH}.p());
if (nodep->edgeType().anEdge() && nodep->sensp()->dtypep()->skipRefp()->isDouble()) {
nodep->sensp()->v3error(
"Edge event control not legal on real type (IEEE 1800-2017 6.12.1)");
if (nodep->edgeType().anEdge()) {
AstNodeDType* sensDtp = nodep->sensp()->dtypep()->skipRefp();
if (sensDtp->isDouble()) {
nodep->sensp()->v3error(
"Edge event control not legal on real type (IEEE 1800-2017 6.12.1)");
} else if (sensDtp->basicp() && !sensDtp->basicp()->keyword().isIntNumeric()) {
nodep->sensp()->v3error("Edge event control not legal on non-integral type "
"(IEEE 1800-2017 9.4.2)");
}
}
}
}

View File

@ -1,5 +1,9 @@
%Error: t/t_lint_edge_real_bad.v:16:22: Edge event control not legal on real type (IEEE 1800-2017 6.12.1)
%Error: t/t_lint_edge_real_bad.v:19:22: Edge event control not legal on real type (IEEE 1800-2017 6.12.1)
: ... In instance t
16 | always @ (posedge rbad) $stop;
19 | always @ (posedge rbad) $stop;
| ^~~~
%Error: t/t_lint_edge_real_bad.v:20:22: Edge event control not legal on non-integral type (IEEE 1800-2017 9.4.2)
: ... In instance t
20 | always @ (posedge ebad) $stop;
| ^~~~
%Error: Exiting due to

View File

@ -10,9 +10,13 @@ module t (/*AUTOARG*/
);
input real rbad;
input real rok;
event ebad;
struct packed { int a; } sok;
always @ (rok) $stop;
always @ (sok) $stop;
always @ (posedge rbad) $stop;
always @ (posedge ebad) $stop;
endmodule