Elaborate parameters afer binding of overrides.
This commit is contained in:
parent
9125a4c451
commit
fac3bde2c8
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: design_dump.cc,v 1.64 1999/12/17 03:38:46 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.65 2000/01/10 01:35:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -582,7 +582,7 @@ void NetRepeat::dump(ostream&o, unsigned ind) const
|
|||
|
||||
void NetScope::dump(ostream&o) const
|
||||
{
|
||||
o << name_;
|
||||
o << name();
|
||||
switch (type_) {
|
||||
case BEGIN_END:
|
||||
o << " sequential block";
|
||||
|
|
@ -865,6 +865,9 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.65 2000/01/10 01:35:23 steve
|
||||
* Elaborate parameters afer binding of overrides.
|
||||
*
|
||||
* Revision 1.64 1999/12/17 03:38:46 steve
|
||||
* NetConst can now hold wide constants.
|
||||
*
|
||||
|
|
|
|||
68
elaborate.cc
68
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: elaborate.cc,v 1.140 2000/01/09 20:37:57 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.141 2000/01/10 01:35:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -1784,41 +1784,60 @@ bool Module::elaborate(Design*des, NetScope*scope,
|
|||
// pass references them during elaboration.
|
||||
typedef map<string,PExpr*>::const_iterator mparm_it_t;
|
||||
|
||||
// So this loop elaborates the parameters, ...
|
||||
// So this loop elaborates the parameters, but doesn't
|
||||
// evaluate references to parameters. This scan practically
|
||||
// locates all the parameters and puts them in the parameter
|
||||
// table in the design. No expressions are evaluated.
|
||||
for (mparm_it_t cur = parameters.begin()
|
||||
; cur != parameters.end() ; cur ++) {
|
||||
string pname = path + "." + (*cur).first;
|
||||
des->set_parameter(pname, new NetEParam);
|
||||
}
|
||||
|
||||
// and this loop elaborates the expressions.
|
||||
for (mparm_it_t cur = parameters.begin()
|
||||
; cur != parameters.end() ; cur ++) {
|
||||
string pname = path + "." + (*cur).first;
|
||||
NetExpr*expr = (*cur).second->elaborate_expr(des, path);
|
||||
des->set_parameter(pname, expr);
|
||||
}
|
||||
// The replace map contains replacement expressions for the
|
||||
// parameters. If there is a replacement expression, use that
|
||||
// instead of the default expression. Otherwise, use the
|
||||
// default expression.
|
||||
|
||||
// Override parameters
|
||||
// FIXME: need to check if too many overrides given
|
||||
// FIXME: need to release the replaced expression.
|
||||
// Replacement expressions can come from the ordered list of
|
||||
// overrides, or from the parameter replace by name list.
|
||||
|
||||
map<string,PExpr*> replace;
|
||||
|
||||
if (overrides_) {
|
||||
assert(parms == 0);
|
||||
list<string>::const_iterator cur = param_names.begin();
|
||||
for (unsigned idx = 0 ; idx < overrides_->count(); idx += 1, cur++) {
|
||||
string pname = path + "." + (*cur);
|
||||
NetExpr*expr = (*overrides_)[idx]->elaborate_expr(des, path);
|
||||
des->set_parameter(pname, expr);
|
||||
}
|
||||
list<string>::const_iterator cur = param_names.begin();
|
||||
for (unsigned idx = 0
|
||||
; idx < overrides_->count()
|
||||
; idx += 1, cur++) {
|
||||
replace[*cur] = (*overrides_)[idx];
|
||||
}
|
||||
|
||||
} else if (parms) {
|
||||
|
||||
for (unsigned idx = 0 ; idx < nparms ; idx += 1) {
|
||||
string pname = path + "." + parms[idx].name;
|
||||
NetExpr*expr = parms[idx].parm->elaborate_expr(des, path);
|
||||
des->set_parameter(pname, expr);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < nparms ; idx += 1)
|
||||
replace[parms[idx].name] = parms[idx].parm;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ... and this loop elaborates the expressions. The parameter
|
||||
// expressions are reduced to ordinary expressions that do not
|
||||
// include references to other parameters. Take careful note
|
||||
// of the fact that override expressions are elaborated in the
|
||||
// *parent* scope.
|
||||
|
||||
for (mparm_it_t cur = parameters.begin()
|
||||
; cur != parameters.end() ; cur ++) {
|
||||
string pname = path + "." + (*cur).first;
|
||||
NetExpr*expr;
|
||||
|
||||
if (PExpr*tmp = replace[(*cur).first])
|
||||
expr = tmp->elaborate_expr(des, scope->parent()->name());
|
||||
else
|
||||
expr = (*cur).second->elaborate_expr(des, path);
|
||||
|
||||
des->set_parameter(pname, expr);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1981,6 +2000,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.141 2000/01/10 01:35:23 steve
|
||||
* Elaborate parameters afer binding of overrides.
|
||||
*
|
||||
* Revision 1.140 2000/01/09 20:37:57 steve
|
||||
* Careful with wires connected to multiple ports.
|
||||
*
|
||||
|
|
|
|||
30
netlist.cc
30
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: netlist.cc,v 1.102 1999/12/30 04:19:12 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.103 2000/01/10 01:35:24 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -2101,12 +2101,12 @@ const NetExpr* NetRepeat::expr() const
|
|||
}
|
||||
|
||||
NetScope::NetScope(const string&n)
|
||||
: type_(NetScope::MODULE), name_(n)
|
||||
: type_(NetScope::MODULE), name_(n), up_(0)
|
||||
{
|
||||
}
|
||||
|
||||
NetScope::NetScope(const string&p, NetScope::TYPE t)
|
||||
: type_(t), name_(p)
|
||||
NetScope::NetScope(NetScope*up, const string&n, NetScope::TYPE t)
|
||||
: type_(t), name_(n), up_(up)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -2121,7 +2121,15 @@ NetScope::TYPE NetScope::type() const
|
|||
|
||||
string NetScope::name() const
|
||||
{
|
||||
return name_;
|
||||
if (up_)
|
||||
return up_->name() + "." + name_;
|
||||
else
|
||||
return name_;
|
||||
}
|
||||
|
||||
const NetScope* NetScope::parent() const
|
||||
{
|
||||
return up_;
|
||||
}
|
||||
|
||||
NetTaskDef::NetTaskDef(const string&n, const svector<NetNet*>&po)
|
||||
|
|
@ -2436,9 +2444,12 @@ NetScope* Design::make_scope(const string&path,
|
|||
NetScope::TYPE t,
|
||||
const string&name)
|
||||
{
|
||||
string npath = path + "." + name;
|
||||
NetScope*scope = new NetScope(npath, t);
|
||||
scopes_[npath] = scope;
|
||||
NetScope*up = find_scope(path);
|
||||
assert(up);
|
||||
|
||||
NetScope*scope = new NetScope(up, name, t);
|
||||
scopes_[scope->name()] = scope;
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
|
|
@ -2764,6 +2775,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.103 2000/01/10 01:35:24 steve
|
||||
* Elaborate parameters afer binding of overrides.
|
||||
*
|
||||
* Revision 1.102 1999/12/30 04:19:12 steve
|
||||
* Propogate constant 0 in low bits of adders.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: netlist.h,v 1.106 2000/01/01 06:18:00 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.107 2000/01/10 01:35:24 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -1914,17 +1914,19 @@ class NetScope {
|
|||
public:
|
||||
enum TYPE { MODULE, BEGIN_END, FORK_JOIN };
|
||||
NetScope(const string&root);
|
||||
NetScope(const string&path, TYPE t);
|
||||
NetScope(NetScope*up, const string&name, TYPE t);
|
||||
~NetScope();
|
||||
|
||||
TYPE type() const;
|
||||
string name() const;
|
||||
const NetScope* parent() const;
|
||||
|
||||
void dump(ostream&) const;
|
||||
|
||||
private:
|
||||
TYPE type_;
|
||||
string name_;
|
||||
NetScope*up_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -2082,6 +2084,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.107 2000/01/10 01:35:24 steve
|
||||
* Elaborate parameters afer binding of overrides.
|
||||
*
|
||||
* Revision 1.106 2000/01/01 06:18:00 steve
|
||||
* Handle synthesis of concatenation.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue