diff --git a/elab_sig.cc b/elab_sig.cc index 35e867426..8809d1d24 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -964,6 +964,10 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const vector plist, nlist; /* If they exist get the port definition MSB and LSB */ if (port_set_ && !port_.empty()) { + if (debug_elaborate) { + cerr << get_fileline() << ": PWire::elaborate_sig: " + << "Evaluate ranges for port " << basename() << endl; + } bad_range |= evaluate_ranges(des, scope, plist, port_); nlist = plist; /* An implicit port can have a range so note that here. */ @@ -974,10 +978,20 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const /* If they exist get the net/etc. definition MSB and LSB */ if (net_set_ && !net_.empty() && !bad_range) { nlist.clear(); + if (debug_elaborate) { + cerr << get_fileline() << ": PWire::elaborate_sig: " + << "Evaluate ranges for net " << basename() << endl; + } bad_range |= evaluate_ranges(des, scope, nlist, net_); } assert(net_set_ || net_.empty()); + if (debug_elaborate) { + cerr << get_fileline() << ": PWire::elaborate_sig: " + << "Calculated ranges for " << basename() + << ". Now check for consistency." << endl; + } + /* If we find errors here, then give up on this signal. */ if (bad_range) return 0; diff --git a/net_func_eval.cc b/net_func_eval.cc index db2dd2260..30534c917 100644 --- a/net_func_eval.cc +++ b/net_func_eval.cc @@ -60,7 +60,7 @@ NetExpr* NetFuncDef::evaluate_function(const LineInfo&loc, const std::vectorcontext_map; if (debug_eval_tree) { - cerr << loc.get_fileline() << ": debug: " + cerr << loc.get_fileline() << ": NetFuncDef::evaluate_function: " << "Evaluate function " << scope_->basename() << endl; } @@ -78,7 +78,7 @@ NetExpr* NetFuncDef::evaluate_function(const LineInfo&loc, const std::vector"; + cerr << endl; + } return res; + } + + if (debug_eval_tree) { + cerr << loc.get_fileline() << ": NetFuncDef::evaluate_function: " + << "Evaluation failed." << endl; + } delete res; return 0; @@ -256,9 +279,8 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc, delete old_lval; if (debug_eval_tree) { - cerr << get_fileline() << ": debug: " - << "NetAssign::evaluate_function: " << lval->name() - << " = " << *rval_result << endl; + cerr << get_fileline() << ": NetAssign::evaluate_function: " + << lval->name() << " = " << *rval_result << endl; } if (ptr->second.nwords > 0) @@ -326,6 +348,11 @@ bool NetBlock::evaluate_function(const LineInfo&loc, if (disable == subscope_) disable = 0; + if (debug_eval_tree) { + cerr << get_fileline() << ": NetBlock::evaluate_function: " + << "flag=" << (flag?"true":"false") << endl; + } + return flag; } @@ -448,8 +475,13 @@ bool NetCondit::evaluate_function(const LineInfo&loc, map&context_map) const { NetExpr*cond = expr_->evaluate_function(loc, context_map); - if (cond == 0) + if (cond == 0) { + if (debug_eval_tree) { + cerr << get_fileline() << ": NetCondit::evaluate_function: " + << "Unable to evaluate condition (" << *expr_ <<")" << endl; + } return false; + } NetEConst*cond_const = dynamic_cast (cond); ivl_assert(loc, cond_const); @@ -457,18 +489,32 @@ bool NetCondit::evaluate_function(const LineInfo&loc, long val = cond_const->value().as_long(); delete cond; + bool flag; + if (val) // The condition is true, so evaluate the if clause - return (if_ == 0) || if_->evaluate_function(loc, context_map); + flag = (if_ == 0) || if_->evaluate_function(loc, context_map); else // The condition is false, so evaluate the else clause - return (else_ == 0) || else_->evaluate_function(loc, context_map); + flag = (else_ == 0) || else_->evaluate_function(loc, context_map); + + if (debug_eval_tree) { + cerr << get_fileline() << ": NetCondit::evaluate_function: " + << "Finished, flag=" << (flag?"true":"false") << endl; + } + return flag; } bool NetDisable::evaluate_function(const LineInfo&, map&) const { disable = target_; + + if (debug_eval_tree) { + cerr << get_fileline() << ": NetDisable::evaluate_function: " + << "disable " << scope_path(disable) << endl; + } + return true; } @@ -541,7 +587,7 @@ bool NetWhile::evaluate_function(const LineInfo&loc, bool flag = true; if (debug_eval_tree) { - cerr << get_fileline() << ": debug: NetWhile::evaluate_function: " + cerr << get_fileline() << ": NetWhile::evaluate_function: " << "Start loop" << endl; } @@ -572,8 +618,8 @@ bool NetWhile::evaluate_function(const LineInfo&loc, } if (debug_eval_tree) { - cerr << get_fileline() << ": debug: NetWhile::evaluate_function: " - << "Done loop" << endl; + cerr << get_fileline() << ": NetWhile::evaluate_function: " + << "Done loop, flag=" << (flag?"true":"false") << endl; } return flag;