elaborate rise/fall/decay for continuous assign.

This commit is contained in:
steve
1999-08-01 21:18:55 +00:00
parent 71d35f32b2
commit dd8daf40df
4 changed files with 138 additions and 65 deletions
+53 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999 Stephen Williams (steve@picturel.com)
* Copyright (c) 1999 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -17,11 +17,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: PGate.cc,v 1.2 1999/08/01 16:34:50 steve Exp $"
#ident "$Id: PGate.cc,v 1.3 1999/08/01 21:18:55 steve Exp $"
#endif
# include "PGate.h"
# include "PExpr.h"
# include "verinum.h"
# include <assert.h>
PGate::PGate(const string&name,
@@ -63,10 +64,54 @@ PGate::~PGate()
delete delay_[idx];
}
const PExpr* PGate::get_delay(unsigned idx) const
/*
* This method is used during elaboration to calculate the
* rise/fall/decay times for the gate. These values were set in pform
* by the constructor, so here I evaluate the expression in the given
* design context and save the calculated delays into the output
* parameters. This method understands how to handle the different
* numbers of expressions.
*/
void PGate::eval_delays(Design*des, const string&path,
unsigned long&rise_time,
unsigned long&fall_time,
unsigned long&decay_time) const
{
assert(idx < 3);
return delay_[idx];
verinum*dv;
if (delay_[0]) {
dv = delay_[0]->eval_const(des, path);
assert(dv);
rise_time = dv->as_ulong();
delete dv;
if (delay_[1]) {
dv = delay_[1]->eval_const(des, path);
assert(dv);
fall_time = dv->as_ulong();
delete dv;
if (delay_[2]) {
dv = delay_[2]->eval_const(des, path);
assert(dv);
decay_time = dv->as_ulong();
delete dv;
} else {
if (rise_time < fall_time)
decay_time = rise_time;
else
decay_time = fall_time;
}
} else {
assert(delay_[2] == 0);
fall_time = rise_time;
decay_time = rise_time;
}
} else {
rise_time = 0;
fall_time = 0;
decay_time = 0;
}
}
PGAssign::PGAssign(svector<PExpr*>*pins)
@@ -115,6 +160,9 @@ void PGBuiltin::set_range(PExpr*msb, PExpr*lsb)
/*
* $Log: PGate.cc,v $
* Revision 1.3 1999/08/01 21:18:55 steve
* elaborate rise/fall/decay for continuous assign.
*
* Revision 1.2 1999/08/01 16:34:50 steve
* Parse and elaborate rise/fall/decay times
* for gates, and handle the rules for partial