diff --git a/design_dump.cc b/design_dump.cc index 3a377748e..4fca92f57 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -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.60 1999/11/27 19:07:57 steve Exp $" +#ident "$Id: design_dump.cc,v 1.61 1999/11/28 23:42:02 steve Exp $" #endif /* @@ -754,14 +754,6 @@ void NetEParam::dump(ostream&o) const o << "<" << path_ << "." << name_ << ">"; } -void NetESignal::dump_node(ostream&o, unsigned ind) const -{ - o << setw(ind) << "" << "Expression Node (NetESignal): " << - name() << endl; - - dump_node_pins(o, ind+4); -} - void NetETernary::dump(ostream&o) const { o << "(" << *cond_ << ") ? (" << *true_val_ << ") : (" << @@ -874,6 +866,10 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.61 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.60 1999/11/27 19:07:57 steve * Support the creation of scopes. * diff --git a/elab_expr.cc b/elab_expr.cc index 2d2f6c235..467d4d72b 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: elab_expr.cc,v 1.10 1999/11/27 19:07:57 steve Exp $" +#ident "$Id: elab_expr.cc,v 1.11 1999/11/28 23:42:02 steve Exp $" #endif @@ -154,7 +154,6 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, const string&path) const assert(res); NetESignal*eres = new NetESignal(res); assert(eres); - des->add_node(eres); NetEUFunc*func = new NetEUFunc(def, eres, parms); return func; } @@ -215,15 +214,17 @@ NetExpr* PEIdent::elaborate_expr(Design*des, const string&path) const assert(net->sb_to_idx(msv) >= net->sb_to_idx(lsv)); string tname = des->local_symbol(path); - NetESignal*tmp = new NetESignal(tname, wid); - tmp->set_line(*this); + NetTmp*tsig = new NetTmp(tname, wid); // Connect the pins from the lsb up to the msb. unsigned off = net->sb_to_idx(lsv); for (unsigned idx = 0 ; idx < wid ; idx += 1) - connect(tmp->pin(idx), net->pin(idx+off)); + connect(tsig->pin(idx), net->pin(idx+off)); - des->add_node(tmp); + NetESignal*tmp = new NetESignal(tsig); + tmp->set_line(*this); + + des->add_signal(tsig); return tmp; } @@ -236,16 +237,16 @@ NetExpr* PEIdent::elaborate_expr(Design*des, const string&path) const unsigned long msv = msn->as_ulong(); string tname = des->local_symbol(path); - NetESignal*tmp = new NetESignal(tname, 1); + NetTmp*tsig = new NetTmp(tname); + connect(tsig->pin(0), net->pin(msv)); + NetESignal*tmp = new NetESignal(tsig); tmp->set_line(*this); - connect(tmp->pin(0), net->pin(msv)); - des->add_node(tmp); + des->add_signal(tsig); return tmp; } NetESignal*node = new NetESignal(net); - des->add_node(node); assert(idx_ == 0); // Non-constant bit select? punt and make a subsignal @@ -330,6 +331,10 @@ NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const /* * $Log: elab_expr.cc,v $ + * Revision 1.11 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.10 1999/11/27 19:07:57 steve * Support the creation of scopes. * diff --git a/elaborate.cc b/elaborate.cc index cf80cf4d9..90f62d326 100644 --- a/elaborate.cc +++ b/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.130 1999/11/27 19:07:57 steve Exp $" +#ident "$Id: elaborate.cc,v 1.131 1999/11/28 23:42:02 steve Exp $" #endif /* @@ -1142,7 +1142,6 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const /* Generate an assignment of the temporary to the r-value... */ n = des->local_symbol(path); NetESignal*sig = new NetESignal(tmp); - des->add_node(sig); NetAssign*a2 = new NetAssign(n, des, wid, sig); a2->set_line(*this); des->add_node(a2); @@ -1628,7 +1627,6 @@ NetProc* PCallTask::elaborate_usr(Design*des, const string&path) const for (unsigned pi = 0 ; pi < val->pin_count() ; pi += 1) connect(val->pin(pi), ass->pin(pi)); - des->add_node(sig); des->add_node(ass); block->append(ass); } @@ -2152,6 +2150,10 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.131 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.130 1999/11/27 19:07:57 steve * Support the creation of scopes. * diff --git a/emit.cc b/emit.cc index a88598beb..8d093d6ad 100644 --- a/emit.cc +++ b/emit.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: emit.cc,v 1.30 1999/11/27 19:07:57 steve Exp $" +#ident "$Id: emit.cc,v 1.31 1999/11/28 23:42:02 steve Exp $" #endif /* @@ -361,11 +361,6 @@ void NetESignal::expr_scan(struct expr_scan_t*tgt) const tgt->expr_signal(this); } -void NetESignal::emit_node(ostream&o, struct target_t*tgt) const -{ - tgt->net_esignal(o, this); -} - void NetESubSignal::expr_scan(struct expr_scan_t*tgt) const { tgt->expr_subsignal(this); @@ -394,6 +389,10 @@ bool emit(ostream&o, const Design*des, const char*type) /* * $Log: emit.cc,v $ + * Revision 1.31 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.30 1999/11/27 19:07:57 steve * Support the creation of scopes. * diff --git a/eval.cc b/eval.cc index 5ad4f3962..4fbe7d91e 100644 --- a/eval.cc +++ b/eval.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: eval.cc,v 1.10 1999/11/21 20:03:24 steve Exp $" +#ident "$Id: eval.cc,v 1.11 1999/11/28 23:42:02 steve Exp $" #endif # include "PExpr.h" @@ -96,12 +96,13 @@ verinum* PEBinary::eval_const(const Design*des, const string&path) const */ verinum* PEIdent::eval_const(const Design*des, const string&path) const { - assert(msb_ == 0); const NetExpr*expr = des->find_parameter(path, text_); if (expr == 0) return 0; + assert(msb_ == 0); + if (dynamic_cast(expr)) { cerr << get_line() << ": sorry: I cannot evaluate ``" << text_ << "'' in this context." << endl; @@ -126,6 +127,10 @@ verinum* PETernary::eval_const(const Design*, const string&) const /* * $Log: eval.cc,v $ + * Revision 1.11 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.10 1999/11/21 20:03:24 steve * Handle multiply in constant expressions. * diff --git a/expr_synth.cc b/expr_synth.cc index 6d952723b..54fa947cc 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: expr_synth.cc,v 1.5 1999/11/27 19:07:57 steve Exp $" +#ident "$Id: expr_synth.cc,v 1.6 1999/11/28 23:42:02 steve Exp $" #endif # include "netlist.h" @@ -195,17 +195,15 @@ NetNet* NetETernary::synthesize(Design *des) NetNet* NetESignal::synthesize(Design*des) { - NetNet*sig = new NetNet(0, des->local_symbol(name()), - NetNet::WIRE, pin_count()); - sig->local_flag(true); - for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) - connect(sig->pin(idx), pin(idx)); - des->add_signal(sig); - return sig; + return net_; } /* * $Log: expr_synth.cc,v $ + * Revision 1.6 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.5 1999/11/27 19:07:57 steve * Support the creation of scopes. * diff --git a/netlist.cc b/netlist.cc index 6ad736c46..6c6756642 100644 --- a/netlist.cc +++ b/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.95 1999/11/28 01:16:18 steve Exp $" +#ident "$Id: netlist.cc,v 1.96 1999/11/28 23:42:02 steve Exp $" #endif # include @@ -371,7 +371,7 @@ NetNode::~NetNode() NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins) : NetObj(n, npins), sig_next_(0), sig_prev_(0), design_(0), scope_(s), type_(t), port_type_(NOT_A_PORT), msb_(npins-1), lsb_(0), - local_flag_(false) + local_flag_(false), eref_count_(0) { ivalue_ = new verinum::V[npins]; for (unsigned idx = 0 ; idx < npins ; idx += 1) { @@ -383,7 +383,8 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins) NetNet::NetNet(NetScope*s, const string&n, Type t, long ms, long ls) : NetObj(n, ((ms>ls)?ms-ls:ls-ms) + 1), sig_next_(0), sig_prev_(0), design_(0), scope_(s), type_(t), - port_type_(NOT_A_PORT), msb_(ms), lsb_(ls), local_flag_(false) + port_type_(NOT_A_PORT), msb_(ms), lsb_(ls), local_flag_(false), + eref_count_(0) { ivalue_ = new verinum::V[pin_count()]; for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) { @@ -394,6 +395,7 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, long ms, long ls) NetNet::~NetNet() { + assert(eref_count_ == 0); if (design_) design_->del_signal(this); } @@ -416,6 +418,22 @@ unsigned NetNet::sb_to_idx(long sb) const return lsb_ - sb; } +void NetNet::incr_eref() +{ + eref_count_ += 1; +} + +void NetNet::decr_eref() +{ + assert(eref_count_ > 0); + eref_count_ -= 1; +} + +unsigned NetNet::get_eref() const +{ + return eref_count_; +} + NetTmp::NetTmp(const string&name, unsigned npins) : NetNet(0, name, IMPLICIT, npins) { @@ -1805,28 +1823,30 @@ const NetScope* NetEScope::scope() const } NetESignal::NetESignal(NetNet*n) -: NetExpr(n->pin_count()), NetNode(n->name(), n->pin_count()) +: NetExpr(n->pin_count()), net_(n) { + net_->incr_eref(); set_line(*n); - for (unsigned idx = 0 ; idx < n->pin_count() ; idx += 1) { - pin(idx).set_name("P", idx); - pin(idx).set_dir(NetObj::Link::PASSIVE); - connect(pin(idx), n->pin(idx)); - } -} - -NetESignal::NetESignal(const string&n, unsigned np) -: NetExpr(np), NetNode(n, np) -{ - expr_width(pin_count()); - for(unsigned idx = 0 ; idx < np ; idx += 1) { - pin(idx).set_name("P", idx); - pin(idx).set_dir(NetObj::Link::PASSIVE); - } } NetESignal::~NetESignal() { + net_->decr_eref(); +} + +const string& NetESignal::name() const +{ + return net_->name(); +} + +unsigned NetESignal::pin_count() const +{ + return net_->pin_count(); +} + +NetObj::Link& NetESignal::pin(unsigned idx) +{ + return net_->pin(idx); } NetESignal* NetESignal::dup_expr() const @@ -2621,6 +2641,10 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*)) /* * $Log: netlist.cc,v $ + * Revision 1.96 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.95 1999/11/28 01:16:18 steve * gate outputs need to set signal values. * diff --git a/netlist.h b/netlist.h index 1739a3c79..348864dac 100644 --- a/netlist.h +++ b/netlist.h @@ -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.95 1999/11/27 19:07:58 steve Exp $" +#ident "$Id: netlist.h,v 1.96 1999/11/28 23:42:02 steve Exp $" #endif /* @@ -263,6 +263,12 @@ class NetNet : public NetObj, public LineInfo { bool local_flag() const { return local_flag_; } void local_flag(bool f) { local_flag_ = f; } + /* NetESignal objects may reference this object. Keep a + reference count so that I keep track of them. */ + void incr_eref(); + void decr_eref(); + unsigned get_eref() const; + verinum::V get_ival(unsigned pin) const { return ivalue_[pin]; } void set_ival(unsigned pin, verinum::V val) @@ -284,6 +290,7 @@ class NetNet : public NetObj, public LineInfo { long msb_, lsb_; bool local_flag_; + unsigned eref_count_; verinum::V*ivalue_; }; @@ -1804,27 +1811,28 @@ class NetEMemory : public NetExpr { * A signal shows up as a node in the netlist so that structural * activity can invoke the expression. */ -class NetESignal : public NetExpr, public NetNode { +class NetESignal : public NetExpr { public: NetESignal(NetNet*n); - NetESignal(const string&name, unsigned npins); ~NetESignal(); - const string& name() const { return NetNode::name(); } - + const string& name() const; virtual bool set_width(unsigned); virtual NetESignal* dup_expr() const; - NetNet* synthesize(Design*des); + // These methods actually reference the properties of the + // NetNet object that I point to. + unsigned pin_count() const; + NetObj::Link& pin(unsigned idx); + virtual void expr_scan(struct expr_scan_t*) const; - virtual void emit_node(ostream&, struct target_t*) const; virtual void dump(ostream&) const; - virtual void dump_node(ostream&, unsigned ind) const; private: + NetNet*net_; }; /* @@ -2036,6 +2044,10 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.96 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.95 1999/11/27 19:07:58 steve * Support the creation of scopes. * diff --git a/netlist.txt b/netlist.txt index 7f52dbfc4..eb260916b 100644 --- a/netlist.txt +++ b/netlist.txt @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: netlist.txt,v 1.6 1999/11/21 00:13:09 steve Exp $" +#ident "$Id: netlist.txt,v 1.7 1999/11/28 23:42:02 steve Exp $" Note that the netlist.h header contains detailed descriptions of how @@ -204,13 +204,10 @@ INTERACTION OF EXPRESSIONS AND STRUCTURE: NetESignal The NetAssign_ class described above is the means for processes to manipulate the net, but values are read from the net by NetESignal objects. These objects are class NetExpr because they can appear in -expressions (and have width) but are also class NetNode because they -connect to and receive signals from the structural aspects of the -design. +expressions (and have width). They are not NetNode object, but hold +pointers to a NetNet object, which is used to retrieve values with the +expression is evaluated. -The pins of a NetESignal object are passive. The values at the pin are -only sampled when the process evaluates the expression that includes -the NetESignal object. HIERARCHY IN NETLISTS @@ -243,6 +240,10 @@ some task calls. C++ programmers recognize this as inlining a task.) $Log: netlist.txt,v $ + Revision 1.7 1999/11/28 23:42:02 steve + NetESignal object no longer need to be NetNode + objects. Let them keep a pointer to NetNet objects. + Revision 1.6 1999/11/21 00:13:09 steve Support memories in continuous assignments. diff --git a/nodangle.cc b/nodangle.cc index 3cfdc41ee..c35a8760c 100644 --- a/nodangle.cc +++ b/nodangle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: nodangle.cc,v 1.1 1999/11/18 03:52:20 steve Exp $" +#ident "$Id: nodangle.cc,v 1.2 1999/11/28 23:42:02 steve Exp $" #endif /* @@ -39,6 +39,8 @@ void nodangle_f::signal(Design*des, NetNet*sig) { if (! sig->local_flag()) return; + if (sig->get_eref() > 0) + return; /* Check to see if there is some significant signal connected to every pin of this signal. */ @@ -71,6 +73,10 @@ void nodangle(Design*des) /* * $Log: nodangle.cc,v $ + * Revision 1.2 1999/11/28 23:42:02 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.1 1999/11/18 03:52:20 steve * Turn NetTmp objects into normal local NetNet objects, * and add the nodangle functor to clean up the local diff --git a/t-vvm.cc b/t-vvm.cc index 3e100baaf..74cba4d84 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: t-vvm.cc,v 1.83 1999/11/28 18:05:37 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.84 1999/11/28 23:42:03 steve Exp $" #endif # include @@ -73,7 +73,6 @@ class target_vvm : public target_t { virtual void net_assign_nb(ostream&os, const NetAssignNB*); virtual void net_case_cmp(ostream&os, const NetCaseCmp*); virtual void net_const(ostream&os, const NetConst*); - virtual void net_esignal(ostream&os, const NetESignal*); virtual void net_event(ostream&os, const NetNEvent*); virtual bool process(ostream&os, const NetProcTop*); virtual void proc_assign(ostream&os, const NetAssign*); @@ -1220,7 +1219,7 @@ void target_vvm::net_assign_nb(ostream&os, const NetAssignNB*net) // Skip signals, I'll hit them when I handle the // NetESignal nodes. - if (dynamic_cast(cur)) + if (dynamic_cast(cur)) continue; delayed << " " << mangle(cur->name()) @@ -1251,8 +1250,8 @@ void target_vvm::net_assign_nb(ostream&os, const NetAssignNB*net) continue; // Skip signals, I'll hit them when I handle the - // NetESignal nodes. - if (dynamic_cast(cur)) + // NetNet nodes. + if (dynamic_cast(cur)) continue; delayed << " " << mangle(cur->name()) << @@ -1314,10 +1313,6 @@ void target_vvm::net_const(ostream&os, const NetConst*gate) emit_gate_outputfun_(gate, 0); } -void target_vvm::net_esignal(ostream&os, const NetESignal*net) -{ -} - /* * The net_event device is a synthetic device type--a fabrication of * the elaboration phase. An event device receives value changes from @@ -1418,8 +1413,8 @@ void target_vvm::proc_assign(ostream&os, const NetAssign*net) continue; // Skip signals, I'll hit them when I handle the - // NetESignal nodes. - if (dynamic_cast(cur)) + // NetNet nodes. + if (dynamic_cast(cur)) continue; // It is possible for a named device to show up @@ -1459,8 +1454,8 @@ void target_vvm::proc_assign(ostream&os, const NetAssign*net) continue; // Skip signals, I'll hit them when I handle the - // NetESignal nodes. - if (dynamic_cast(cur)) + // NetNet nodes. + if (dynamic_cast(cur)) continue; // It is possible for a named device to show up @@ -1979,6 +1974,10 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.84 1999/11/28 23:42:03 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.83 1999/11/28 18:05:37 steve * Set VPI_MODULE_PATH in the target code, if desired. * diff --git a/target.cc b/target.cc index 9637b0e3e..0fde1c66b 100644 --- a/target.cc +++ b/target.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: target.cc,v 1.27 1999/11/27 19:07:58 steve Exp $" +#ident "$Id: target.cc,v 1.28 1999/11/28 23:42:03 steve Exp $" #endif # include "target.h" @@ -131,13 +131,6 @@ void target_t::net_const(ostream&os, const NetConst*) "Unhandled CONSTANT node." << endl; } -void target_t::net_esignal(ostream&os, const NetESignal*net) -{ - cerr << "target (" << typeid(*this).name() << "): " - "Unhandled Expression Signal node." << endl; - net->dump_node(cerr, 4); -} - void target_t::net_event(ostream&os, const NetNEvent*net) { cerr << "target (" << typeid(*this).name() << "): " @@ -315,6 +308,10 @@ void expr_scan_t::expr_binary(const NetEBinary*ex) /* * $Log: target.cc,v $ + * Revision 1.28 1999/11/28 23:42:03 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.27 1999/11/27 19:07:58 steve * Support the creation of scopes. * diff --git a/target.h b/target.h index 8a07e9b7e..04f361cbe 100644 --- a/target.h +++ b/target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: target.h,v 1.26 1999/11/27 19:07:58 steve Exp $" +#ident "$Id: target.h,v 1.27 1999/11/28 23:42:03 steve Exp $" #endif # include "netlist.h" @@ -85,7 +85,6 @@ struct target_t { virtual void net_assign_nb(ostream&os, const NetAssignNB*); virtual void net_case_cmp(ostream&os, const NetCaseCmp*); virtual void net_const(ostream&os, const NetConst*); - virtual void net_esignal(ostream&os, const NetESignal*); virtual void net_event(ostream&os, const NetNEvent*); /* Output a process (called for each process). It is up to the @@ -147,6 +146,10 @@ extern const struct target *target_table[]; /* * $Log: target.h,v $ + * Revision 1.27 1999/11/28 23:42:03 steve + * NetESignal object no longer need to be NetNode + * objects. Let them keep a pointer to NetNet objects. + * * Revision 1.26 1999/11/27 19:07:58 steve * Support the creation of scopes. *