From 86fad348136872154cd56c3d33c60eaf761682d4 Mon Sep 17 00:00:00 2001 From: Cary R Date: Sat, 13 Mar 2010 11:12:00 -0800 Subject: [PATCH] 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 4af24b6b9ef1082948c2b5da94289411a3a8616f) --- elaborate.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/elaborate.cc b/elaborate.cc index 889a0d831..3f8f6a0d1 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -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; } }