Parser: Move timing control unsupported message

This commit is contained in:
Wilson Snyder 2020-08-23 08:56:35 -04:00
parent f4a72946eb
commit 132cc1d068
4 changed files with 14 additions and 8 deletions

View File

@ -569,8 +569,10 @@ private:
iterateChildren(nodep);
AstAlways* alwaysp = VN_CAST(nodep->backp(), Always);
if (alwaysp && alwaysp->keyword() == VAlwaysKwd::ALWAYS_COMB) {
alwaysp->v3error("Timing control statements not legal under always_comb\n"
alwaysp->v3error("Timing control statements not legal under always_comb "
"(IEEE 1800-2017 9.2.2.2.2)\n"
<< nodep->warnMore() << "... Suggest use a normal 'always'");
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (alwaysp && !alwaysp->sensesp()) {
// Verilator is still ony supporting SenTrees under an always,
// so allow the parser to handle everything and shim to
@ -580,13 +582,8 @@ private:
alwaysp->sensesp(sensesp);
}
if (nodep->stmtsp()) alwaysp->addStmtp(nodep->stmtsp()->unlinkFrBackWithNext());
} else {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: timing control statement in this location\n"
<< nodep->warnMore()
<< "... Suggest have one timing control statement "
<< "per procedure, at the top of the procedure");
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstNode* nodep) override {

View File

@ -1251,6 +1251,13 @@ private:
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstTimingControl* nodep) override {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: timing control statement in this location\n"
<< nodep->warnMore()
<< "... Suggest have one timing control statement "
<< "per procedure, at the top of the procedure");
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstAttrOf* nodep) override {
AstAttrOf* oldAttr = m_attrp;
m_attrp = nodep;

View File

@ -1,8 +1,10 @@
%Error-UNSUPPORTED: t/t_event_control_unsup.v:14:7: Unsupported: timing control statement in this location
: ... In instance t
: ... Suggest have one timing control statement per procedure, at the top of the procedure
14 | @(clk);
| ^
%Error-UNSUPPORTED: t/t_event_control_unsup.v:16:7: Unsupported: timing control statement in this location
: ... In instance t
: ... Suggest have one timing control statement per procedure, at the top of the procedure
16 | @(clk);
| ^

View File

@ -1,4 +1,4 @@
%Error: t/t_lint_comb_bad.v:14:4: Timing control statements not legal under always_comb
%Error: t/t_lint_comb_bad.v:14:4: Timing control statements not legal under always_comb (IEEE 1800-2017 9.2.2.2.2)
: ... Suggest use a normal 'always'
14 | always_comb @(*) begin
| ^~~~~~~~~~~