Do not delete delay expressions of UDP instances.

This commit is contained in:
steve 2001-12-29 20:19:31 +00:00
parent 989e9d4d94
commit 000d187c94
3 changed files with 29 additions and 9 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: PDelays.cc,v 1.7 2001/11/22 06:20:59 steve Exp $"
#ident "$Id: PDelays.cc,v 1.8 2001/12/29 20:19:31 steve Exp $"
#endif
# include "config.h"
@ -30,14 +30,17 @@
PDelays::PDelays()
{
delete_flag_ = true;
for (unsigned idx = 0 ; idx < 3 ; idx += 1)
delay_[idx] = 0;
}
PDelays::~PDelays()
{
for (unsigned idx = 0 ; idx < 3 ; idx += 1)
delete delay_[idx];
if (delete_flag_) {
for (unsigned idx = 0 ; idx < 3 ; idx += 1)
delete delay_[idx];
}
}
void PDelays::set_delay(PExpr*del)
@ -45,15 +48,18 @@ void PDelays::set_delay(PExpr*del)
assert(del);
assert(delay_[0] == 0);
delay_[0] = del;
delete_flag_ = true;
}
void PDelays::set_delays(const svector<PExpr*>*del)
void PDelays::set_delays(const svector<PExpr*>*del, bool df)
{
assert(del);
assert(del->count() <= 3);
for (unsigned idx = 0 ; idx < del->count() ; idx += 1)
delay_[idx] = (*del)[idx];
delete_flag_ = df;
}
static unsigned long calculate_val(Design*des, const NetScope*scope,
@ -125,6 +131,9 @@ void PDelays::eval_delays(Design*des, NetScope*scope,
/*
* $Log: PDelays.cc,v $
* Revision 1.8 2001/12/29 20:19:31 steve
* Do not delete delay expressions of UDP instances.
*
* Revision 1.7 2001/11/22 06:20:59 steve
* Use NetScope instead of string for scope path.
*

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: PDelays.h,v 1.4 2001/11/22 06:20:59 steve Exp $"
#ident "$Id: PDelays.h,v 1.5 2001/12/29 20:19:31 steve Exp $"
#endif
# include "svector.h"
@ -45,8 +45,11 @@ class PDelays {
PDelays();
~PDelays();
/* Set the delay expressions. If the delete_flag is true, then
this object takes ownership of the expressions, and will
delete it in the destructor. */
void set_delay(PExpr*);
void set_delays(const svector<PExpr*>*del);
void set_delays(const svector<PExpr*>*del, bool delete_flag=true);
void eval_delays(Design*des, NetScope*scope,
unsigned long&rise_time,
@ -57,6 +60,7 @@ class PDelays {
private:
PExpr* delay_[3];
bool delete_flag_;
private: // not implemented
PDelays(const PDelays&);
@ -67,6 +71,9 @@ ostream& operator << (ostream&o, const PDelays&);
/*
* $Log: PDelays.h,v $
* Revision 1.5 2001/12/29 20:19:31 steve
* Do not delete delay expressions of UDP instances.
*
* Revision 1.4 2001/11/22 06:20:59 steve
* Use NetScope instead of string for scope 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: elaborate.cc,v 1.236 2001/12/06 05:04:49 steve Exp $"
#ident "$Id: elaborate.cc,v 1.237 2001/12/29 20:19:31 steve Exp $"
#endif
# include "config.h"
@ -668,12 +668,13 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
overrides. Correct that misconception here. */
unsigned long rise_time = 0, fall_time = 0, decay_time = 0;
if (overrides_) {
cerr << my_name << ": overrides_ = " << overrides_ << endl;
PDelays tmp_del;
tmp_del.set_delays(overrides_);
tmp_del.set_delays(overrides_, false);
tmp_del.eval_delays(des, scope, rise_time, fall_time, decay_time);
delete overrides_;
}
NetUDP*net = new NetUDP(scope, my_name, udp->ports.count(), udp);
net->set_attributes(udp->attributes);
net->rise_time(rise_time);
@ -2394,6 +2395,9 @@ Design* elaborate(list<const char*>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.237 2001/12/29 20:19:31 steve
* Do not delete delay expressions of UDP instances.
*
* Revision 1.236 2001/12/06 05:04:49 steve
* Forgot to evaluate UDP delays.
*