Make taking an edge of a named event an error.

A named event does not have an edge so taking a posedge or negedge
is illegal. This patch adds an error message for this. Before the
edge was being ignored for named events, but this is incompatible
with other tools.
(cherry picked from commit 4af24b6b9e)
This commit is contained in:
Cary R 2010-03-13 11:12:00 -08:00 committed by Stephen Williams
parent 73a9880417
commit 86fad34813
1 changed files with 19 additions and 0 deletions

View File

@ -3043,6 +3043,25 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
if (found_in && eve) {
wa->add_event(eve);
/* You can not look for the posedge or negedge of
* an event. */
if (expr_[idx]->type() != PEEvent::ANYEDGE) {
cerr << get_fileline() << ": error: ";
switch (expr_[idx]->type()) {
case PEEvent::POSEDGE:
cerr << "posedge";
break;
case PEEvent::NEGEDGE:
cerr << "negedge";
break;
default:
cerr << "unknown edge type!";
assert(0);
}
cerr << " can not be used with a named event ("
<< eve->name() << ")." << endl;
des->errors += 1;
}
continue;
}
}