diff --git a/Module.h b/Module.h index ef8816cf4..162761e88 100644 --- a/Module.h +++ b/Module.h @@ -22,6 +22,7 @@ # include # include +# include # include "svector.h" # include "StringHeap.h" # include "HName.h" @@ -118,7 +119,8 @@ class Module : public PScope, public LineInfo { new parameters within the module, but may be used to set values within this module (when instantiated) or in other instantiated modules. */ - mapdefparms; + typedef pair named_expr_t; + listdefparms; /* Parameters may be overridden at instantiation time; the overrides do not contain explicit parameter names, @@ -169,7 +171,7 @@ class Module : public PScope, public LineInfo { bool elaborate(Design*, NetScope*scope) const; typedef map replace_t; - bool elaborate_scope(Design*, NetScope*scope, const replace_t&rep) const; + bool elaborate_scope(Design*, NetScope*scope, const replace_t&rep); bool elaborate_sig(Design*, NetScope*scope) const; diff --git a/elab_scope.cc b/elab_scope.cc index bba6eef63..098843e72 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -182,7 +182,7 @@ static void elaborate_scope_funcs(Design*des, NetScope*scope, } bool Module::elaborate_scope(Design*des, NetScope*scope, - const replace_t&replacements) const + const replace_t&replacements) { if (debug_scopes) { cerr << get_fileline() << ": debug: Elaborate scope " @@ -201,8 +201,6 @@ bool Module::elaborate_scope(Design*des, NetScope*scope, // place of the elaborated expression. typedef map::const_iterator mparm_it_t; - typedef map::const_iterator pform_parm_it_t; - // This loop scans the parameters in the module, and creates // stub parameter entries in the scope for the parameter name. @@ -286,15 +284,17 @@ bool Module::elaborate_scope(Design*des, NetScope*scope, // here because the parameter receiving the assignment may be // in a scope not discovered by this pass. - for (pform_parm_it_t cur = defparms.begin() - ; cur != defparms.end() ; cur ++ ) { + while (! defparms.empty()) { + Module::named_expr_t cur = defparms.front(); + defparms.pop_front(); - PExpr*ex = (*cur).second; + PExpr*ex = cur.second; assert(ex); NetExpr*val = ex->elaborate_pexpr(des, scope); + delete ex; if (val == 0) continue; - scope->defparams.push_back(make_pair(cur->first, val)); + scope->defparams.push_back(make_pair(cur.first, val)); } // Evaluate the attributes. Evaluate them in the scope of the diff --git a/net_design.cc b/net_design.cc index 666c1f40d..98900b180 100644 --- a/net_design.cc +++ b/net_design.cc @@ -240,8 +240,6 @@ void NetScope::run_defparams(Design*des) is the current scope. */ NetScope*targ_scope = des->find_scope(this, eval_path); if (targ_scope == 0) { - cerr << val->get_fileline() << ": warning: scope of " << - path << "." << perm_name << " not found." << endl; // Push the defparam onto a list for retry // later. It is possible for the scope lookup to diff --git a/pform.cc b/pform.cc index 022a30461..6b3612a06 100644 --- a/pform.cc +++ b/pform.cc @@ -1760,7 +1760,7 @@ void pform_set_specparam(perm_string name, PExpr*expr) void pform_set_defparam(const pform_name_t&name, PExpr*expr) { assert(expr); - pform_cur_module->defparms[name] = expr; + pform_cur_module->defparms.push_back(make_pair(name,expr)); } /* diff --git a/pform_dump.cc b/pform_dump.cc index 94bf55d59..ba6e60912 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -991,7 +991,6 @@ void Module::dump(ostream&out) const } typedef map::const_iterator parm_iter_t; - typedef map::const_iterator parm_hiter_t; for (parm_iter_t cur = parameters.begin() ; cur != parameters.end() ; cur ++) { out << " parameter " << (*cur).second.type << " "; @@ -1068,6 +1067,7 @@ void Module::dump(ostream&out) const << *(*cur).second << ";" << endl; } + typedef list::const_iterator parm_hiter_t; for (parm_hiter_t cur = defparms.begin() ; cur != defparms.end() ; cur ++) { out << " defparam " << (*cur).first << " = "; diff --git a/pform_types.cc b/pform_types.cc index 6f31725c0..1f5787f27 100644 --- a/pform_types.cc +++ b/pform_types.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2008 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -16,17 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ifdef HAVE_CVS_IDENT -#ident "$Id: pform_types.cc,v 1.1 2007/05/24 04:07:12 steve Exp $" -#endif # include "pform_types.h" - -bool operator < (const name_component_t&lef, const name_component_t&rig) -{ - if (lef.name < rig.name) - return true; - - return false; -} diff --git a/pform_types.h b/pform_types.h index 35f0039e8..df88f6cab 100644 --- a/pform_types.h +++ b/pform_types.h @@ -1,7 +1,7 @@ #ifndef __pform_types_H #define __pform_types_H /* - * Copyright (c) 2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2008 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ifdef HAVE_CVS_IDENT -#ident "$Id: pform_types.h,v 1.2 2007/06/04 02:19:07 steve Exp $" -#endif // This for the perm_string type. # include "StringHeap.h" @@ -50,7 +47,6 @@ struct name_component_t { std::listindex; }; -extern bool operator < (const name_component_t&lef, const name_component_t&rig); /* * The pform_name_t is the general form for a hierarchical