Remove NetTmp and add NetSubnet class.
This commit is contained in:
parent
d7fb47268f
commit
cd94019733
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: design_dump.cc,v 1.128 2002/06/14 21:38:41 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.129 2002/06/19 04:20:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -117,6 +117,13 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
|
|||
dump_obj_attr(o, ind+4);
|
||||
}
|
||||
|
||||
void NetSubnet::dump_net(ostream&o, unsigned ind) const
|
||||
{
|
||||
o << setw(ind) << "" << "** " << name() << " is a NetSubnet **"
|
||||
<< endl;
|
||||
NetNet::dump_net(o, ind);
|
||||
}
|
||||
|
||||
void NetMemory::dump(ostream&o, unsigned ind) const
|
||||
{
|
||||
o << setw(ind) << "" << name_ << "[" << width_ << "] " <<
|
||||
|
|
@ -977,6 +984,9 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.129 2002/06/19 04:20:03 steve
|
||||
* Remove NetTmp and add NetSubnet class.
|
||||
*
|
||||
* Revision 1.128 2002/06/14 21:38:41 steve
|
||||
* Fix expression width for repeat concatenations.
|
||||
*
|
||||
|
|
|
|||
85
elab_net.cc
85
elab_net.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elab_net.cc,v 1.90 2002/05/23 03:08:51 steve Exp $"
|
||||
#ident "$Id: elab_net.cc,v 1.91 2002/06/19 04:20:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -138,9 +138,9 @@ NetNet* PEBinary::elaborate_net(Design*des, NetScope*scope,
|
|||
osig = 0;
|
||||
}
|
||||
|
||||
if (NetTmp*tmp = dynamic_cast<NetTmp*>(lsig))
|
||||
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(lsig))
|
||||
delete tmp;
|
||||
if (NetTmp*tmp = dynamic_cast<NetTmp*>(rsig))
|
||||
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(rsig))
|
||||
delete tmp;
|
||||
|
||||
return osig;
|
||||
|
|
@ -744,7 +744,9 @@ NetNet* PEBinary::elaborate_net_log_(Design*des, NetScope*scope,
|
|||
|
||||
/* The reduced logical value is a new nexus, create a
|
||||
temporary signal to represent it. */
|
||||
NetNet*tmp = new NetTmp(scope, scope->local_hsymbol());
|
||||
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
|
||||
NetNet::IMPLICIT, 1);
|
||||
tmp->local_flag(true);
|
||||
connect(gate->pin(1), tmp->pin(0));
|
||||
|
||||
des->add_node(gate_t);
|
||||
|
|
@ -763,7 +765,9 @@ NetNet* PEBinary::elaborate_net_log_(Design*des, NetScope*scope,
|
|||
|
||||
/* The reduced logical value is a new nexus, create a
|
||||
temporary signal to represent it. */
|
||||
NetNet*tmp = new NetTmp(scope, scope->local_hsymbol());
|
||||
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
|
||||
NetNet::IMPLICIT, 1);
|
||||
tmp->local_flag(true);
|
||||
connect(gate->pin(2), tmp->pin(0));
|
||||
|
||||
des->add_node(gate_t);
|
||||
|
|
@ -944,7 +948,9 @@ NetNet* PEBinary::elaborate_net_shift_(Design*des, NetScope*scope,
|
|||
if (lsig->pin_count() < lwidth) {
|
||||
NetConst*zero = new NetConst(scope, scope->local_hsymbol(),
|
||||
verinum::V0);
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol());
|
||||
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
|
||||
NetNet::IMPLICIT, 1);
|
||||
tmp->local_flag(true);
|
||||
des->add_node(zero);
|
||||
connect(zero->pin(0), tmp->pin(0));
|
||||
for (unsigned idx = lsig->pin_count() ; idx < lwidth ; idx += 1)
|
||||
|
|
@ -957,7 +963,9 @@ NetNet* PEBinary::elaborate_net_shift_(Design*des, NetScope*scope,
|
|||
connect(rsig->pin(idx), gate->pin_Distance(idx));
|
||||
|
||||
if (op_ == 'r') {
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol());
|
||||
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
|
||||
NetNet::IMPLICIT, 1);
|
||||
tmp->local_flag(true);
|
||||
NetConst*dir = new NetConst(scope, scope->local_hsymbol(),
|
||||
verinum::V1);
|
||||
connect(dir->pin(0), gate->pin_Direction());
|
||||
|
|
@ -1298,15 +1306,13 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
|||
lidx = tmp;
|
||||
}
|
||||
|
||||
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
|
||||
sig->type(), midx-lidx+1);
|
||||
tmp->local_flag(true);
|
||||
unsigned part_count = midx-lidx+1;
|
||||
|
||||
/* Check that the bit or part select of the signal is
|
||||
within the range of the part. The lidx is the
|
||||
normalized index of the LSB, so that plus the desired
|
||||
width must be <= the width of the references signal. */
|
||||
if ((lidx + tmp->pin_count()) > sig->pin_count()) {
|
||||
if ((lidx + part_count) > sig->pin_count()) {
|
||||
cerr << get_line() << ": error: bit/part select ["
|
||||
<< mval->as_long() << ":" << lval->as_long()
|
||||
<< "] out of range for " << sig->name() << endl;
|
||||
|
|
@ -1314,8 +1320,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
|||
return sig;
|
||||
}
|
||||
|
||||
for (unsigned idx = lidx ; idx <= midx ; idx += 1)
|
||||
connect(tmp->pin(idx-lidx), sig->pin(idx));
|
||||
NetSubnet*tmp = new NetSubnet(sig, lidx, part_count);
|
||||
|
||||
sig = tmp;
|
||||
|
||||
|
|
@ -1336,14 +1341,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
|||
idx = 0;
|
||||
}
|
||||
|
||||
/* This is a bit select, create a compatible NetNet with
|
||||
a single bit that links to the selected bit of the
|
||||
expression. */
|
||||
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
|
||||
sig->type(), 1);
|
||||
tmp->local_flag(true);
|
||||
|
||||
connect(tmp->pin(0), sig->pin(idx));
|
||||
NetSubnet*tmp = new NetSubnet(sig, idx, 1);
|
||||
sig = tmp;
|
||||
}
|
||||
|
||||
|
|
@ -1447,24 +1445,21 @@ NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope) const
|
|||
unsigned lidx = sig->sb_to_idx(lval->as_long());
|
||||
|
||||
if (midx >= lidx) {
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
|
||||
midx-lidx+1);
|
||||
if (tmp->pin_count() > sig->pin_count()) {
|
||||
unsigned subnet_wid = midx-lidx+1;
|
||||
if (subnet_wid > sig->pin_count()) {
|
||||
cerr << get_line() << ": bit select out of "
|
||||
<< "range for " << sig->name() << endl;
|
||||
return sig;
|
||||
}
|
||||
|
||||
for (unsigned idx = lidx ; idx <= midx ; idx += 1)
|
||||
connect(tmp->pin(idx-lidx), sig->pin(idx));
|
||||
NetSubnet*tmp = new NetSubnet(sig, lidx, subnet_wid);
|
||||
|
||||
sig = tmp;
|
||||
|
||||
} else {
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
|
||||
lidx-midx+1);
|
||||
unsigned subnet_wid = midx-lidx+1;
|
||||
|
||||
if (tmp->pin_count() > sig->pin_count()) {
|
||||
if (subnet_wid > sig->pin_count()) {
|
||||
cerr << get_line() << ": error: "
|
||||
<< "part select out of range for "
|
||||
<< sig->name() << "." << endl;
|
||||
|
|
@ -1472,9 +1467,7 @@ NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope) const
|
|||
return sig;
|
||||
}
|
||||
|
||||
assert(tmp->pin_count() <= sig->pin_count());
|
||||
for (unsigned idx = lidx ; idx >= midx ; idx -= 1)
|
||||
connect(tmp->pin(idx-midx), sig->pin(idx));
|
||||
NetSubnet*tmp = new NetSubnet(sig, lidx, subnet_wid);
|
||||
|
||||
sig = tmp;
|
||||
}
|
||||
|
|
@ -1496,8 +1489,8 @@ NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope) const
|
|||
des->errors += 1;
|
||||
idx = 0;
|
||||
}
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(), 1);
|
||||
connect(tmp->pin(0), sig->pin(idx));
|
||||
|
||||
NetSubnet*tmp = new NetSubnet(sig, idx, 1);
|
||||
sig = tmp;
|
||||
}
|
||||
|
||||
|
|
@ -1562,24 +1555,26 @@ NetNet* PEIdent::elaborate_port(Design*des, NetScope*scope) const
|
|||
unsigned lidx = sig->sb_to_idx(lval->as_long());
|
||||
|
||||
if (midx >= lidx) {
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
|
||||
midx-lidx+1);
|
||||
if (tmp->pin_count() > sig->pin_count()) {
|
||||
unsigned part_count = midx-lidx+1;
|
||||
if (part_count > sig->pin_count()) {
|
||||
cerr << get_line() << ": bit select out of "
|
||||
<< "range for " << sig->name() << endl;
|
||||
return sig;
|
||||
}
|
||||
|
||||
NetSubnet*tmp = new NetSubnet(sig, lidx, part_count);
|
||||
for (unsigned idx = lidx ; idx <= midx ; idx += 1)
|
||||
connect(tmp->pin(idx-lidx), sig->pin(idx));
|
||||
|
||||
sig = tmp;
|
||||
|
||||
} else {
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
|
||||
lidx-midx+1);
|
||||
assert(tmp->pin_count() <= sig->pin_count());
|
||||
for (unsigned idx = lidx ; idx >= midx ; idx -= 1)
|
||||
/* XXXX Signals reversed?? */
|
||||
unsigned part_count = lidx-midx+1;
|
||||
assert(part_count <= sig->pin_count());
|
||||
|
||||
NetSubnet*tmp = new NetSubnet(sig, midx, part_count);
|
||||
for (unsigned idx = midx ; idx >= lidx ; idx -= 1)
|
||||
connect(tmp->pin(idx-midx), sig->pin(idx));
|
||||
|
||||
sig = tmp;
|
||||
|
|
@ -1602,7 +1597,7 @@ NetNet* PEIdent::elaborate_port(Design*des, NetScope*scope) const
|
|||
des->errors += 1;
|
||||
idx = 0;
|
||||
}
|
||||
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(), 1);
|
||||
NetSubnet*tmp = new NetSubnet(sig, idx, 1);
|
||||
connect(tmp->pin(0), sig->pin(idx));
|
||||
sig = tmp;
|
||||
}
|
||||
|
|
@ -1817,7 +1812,8 @@ NetNet* PETernary::elaborate_net(Design*des, NetScope*scope,
|
|||
for (unsigned idx = 0; idx < expr_sig->pin_count(); idx += 1)
|
||||
connect(log->pin(idx+1), expr_sig->pin(idx));
|
||||
|
||||
NetNet*tmp = new NetTmp(scope, scope->local_hsymbol());
|
||||
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
|
||||
NetNet::IMPLICIT, 1);
|
||||
tmp->local_flag(true);
|
||||
connect(tmp->pin(0), log->pin(0));
|
||||
des->add_node(log);
|
||||
|
|
@ -2102,6 +2098,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
|
|||
|
||||
/*
|
||||
* $Log: elab_net.cc,v $
|
||||
* Revision 1.91 2002/06/19 04:20:03 steve
|
||||
* Remove NetTmp and add NetSubnet class.
|
||||
*
|
||||
* Revision 1.90 2002/05/23 03:08:51 steve
|
||||
* Add language support for Verilog-2001 attribute
|
||||
* syntax. Hook this support into existing $attribute
|
||||
|
|
|
|||
11
elaborate.cc
11
elaborate.cc
|
|
@ -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.253 2002/06/05 03:44:25 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.254 2002/06/19 04:20:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -409,7 +409,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
|
|||
des->errors += 1;
|
||||
}
|
||||
|
||||
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
|
||||
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(sig))
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
|
@ -656,7 +656,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
|
|||
}
|
||||
|
||||
|
||||
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
|
||||
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(sig))
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
|
@ -719,7 +719,7 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
|
|||
connect(sig->pin(0), net->pin(idx));
|
||||
|
||||
// Delete excess holding signal.
|
||||
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
|
||||
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(sig))
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
|
|
@ -2464,6 +2464,9 @@ Design* elaborate(list<const char*>roots)
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.254 2002/06/19 04:20:03 steve
|
||||
* Remove NetTmp and add NetSubnet class.
|
||||
*
|
||||
* Revision 1.253 2002/06/05 03:44:25 steve
|
||||
* Add support for memory words in l-value of
|
||||
* non-blocking assignments, and remove the special
|
||||
|
|
|
|||
12
netlist.cc
12
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.cc,v 1.190 2002/06/05 03:44:25 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.191 2002/06/19 04:20:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -439,9 +439,12 @@ unsigned NetNet::get_refs() const
|
|||
}
|
||||
|
||||
|
||||
NetTmp::NetTmp(NetScope*s, const string&name, unsigned npins)
|
||||
: NetNet(s, name, IMPLICIT, npins)
|
||||
NetSubnet::NetSubnet(NetNet*sig, unsigned off, unsigned wid)
|
||||
: NetNet(sig->scope(), sig->scope()->local_hsymbol(), sig->type(), wid)
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < wid ; idx += 1)
|
||||
connect(sig->pin(idx+off), pin(idx));
|
||||
|
||||
local_flag(true);
|
||||
}
|
||||
|
||||
|
|
@ -2329,6 +2332,9 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.191 2002/06/19 04:20:03 steve
|
||||
* Remove NetTmp and add NetSubnet class.
|
||||
*
|
||||
* Revision 1.190 2002/06/05 03:44:25 steve
|
||||
* Add support for memory words in l-value of
|
||||
* non-blocking assignments, and remove the special
|
||||
|
|
|
|||
20
netlist.h
20
netlist.h
|
|
@ -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.242 2002/06/08 23:42:46 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.243 2002/06/19 04:20:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -964,17 +964,16 @@ class NetEConst : public NetExpr {
|
|||
};
|
||||
|
||||
/*
|
||||
* The NetTmp object is a network that is only used momentarily by
|
||||
* elaboration to carry links around. A completed netlist should not
|
||||
* have any of these within. This is a kind of wire, so it is NetNet
|
||||
* type. The constructor for this class also marks the NetNet as
|
||||
* local, so that it is not likely to suppress a real symbol.
|
||||
* This is a special, magical NetNet object. It represents a constant
|
||||
* bit or part select of another NetNet, so is used to return that
|
||||
* selection from elaborate function. None of these should remain once
|
||||
* the elaboration is complete.
|
||||
*/
|
||||
class NetTmp : public NetNet {
|
||||
class NetSubnet : public NetNet {
|
||||
|
||||
public:
|
||||
explicit NetTmp(NetScope*s, const string&name, unsigned npins =1);
|
||||
|
||||
explicit NetSubnet(NetNet*sig, unsigned off, unsigned wid);
|
||||
virtual void dump_net(ostream&, unsigned) const;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -2925,6 +2924,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.243 2002/06/19 04:20:03 steve
|
||||
* Remove NetTmp and add NetSubnet class.
|
||||
*
|
||||
* Revision 1.242 2002/06/08 23:42:46 steve
|
||||
* Add NetRamDq synthsesis from memory l-values.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue