Handle defparam to partial hierarchical names.
This commit is contained in:
parent
e7efc2709a
commit
61822d48aa
17
elaborate.cc
17
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: elaborate.cc,v 1.146 2000/03/08 04:36:53 steve Exp $"
|
#ident "$Id: elaborate.cc,v 1.147 2000/03/10 06:20:48 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1920,12 +1920,22 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method recurses through the scopes, looking for
|
||||||
|
// defparam assignments to apply to the parameters in the
|
||||||
|
// various scopes. This needs to be done after all the scopes
|
||||||
|
// and basic parameters are taken care of because the defparam
|
||||||
|
// can assign to a paramter declared *after* it.
|
||||||
des->run_defparams();
|
des->run_defparams();
|
||||||
|
|
||||||
|
|
||||||
|
// At this point, all parameter overrides are done. Scane the
|
||||||
|
// scopes and evaluate the parameters all the way down to
|
||||||
|
// constants.
|
||||||
des->evaluate_parameters();
|
des->evaluate_parameters();
|
||||||
|
|
||||||
|
|
||||||
// Now that the structure and parameters are taken care of,
|
// Now that the structure and parameters are taken care of,
|
||||||
// run through the pform again and generate the full netlist.
|
// run through the pform again and generate the full netlist.
|
||||||
|
|
||||||
bool rc = rmod->elaborate(des, scope);
|
bool rc = rmod->elaborate(des, scope);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1943,6 +1953,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elaborate.cc,v $
|
* $Log: elaborate.cc,v $
|
||||||
|
* Revision 1.147 2000/03/10 06:20:48 steve
|
||||||
|
* Handle defparam to partial hierarchical names.
|
||||||
|
*
|
||||||
* Revision 1.146 2000/03/08 04:36:53 steve
|
* Revision 1.146 2000/03/08 04:36:53 steve
|
||||||
* Redesign the implementation of scopes and parameters.
|
* Redesign the implementation of scopes and parameters.
|
||||||
* I now generate the scopes and notice the parameters
|
* I now generate the scopes and notice the parameters
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: net_design.cc,v 1.1 2000/03/08 04:36:53 steve Exp $"
|
#ident "$Id: net_design.cc,v 1.2 2000/03/10 06:20:48 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -90,7 +90,7 @@ NetScope* Design::make_scope(const string&path,
|
||||||
* more step down the tree until the name runs out or the search
|
* more step down the tree until the name runs out or the search
|
||||||
* fails.
|
* fails.
|
||||||
*/
|
*/
|
||||||
NetScope* Design::find_scope(const string&key)
|
NetScope* Design::find_scope(const string&key) const
|
||||||
{
|
{
|
||||||
if (key == root_scope_->name())
|
if (key == root_scope_->name())
|
||||||
return root_scope_;
|
return root_scope_;
|
||||||
|
|
@ -111,6 +111,35 @@ NetScope* Design::find_scope(const string&key)
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a relative lookup of a scope by name. The starting point is
|
||||||
|
* the scope parameter is the place within which I start looking for
|
||||||
|
* the scope. If I do not find the scope within the passed scope,
|
||||||
|
* start looking in parent scopes until I find it, or I run out of
|
||||||
|
* parent scopes.
|
||||||
|
*/
|
||||||
|
NetScope* Design::find_scope(NetScope*scope, const string&name) const
|
||||||
|
{
|
||||||
|
assert(scope);
|
||||||
|
|
||||||
|
for ( ; scope ; scope = scope->parent()) {
|
||||||
|
string path = name;
|
||||||
|
string key = parse_first_name(path);
|
||||||
|
|
||||||
|
NetScope*cur = scope;
|
||||||
|
do {
|
||||||
|
cur = cur->child(key);
|
||||||
|
if (cur == 0) break;
|
||||||
|
key = parse_first_name(path);
|
||||||
|
} while (key != "");
|
||||||
|
|
||||||
|
if (cur) return cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Last chance. Look for the name starting at the root.
|
||||||
|
return find_scope(name);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find a parameter from within a specified context. If the name is
|
* Find a parameter from within a specified context. If the name is
|
||||||
* not here, keep looking up until I run out of up to look at. The
|
* not here, keep looking up until I run out of up to look at. The
|
||||||
|
|
@ -169,7 +198,7 @@ void NetScope::run_defparams(Design*des)
|
||||||
string path = (*pp).first;
|
string path = (*pp).first;
|
||||||
string name = parse_last_name(path);
|
string name = parse_last_name(path);
|
||||||
|
|
||||||
NetScope*targ_scope = des->find_scope(path);
|
NetScope*targ_scope = des->find_scope(this, path);
|
||||||
if (targ_scope == 0) {
|
if (targ_scope == 0) {
|
||||||
cerr << val->get_line() << ": warning: scope of " <<
|
cerr << val->get_line() << ": warning: scope of " <<
|
||||||
path << "." << name << " not found." << endl;
|
path << "." << name << " not found." << endl;
|
||||||
|
|
@ -522,6 +551,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: net_design.cc,v $
|
* $Log: net_design.cc,v $
|
||||||
|
* Revision 1.2 2000/03/10 06:20:48 steve
|
||||||
|
* Handle defparam to partial hierarchical names.
|
||||||
|
*
|
||||||
* Revision 1.1 2000/03/08 04:36:53 steve
|
* Revision 1.1 2000/03/08 04:36:53 steve
|
||||||
* Redesign the implementation of scopes and parameters.
|
* Redesign the implementation of scopes and parameters.
|
||||||
* I now generate the scopes and notice the parameters
|
* I now generate the scopes and notice the parameters
|
||||||
|
|
|
||||||
10
netlist.cc
10
netlist.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: netlist.cc,v 1.106 2000/03/08 04:36:53 steve Exp $"
|
#ident "$Id: netlist.cc,v 1.107 2000/03/10 06:20:48 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <cassert>
|
# include <cassert>
|
||||||
|
|
@ -2328,6 +2328,11 @@ const NetScope* NetScope::child(const string&name) const
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NetScope* NetScope::parent()
|
||||||
|
{
|
||||||
|
return up_;
|
||||||
|
}
|
||||||
|
|
||||||
const NetScope* NetScope::parent() const
|
const NetScope* NetScope::parent() const
|
||||||
{
|
{
|
||||||
return up_;
|
return up_;
|
||||||
|
|
@ -2627,6 +2632,9 @@ void NetUDP::set_initial(char val)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netlist.cc,v $
|
* $Log: netlist.cc,v $
|
||||||
|
* Revision 1.107 2000/03/10 06:20:48 steve
|
||||||
|
* Handle defparam to partial hierarchical names.
|
||||||
|
*
|
||||||
* Revision 1.106 2000/03/08 04:36:53 steve
|
* Revision 1.106 2000/03/08 04:36:53 steve
|
||||||
* Redesign the implementation of scopes and parameters.
|
* Redesign the implementation of scopes and parameters.
|
||||||
* I now generate the scopes and notice the parameters
|
* I now generate the scopes and notice the parameters
|
||||||
|
|
|
||||||
14
netlist.h
14
netlist.h
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: netlist.h,v 1.111 2000/03/08 04:36:54 steve Exp $"
|
#ident "$Id: netlist.h,v 1.112 2000/03/10 06:20:48 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1998,6 +1998,7 @@ class NetScope {
|
||||||
|
|
||||||
/* The parent and child() methods allow users of NetScope
|
/* The parent and child() methods allow users of NetScope
|
||||||
objects to locate nearby scopes. */
|
objects to locate nearby scopes. */
|
||||||
|
NetScope* parent();
|
||||||
NetScope* child(const string&name);
|
NetScope* child(const string&name);
|
||||||
const NetScope* parent() const;
|
const NetScope* parent() const;
|
||||||
const NetScope* child(const string&name) const;
|
const NetScope* child(const string&name) const;
|
||||||
|
|
@ -2054,7 +2055,13 @@ class Design {
|
||||||
NetScope* make_root_scope(const string&name);
|
NetScope* make_root_scope(const string&name);
|
||||||
NetScope* make_scope(const string&path, NetScope::TYPE t,
|
NetScope* make_scope(const string&path, NetScope::TYPE t,
|
||||||
const string&name);
|
const string&name);
|
||||||
NetScope* find_scope(const string&path);
|
|
||||||
|
/* look up a scope. If no starting scope is passed, then the
|
||||||
|
path name string is taken as an absolute scope
|
||||||
|
name. Otherwise, the scope is located starting at the
|
||||||
|
passed scope and working up if needed. */
|
||||||
|
NetScope* find_scope(const string&path) const;
|
||||||
|
NetScope* find_scope(NetScope*, const string&path) const;
|
||||||
|
|
||||||
// PARAMETERS
|
// PARAMETERS
|
||||||
|
|
||||||
|
|
@ -2188,6 +2195,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netlist.h,v $
|
* $Log: netlist.h,v $
|
||||||
|
* Revision 1.112 2000/03/10 06:20:48 steve
|
||||||
|
* Handle defparam to partial hierarchical names.
|
||||||
|
*
|
||||||
* Revision 1.111 2000/03/08 04:36:54 steve
|
* Revision 1.111 2000/03/08 04:36:54 steve
|
||||||
* Redesign the implementation of scopes and parameters.
|
* Redesign the implementation of scopes and parameters.
|
||||||
* I now generate the scopes and notice the parameters
|
* I now generate the scopes and notice the parameters
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue