Skip to content

Commit

Permalink
Warn that events can not be user task or function arguments.
Browse files Browse the repository at this point in the history
This patch makes events passed as arguments to user tasks or functions
a compile time error with an appropriate error message.
  • Loading branch information
caryr authored and steveicarus committed Sep 13, 2009
1 parent 43f4157 commit 4d57ede
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions elab_expr.cc
Expand Up @@ -1488,6 +1488,12 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope,
def->port(idx)->data_type(),
def->port(idx)->vector_width(),
tmp);
if (NetEEvent*evt = dynamic_cast<NetEEvent*> (parms[idx])) {
cerr << evt->get_fileline() << ": error: An event '"
<< evt->event()->name() << "' can not be a user "
"function argument." << endl;
des->errors += 1;
}
if (debug_elaborate)
cerr << get_fileline() << ": debug:"
<< " function " << path_
Expand Down
7 changes: 7 additions & 0 deletions elaborate.cc
Expand Up @@ -2644,6 +2644,13 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
ivl_variable_type_t lv_type = lv->expr_type();

NetExpr*rv = elaborate_rval_expr(des, scope, lv_type, wid, parms_[idx]);
if (NetEEvent*evt = dynamic_cast<NetEEvent*> (rv)) {
cerr << evt->get_fileline() << ": error: An event '"
<< evt->event()->name() << "' can not be a user "
"task argument." << endl;
des->errors += 1;
continue;
}
if (wid > rv->expr_width()) {
rv->set_width(wid);
rv = pad_to_width(rv, wid, *this);
Expand Down
4 changes: 4 additions & 0 deletions expr_synth.cc
Expand Up @@ -1369,6 +1369,10 @@ NetNet* NetEUFunc::synthesize(Design*des, NetScope*scope, NetExpr*root)
/* Synthesize the arguments. */
bool errors = false;
for (unsigned idx = 0; idx < eparms.count(); idx += 1) {
if (dynamic_cast<NetEEvent*> (parms_[idx])) {
errors = true;
continue;
}
NetNet*tmp = parms_[idx]->synthesize(des, scope, root);
if (tmp == 0) {
cerr << get_fileline() << ": error: Unable to synthesize "
Expand Down

0 comments on commit 4d57ede

Please sign in to comment.