Fix crash when memory exploding doesnot work

This commit is contained in:
steve 2006-03-16 05:40:18 +00:00
parent aa42ec381c
commit ef8964c65a
3 changed files with 50 additions and 5 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: netlist.cc,v 1.226.2.3 2006/03/12 07:34:17 steve Exp $"
#ident "$Id: netlist.cc,v 1.226.2.4 2006/03/16 05:40:18 steve Exp $"
#endif
# include "config.h"
@ -229,7 +229,7 @@ NetNode::~NetNode()
NetNet::NetNet(NetScope*s, perm_string n, Type t, unsigned npins)
: NetObj(s, n, npins), sig_next_(0), sig_prev_(0),
type_(t), port_type_(NOT_A_PORT), signed_(false), msb_(npins-1), lsb_(0),
local_flag_(false), eref_count_(0), lref_count_(0)
local_flag_(false), eref_count_(0), lref_count_(0), mref_(0)
{
assert(s);
@ -270,7 +270,7 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t, long ms, long ls)
: NetObj(s, n, ((ms>ls)?ms-ls:ls-ms) + 1),
sig_next_(0), sig_prev_(0), type_(t),
port_type_(NOT_A_PORT), signed_(false), msb_(ms), lsb_(ls),
local_flag_(false), eref_count_(0), lref_count_(0)
local_flag_(false), eref_count_(0), lref_count_(0), mref_(0)
{
assert(s);
@ -322,6 +322,14 @@ NetNet::~NetNet()
dump_net(cerr, 4);
}
assert(lref_count_ == 0);
if (mref_ != 0) {
cerr << get_line() << ": internal error: attempt to delete "
<< "signal ``" << name() << "'' which has "
<< "memory explode references." << endl;
dump_net(cerr, 4);
}
assert(mref_ == 0);
if (scope())
scope()->rem_signal(this);
@ -462,6 +470,23 @@ unsigned NetNet::get_refs() const
return lref_count_ + eref_count_;
}
void NetNet::mref(NetMemory*mem)
{
assert(mref_ == 0);
assert(mem != 0);
mref_ = mem;
}
NetMemory*NetNet::mref()
{
return mref_;
}
const NetMemory* NetNet::mref() const
{
return mref_;
}
NetSubnet::NetSubnet(NetNet*sig, unsigned off, unsigned wid)
: NetNet(sig->scope(), sig->scope()->local_symbol(), sig->type(), wid)
@ -2103,6 +2128,7 @@ NetNet* NetMemory::explode_to_reg()
return explode_;
explode_ = new NetNet(scope_, name_, NetNet::REG, count()*width_);
explode_->mref(this);
return explode_;
}
@ -2362,6 +2388,9 @@ const NetProc*NetTaskDef::proc() const
/*
* $Log: netlist.cc,v $
* Revision 1.226.2.4 2006/03/16 05:40:18 steve
* Fix crash when memory exploding doesnot work
*
* Revision 1.226.2.3 2006/03/12 07:34:17 steve
* Fix the memsynth1 case.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: netlist.h,v 1.321.2.11 2006/03/12 07:34:17 steve Exp $"
#ident "$Id: netlist.h,v 1.321.2.12 2006/03/16 05:40:18 steve Exp $"
#endif
/*
@ -48,6 +48,7 @@ class ostream;
class Design;
class Link;
class Nexus;
class NetMemory;
class NetNode;
class NetProc;
class NetProcTop;
@ -434,6 +435,11 @@ class NetNet : public NetObj {
unsigned get_refs() const;
/* This may be and explode of a memory. */
void mref(NetMemory*ref);
NetMemory*mref();
const NetMemory*mref() const;
virtual void dump_net(ostream&, unsigned) const;
private:
@ -458,6 +464,7 @@ class NetNet : public NetObj {
bool local_flag_;
unsigned eref_count_;
unsigned lref_count_;
NetMemory*mref_;
};
/*
@ -3456,6 +3463,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.321.2.12 2006/03/16 05:40:18 steve
* Fix crash when memory exploding doesnot work
*
* Revision 1.321.2.11 2006/03/12 07:34:17 steve
* Fix the memsynth1 case.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: nodangle.cc,v 1.21 2004/02/20 18:53:35 steve Exp $"
#ident "$Id: nodangle.cc,v 1.21.2.1 2006/03/16 05:40:19 steve Exp $"
#endif
# include "config.h"
@ -109,6 +109,9 @@ void nodangle_f::signal(Design*des, NetNet*sig)
if (sig->get_refs() > 0)
return;
if (sig->mref())
return;
/* Cannot delete the ports of tasks or functions. There are
too many places where they are referenced. */
if ((sig->port_type() != NetNet::NOT_A_PORT)
@ -205,6 +208,9 @@ void nodangle(Design*des)
/*
* $Log: nodangle.cc,v $
* Revision 1.21.2.1 2006/03/16 05:40:19 steve
* Fix crash when memory exploding doesnot work
*
* Revision 1.21 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*