Remove string paths from PExpr elaboration.

This commit is contained in:
steve 2001-11-08 05:15:50 +00:00
parent 6bfbcbdcf7
commit 7793a49854
7 changed files with 198 additions and 316 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PExpr.cc,v 1.26 2001/11/07 04:26:46 steve Exp $"
#ident "$Id: PExpr.cc,v 1.27 2001/11/08 05:15:50 steve Exp $"
#endif
# include "config.h"
@ -46,7 +46,7 @@ bool PExpr::is_constant(Module*) const
return false;
}
NetNet* PExpr::elaborate_net(Design*des, const string&path, unsigned,
NetNet* PExpr::elaborate_net(Design*des, NetScope*scope, unsigned,
unsigned long,
unsigned long,
unsigned long,
@ -264,6 +264,9 @@ bool PEUnary::is_constant(Module*m) const
/*
* $Log: PExpr.cc,v $
* Revision 1.27 2001/11/08 05:15:50 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.26 2001/11/07 04:26:46 steve
* elaborate_lnet uses scope instead of string path.
*

37
PExpr.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PExpr.h,v 1.51 2001/11/07 04:26:46 steve Exp $"
#ident "$Id: PExpr.h,v 1.52 2001/11/08 05:15:50 steve Exp $"
#endif
# include <string>
@ -62,7 +62,7 @@ class PExpr : public LineInfo {
// This method elaborate the expression as gates, for use in a
// continuous assign or other wholly structural context.
virtual NetNet* elaborate_net(Design*des, const string&path,
virtual NetNet* elaborate_net(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
@ -124,7 +124,7 @@ class PEConcat : public PExpr {
virtual NetNet* elaborate_anet(Design*des, NetScope*scope) const;
virtual NetNet* elaborate_lnet(Design*des, NetScope*scope) const;
virtual NetNet* elaborate_net(Design*des, const string&path,
virtual NetNet* elaborate_net(Design*des, NetScope*scope,
unsigned width,
unsigned long rise,
unsigned long fall,
@ -217,7 +217,7 @@ class PEIdent : public PExpr {
virtual NetAssign_* elaborate_lval(Design*des, NetScope*scope) const;
// Structural r-values are OK.
virtual NetNet* elaborate_net(Design*des, const string&path,
virtual NetNet* elaborate_net(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
@ -250,7 +250,7 @@ class PEIdent : public PExpr {
// expression.
PExpr*idx_;
NetNet* elaborate_net_ram_(Design*des, const string&path,
NetNet* elaborate_net_ram_(Design*des, NetScope*scope,
NetMemory*mem, unsigned lwidth,
unsigned long rise,
unsigned long fall,
@ -266,7 +266,7 @@ class PENumber : public PExpr {
const verinum& value() const;
virtual void dump(ostream&) const;
virtual NetNet* elaborate_net(Design*des, const string&path,
virtual NetNet* elaborate_net(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
@ -309,7 +309,7 @@ class PEUnary : public PExpr {
~PEUnary();
virtual void dump(ostream&out) const;
virtual NetNet* elaborate_net(Design*des, const string&path,
virtual NetNet* elaborate_net(Design*des, NetScope*scope,
unsigned width,
unsigned long rise,
unsigned long fall,
@ -336,7 +336,7 @@ class PEBinary : public PExpr {
virtual bool is_constant(Module*) const;
virtual void dump(ostream&out) const;
virtual NetNet* elaborate_net(Design*des, const string&path,
virtual NetNet* elaborate_net(Design*des, NetScope*scope,
unsigned width,
unsigned long rise,
unsigned long fall,
@ -355,42 +355,42 @@ class PEBinary : public PExpr {
NetEBinary*elaborate_expr_base_(Design*, NetExpr*lp, NetExpr*rp) const;
NetNet* elaborate_net_add_(Design*des, const string&path,
NetNet* elaborate_net_add_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_bit_(Design*des, const string&path,
NetNet* elaborate_net_bit_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_cmp_(Design*des, const string&path,
NetNet* elaborate_net_cmp_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_div_(Design*des, const string&path,
NetNet* elaborate_net_div_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_mod_(Design*des, const string&path,
NetNet* elaborate_net_mod_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_log_(Design*des, const string&path,
NetNet* elaborate_net_log_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_mul_(Design*des, const string&path,
NetNet* elaborate_net_mul_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_shift_(Design*des, const string&path,
NetNet* elaborate_net_shift_(Design*des, NetScope*scope,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
@ -410,7 +410,7 @@ class PETernary : public PExpr {
virtual bool is_constant(Module*) const;
virtual void dump(ostream&out) const;
virtual NetNet* elaborate_net(Design*des, const string&path,
virtual NetNet* elaborate_net(Design*des, NetScope*scope,
unsigned width,
unsigned long rise,
unsigned long fall,
@ -449,6 +449,9 @@ class PECallFunction : public PExpr {
/*
* $Log: PExpr.h,v $
* Revision 1.52 2001/11/08 05:15:50 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.51 2001/11/07 04:26:46 steve
* elaborate_lnet uses scope instead of string path.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_lval.cc,v 1.15 2001/11/07 04:01:59 steve Exp $"
#ident "$Id: elab_lval.cc,v 1.16 2001/11/08 05:15:50 steve Exp $"
#endif
# include "config.h"
@ -67,7 +67,7 @@
*/
NetAssign_* PExpr::elaborate_lval(Design*des, NetScope*scope) const
{
NetNet*ll = elaborate_net(des, scope->name(), 0, 0, 0, 0);
NetNet*ll = elaborate_net(des, scope, 0, 0, 0, 0);
if (ll == 0) {
cerr << get_line() << ": Assignment l-value too complex."
<< endl;
@ -277,6 +277,9 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
/*
* $Log: elab_lval.cc,v $
* Revision 1.16 2001/11/08 05:15:50 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.15 2001/11/07 04:01:59 steve
* eval_const uses scope instead of a string path.
*

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elaborate.cc,v 1.231 2001/11/07 04:26:46 steve Exp $"
#ident "$Id: elaborate.cc,v 1.232 2001/11/08 05:15:50 steve Exp $"
#endif
# include "config.h"
@ -97,7 +97,7 @@ void PGAssign::elaborate(Design*des, const string&path) const
direct drivers. This is how I attach strengths to the
assignment operation. */
if (const PEIdent*id = dynamic_cast<const PEIdent*>(pin(1))) {
NetNet*rid = id->elaborate_net(des, path, lval->pin_count(),
NetNet*rid = id->elaborate_net(des, scope, lval->pin_count(),
0, 0, 0, Link::STRONG,
Link::STRONG);
if (rid == 0) {
@ -170,7 +170,7 @@ void PGAssign::elaborate(Design*des, const string&path) const
/* Elaborate the r-value. Account for the initial decays,
which are going to be attached to the last gate before the
generated NetNet. */
NetNet*rval = pin(1)->elaborate_net(des, path,
NetNet*rval = pin(1)->elaborate_net(des, scope,
lval->pin_count(),
rise_time, fall_time, decay_time,
drive0, drive1);
@ -377,7 +377,7 @@ void PGBuiltin::elaborate(Design*des, const string&path) const
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
const PExpr*ex = pin(idx);
NetNet*sig = ex->elaborate_net(des, path, 0, 0, 0, 0);
NetNet*sig = ex->elaborate_net(des, scope, 0, 0, 0, 0);
if (sig == 0)
continue;
@ -564,7 +564,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
// port. sig is the thing outside the module that
// connects to the port.
NetNet*sig = (*pins)[idx]->elaborate_net(des, path,
NetNet*sig = (*pins)[idx]->elaborate_net(des, scope,
prts_pin_count,
0, 0, 0);
if (sig == 0) {
@ -678,7 +678,7 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, const string&path) const
if (pin(idx) == 0)
continue;
NetNet*sig = pin(idx)->elaborate_net(des, path, 1, 0, 0, 0);
NetNet*sig = pin(idx)->elaborate_net(des, scope, 1, 0, 0, 0);
if (sig == 0) {
cerr << "internal error: Expression too complicated "
"for elaboration:" << *pin(idx) << endl;
@ -1502,7 +1502,7 @@ NetCAssign* PCAssign::elaborate(Design*des, const string&path) const
if (lval == 0)
return 0;
NetNet*rval = expr_->elaborate_net(des, path, lval->pin_count(),
NetNet*rval = expr_->elaborate_net(des, scope, lval->pin_count(),
0, 0, 0);
if (rval == 0)
return 0;
@ -1525,7 +1525,7 @@ NetDeassign* PDeassign::elaborate(Design*des, const string&path) const
NetScope*scope = des->find_scope(path);
assert(scope);
NetNet*lval = lval_->elaborate_net(des, path, 0, 0, 0, 0);
NetNet*lval = lval_->elaborate_net(des, scope, 0, 0, 0, 0);
if (lval == 0)
return 0;
@ -1746,7 +1746,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, const string&path,
if ((expr_.count() == 1) && (expr_[0]->type() == PEEvent::POSITIVE)) {
NetNet*ex = expr_[0]->expr()->elaborate_net(des, path,
NetNet*ex = expr_[0]->expr()->elaborate_net(des, scope,
1, 0, 0, 0);
if (ex == 0) {
expr_[0]->dump(cerr);
@ -1840,7 +1840,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, const string&path,
the sub-expression as a net and decide how to handle
the edge. */
NetNet*expr = expr_[idx]->expr()->elaborate_net(des, path,
NetNet*expr = expr_[idx]->expr()->elaborate_net(des, scope,
0, 0, 0, 0);
if (expr == 0) {
expr_[idx]->dump(cerr);
@ -1933,11 +1933,11 @@ NetProc* PForce::elaborate(Design*des, const string&path) const
NetScope*scope = des->find_scope(path);
assert(scope);
NetNet*lval = lval_->elaborate_net(des, path, 0, 0, 0, 0);
NetNet*lval = lval_->elaborate_net(des, scope, 0, 0, 0, 0);
if (lval == 0)
return 0;
NetNet*rval = expr_->elaborate_net(des, path, lval->pin_count(),
NetNet*rval = expr_->elaborate_net(des, scope, lval->pin_count(),
0, 0, 0);
if (rval == 0)
return 0;
@ -2095,7 +2095,7 @@ NetProc* PRelease::elaborate(Design*des, const string&path) const
NetScope*scope = des->find_scope(path);
assert(scope);
NetNet*lval = lval_->elaborate_net(des, path, 0, 0, 0, 0);
NetNet*lval = lval_->elaborate_net(des, scope, 0, 0, 0, 0);
if (lval == 0)
return 0;
@ -2408,6 +2408,9 @@ Design* elaborate(list<const char*>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.232 2001/11/08 05:15:50 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.231 2001/11/07 04:26:46 steve
* elaborate_lnet uses scope instead of string path.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: net_scope.cc,v 1.14 2001/10/20 05:21:51 steve Exp $"
#ident "$Id: net_scope.cc,v 1.15 2001/11/08 05:15:50 steve Exp $"
#endif
# include "config.h"
@ -368,9 +368,17 @@ string NetScope::local_symbol()
return res.str();
}
string NetScope::local_hsymbol()
{
return name() + "." + local_symbol();
}
/*
* $Log: net_scope.cc,v $
* Revision 1.15 2001/11/08 05:15:50 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.14 2001/10/20 05:21:51 steve
* Scope/module names are char* instead of string.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.221 2001/11/06 04:32:37 steve Exp $"
#ident "$Id: netlist.h,v 1.222 2001/11/08 05:15:51 steve Exp $"
#endif
/*
@ -2651,6 +2651,9 @@ class NetScope {
/* This method generates a non-hierarchical name that is
guaranteed to be unique within this scope. */
string local_symbol();
/* This method generates a hierarchical name that is
guaranteed to be unique globally. */
string local_hsymbol();
void dump(ostream&) const;
void emit_scope(struct target_t*tgt) const;
@ -2856,6 +2859,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.222 2001/11/08 05:15:51 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.221 2001/11/06 04:32:37 steve
* shift expressions can have definite widths.
*