elaborate_sig for generated case items

Handle elaborate_sig for scopes that are within a case-generated
scheme.
This commit is contained in:
Stephen Williams 2008-02-27 20:54:47 -08:00
parent b5ef6d7a37
commit 52ac96ca15
3 changed files with 28 additions and 1 deletions

View File

@ -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;

View File

@ -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<PGenerate*>::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<NetScope*>::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

View File

@ -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;
}