diff --git a/design_dump.cc b/design_dump.cc index 3bbe2d5eb..8d166d66b 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -839,7 +839,7 @@ void NetForever::dump(ostream&o, unsigned ind) const void NetFuncDef::dump(ostream&o, unsigned ind) const { - o << setw(ind) << "" << "function " << scope_path(scope_) << endl; + o << setw(ind) << "" << "function definition for " << scope_path(scope_) << endl; if (result_sig_) o << setw(ind+2) << "" << "Return signal: " << result_sig_->name() << endl; diff --git a/elab_sig.cc b/elab_sig.cc index 3119e976c..9a1720546 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -238,6 +238,27 @@ bool PGenerate::elaborate_sig(Design*des, NetScope*container) const { bool flag = true; + // Handle the special case that this is a CASE scheme. In this + // case the PGenerate itself does not have the generated + // item. Look instead for the case ITEM that has a scope + // generated for it. + if (scheme_type == PGenerate::GS_CASE) { + if (debug_elaborate) + cerr << get_fileline() << ": debug: generate case" + << " elaborate_sig in scope " + << scope_path(container) << "." << endl; + + typedef list::const_iterator generate_it_t; + for (generate_it_t cur = generates.begin() + ; cur != generates.end() ; cur ++) { + PGenerate*item = *cur; + if (! item->scope_list_.empty()) { + flag &= item->elaborate_sig(des, container); + } + } + return flag; + } + typedef list::const_iterator scope_list_it_t; for (scope_list_it_t cur = scope_list_.begin() ; cur != scope_list_.end() ; cur ++ ) { @@ -423,6 +444,11 @@ void PFunction::elaborate_sig(Design*des, NetScope*scope) const if (ret_sig) def = new NetFuncDef(scope, ret_sig, ports); assert(def); + if (debug_elaborate) + cerr << get_fileline() << ": debug: " + << "Attach function definition to scope " + << scope_path(scope) << "." << endl; + scope->set_func_def(def); // Look for further signals in the sub-statement diff --git a/elaborate.cc b/elaborate.cc index 414d8a202..f25b4e0f8 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -3050,6 +3050,7 @@ void PFunction::elaborate(Design*des, NetScope*scope) const cerr << get_fileline() << ": internal error: " << "No function definition for function " << scope_path(scope) << endl; + des->errors += 1; return; }