Support real valued specify delays, properly scaled.
This commit is contained in:
parent
cbe1a6a3ca
commit
69cd007a71
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: design_dump.cc,v 1.169 2006/09/26 19:48:40 steve Exp $"
|
#ident "$Id: design_dump.cc,v 1.170 2006/10/03 05:06:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -916,11 +916,24 @@ void NetScope::dump(ostream&o) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump specparams
|
// Dump specparams
|
||||||
typedef map<perm_string,long>::const_iterator specparam_it_t;
|
typedef map<perm_string,spec_val_t>::const_iterator specparam_it_t;
|
||||||
for (specparam_it_t cur = specparams.begin()
|
for (specparam_it_t cur = specparams.begin()
|
||||||
; cur != specparams.end() ; cur ++ ) {
|
; cur != specparams.end() ; cur ++ ) {
|
||||||
o << " specparam " << (*cur).first
|
o << " specparam " << (*cur).first
|
||||||
<< " = " << (*cur).second << endl;
|
<< " = ";
|
||||||
|
spec_val_t value = (*cur).second;
|
||||||
|
switch (value.type) {
|
||||||
|
case IVL_VT_REAL:
|
||||||
|
o << "R:" << value.real_val;
|
||||||
|
break;
|
||||||
|
case IVL_VT_BOOL:
|
||||||
|
o << "I:" << value.integer;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
o << "<bad type>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
o << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
|
|
@ -1216,6 +1229,9 @@ void Design::dump(ostream&o) const
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: design_dump.cc,v $
|
* $Log: design_dump.cc,v $
|
||||||
|
* Revision 1.170 2006/10/03 05:06:00 steve
|
||||||
|
* Support real valued specify delays, properly scaled.
|
||||||
|
*
|
||||||
* Revision 1.169 2006/09/26 19:48:40 steve
|
* Revision 1.169 2006/09/26 19:48:40 steve
|
||||||
* Missing PSpec.cc file.
|
* Missing PSpec.cc file.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
22
elab_expr.cc
22
elab_expr.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: elab_expr.cc,v 1.111 2006/09/28 04:35:18 steve Exp $"
|
#ident "$Id: elab_expr.cc,v 1.112 2006/10/03 05:06:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -674,12 +674,23 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
||||||
// specify blocks are disabled.
|
// specify blocks are disabled.
|
||||||
|
|
||||||
if (gn_specify_blocks_flag) {
|
if (gn_specify_blocks_flag) {
|
||||||
map<perm_string,long>::const_iterator specp;
|
map<perm_string,NetScope::spec_val_t>::const_iterator specp;
|
||||||
perm_string key = perm_string::literal(path_.peek_name(0));
|
perm_string key = perm_string::literal(path_.peek_name(0));
|
||||||
if (path_.component_count() == 1
|
if (path_.component_count() == 1
|
||||||
&& ((specp = scope->specparams.find(key)) != scope->specparams.end())) {
|
&& ((specp = scope->specparams.find(key)) != scope->specparams.end())) {
|
||||||
verinum val ((*specp).second);
|
NetScope::spec_val_t value = (*specp).second;
|
||||||
NetEConst*tmp = new NetEConst(val);
|
NetExpr*tmp;
|
||||||
|
switch (value.type) {
|
||||||
|
case IVL_VT_BOOL:
|
||||||
|
tmp = new NetEConst(verinum(value.integer));
|
||||||
|
break;
|
||||||
|
case IVL_VT_REAL:
|
||||||
|
tmp = new NetECReal(verireal(value.real_val));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
assert(tmp);
|
||||||
tmp->set_line(*this);
|
tmp->set_line(*this);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
@ -1416,6 +1427,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elab_expr.cc,v $
|
* $Log: elab_expr.cc,v $
|
||||||
|
* Revision 1.112 2006/10/03 05:06:00 steve
|
||||||
|
* Support real valued specify delays, properly scaled.
|
||||||
|
*
|
||||||
* Revision 1.111 2006/09/28 04:35:18 steve
|
* Revision 1.111 2006/09/28 04:35:18 steve
|
||||||
* Support selective control of specify and xtypes features.
|
* Support selective control of specify and xtypes features.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
53
elaborate.cc
53
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: elaborate.cc,v 1.345 2006/09/28 04:35:18 steve Exp $"
|
#ident "$Id: elaborate.cc,v 1.346 2006/10/03 05:06:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -2887,13 +2887,22 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
|
||||||
if (ndelays > 12)
|
if (ndelays > 12)
|
||||||
ndelays = 12;
|
ndelays = 12;
|
||||||
|
|
||||||
/* Elaborate the delay values themselves. */
|
int shift = scope->time_unit() - des->get_precision();
|
||||||
|
|
||||||
|
/* Elaborate the delay values themselves. Remember to scale
|
||||||
|
them for the timescale/precision of the scope. */
|
||||||
for (unsigned idx = 0 ; idx < ndelays ; idx += 1) {
|
for (unsigned idx = 0 ; idx < ndelays ; idx += 1) {
|
||||||
PExpr*exp = delays[idx];
|
PExpr*exp = delays[idx];
|
||||||
NetExpr*cur = elab_and_eval(des, scope, exp, 0);
|
NetExpr*cur = elab_and_eval(des, scope, exp, 0);
|
||||||
|
|
||||||
if (NetEConst*cur_con = dynamic_cast<NetEConst*> (cur)) {
|
if (NetEConst*cur_con = dynamic_cast<NetEConst*> (cur)) {
|
||||||
delay_value[idx] = cur_con->value().as_ulong();
|
delay_value[idx] = cur_con->value().as_ulong();
|
||||||
|
for (int tmp = 0 ; tmp < shift ; tmp += 1)
|
||||||
|
delay_value[idx] *= 10;
|
||||||
|
|
||||||
|
} else if (NetECReal*cur_rcon = dynamic_cast<NetECReal*>(cur)) {
|
||||||
|
delay_value[idx] = cur_rcon->value().as_long(shift);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cerr << get_line() << ": error: Path delay value "
|
cerr << get_line() << ": error: Path delay value "
|
||||||
<< "must be constant." << endl;
|
<< "must be constant." << endl;
|
||||||
|
|
@ -2994,21 +3003,38 @@ bool Module::elaborate(Design*des, NetScope*scope) const
|
||||||
; cur != specparams.end() ; cur ++ ) {
|
; cur != specparams.end() ; cur ++ ) {
|
||||||
|
|
||||||
NetExpr*val = elab_and_eval(des, scope, (*cur).second, -1);
|
NetExpr*val = elab_and_eval(des, scope, (*cur).second, -1);
|
||||||
NetEConst*val_c = dynamic_cast<NetEConst*> (val);
|
NetScope::spec_val_t value;
|
||||||
if (! val_c ) {
|
|
||||||
cerr << (*cur).second->get_line() << ": error: "
|
|
||||||
<< "specparam " << (*cur).first << " value"
|
|
||||||
<< " is not constant: " << *val << endl;
|
|
||||||
des->errors += 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
scope->specparams[(*cur).first] = val_c->value().as_long();
|
if (NetECReal*val_c = dynamic_cast<NetECReal*> (val)) {
|
||||||
|
|
||||||
|
value.type = IVL_VT_REAL;
|
||||||
|
value.real_val = val_c->value().as_double();
|
||||||
|
|
||||||
if (debug_elaborate)
|
if (debug_elaborate)
|
||||||
cerr << get_line() << ": debug: Elaborate "
|
cerr << get_line() << ": debug: Elaborate "
|
||||||
<< "specparam " << (*cur).first
|
<< "specparam " << (*cur).first
|
||||||
<< " value=" << val_c->value().as_long() << endl;
|
<< " value=" << value.real_val << endl;
|
||||||
|
|
||||||
|
} else if (NetEConst*val_c = dynamic_cast<NetEConst*> (val)) {
|
||||||
|
|
||||||
|
value.type = IVL_VT_BOOL;
|
||||||
|
value.integer = val_c->value().as_long();
|
||||||
|
|
||||||
|
if (debug_elaborate)
|
||||||
|
cerr << get_line() << ": debug: Elaborate "
|
||||||
|
<< "specparam " << (*cur).first
|
||||||
|
<< " value=" << value.integer << endl;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cerr << (*cur).second->get_line() << ": error: "
|
||||||
|
<< "specparam " << (*cur).first << " value"
|
||||||
|
<< " is not constant: " << *val << endl;
|
||||||
|
des->errors += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(val);
|
||||||
|
delete val;
|
||||||
|
scope->specparams[(*cur).first] = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3284,6 +3310,9 @@ Design* elaborate(list<perm_string>roots)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elaborate.cc,v $
|
* $Log: elaborate.cc,v $
|
||||||
|
* Revision 1.346 2006/10/03 05:06:00 steve
|
||||||
|
* Support real valued specify delays, properly scaled.
|
||||||
|
*
|
||||||
* Revision 1.345 2006/09/28 04:35:18 steve
|
* Revision 1.345 2006/09/28 04:35:18 steve
|
||||||
* Support selective control of specify and xtypes features.
|
* Support selective control of specify and xtypes features.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
15
netlist.h
15
netlist.h
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: netlist.h,v 1.362 2006/09/26 19:48:40 steve Exp $"
|
#ident "$Id: netlist.h,v 1.363 2006/10/03 05:06:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -3369,7 +3369,15 @@ class NetScope : public Attrib {
|
||||||
};
|
};
|
||||||
map<perm_string,param_expr_t>parameters;
|
map<perm_string,param_expr_t>parameters;
|
||||||
map<perm_string,param_expr_t>localparams;
|
map<perm_string,param_expr_t>localparams;
|
||||||
map<perm_string,long>specparams;
|
|
||||||
|
struct spec_val_t {
|
||||||
|
ivl_variable_type_t type;
|
||||||
|
union {
|
||||||
|
double real_val; // type == IVL_VT_REAL
|
||||||
|
long integer; // type == IVL_VT_BOOL
|
||||||
|
};
|
||||||
|
};
|
||||||
|
map<perm_string,spec_val_t>specparams;
|
||||||
|
|
||||||
/* Module instance arrays are collected here for access during
|
/* Module instance arrays are collected here for access during
|
||||||
the multiple elaboration passes. */
|
the multiple elaboration passes. */
|
||||||
|
|
@ -3559,6 +3567,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netlist.h,v $
|
* $Log: netlist.h,v $
|
||||||
|
* Revision 1.363 2006/10/03 05:06:00 steve
|
||||||
|
* Support real valued specify delays, properly scaled.
|
||||||
|
*
|
||||||
* Revision 1.362 2006/09/26 19:48:40 steve
|
* Revision 1.362 2006/09/26 19:48:40 steve
|
||||||
* Missing PSpec.cc file.
|
* Missing PSpec.cc file.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
10
verireal.cc
10
verireal.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: verireal.cc,v 1.17 2006/08/08 05:11:37 steve Exp $"
|
#ident "$Id: verireal.cc,v 1.18 2006/10/03 05:06:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -56,6 +56,11 @@ verireal::verireal(long val)
|
||||||
value_ = (double)val;
|
value_ = (double)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verireal::verireal(double val)
|
||||||
|
{
|
||||||
|
value_ = val;
|
||||||
|
}
|
||||||
|
|
||||||
verireal::~verireal()
|
verireal::~verireal()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -156,6 +161,9 @@ ostream& operator<< (ostream&out, const verireal&v)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: verireal.cc,v $
|
* $Log: verireal.cc,v $
|
||||||
|
* Revision 1.18 2006/10/03 05:06:00 steve
|
||||||
|
* Support real valued specify delays, properly scaled.
|
||||||
|
*
|
||||||
* Revision 1.17 2006/08/08 05:11:37 steve
|
* Revision 1.17 2006/08/08 05:11:37 steve
|
||||||
* Handle 64bit delay constants.
|
* Handle 64bit delay constants.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: verireal.h,v 1.13 2006/08/08 05:11:37 steve Exp $"
|
#ident "$Id: verireal.h,v 1.14 2006/10/03 05:06:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IOSFWD
|
#ifdef HAVE_IOSFWD
|
||||||
|
|
@ -58,6 +58,7 @@ class verireal {
|
||||||
explicit verireal();
|
explicit verireal();
|
||||||
explicit verireal(const char*text);
|
explicit verireal(const char*text);
|
||||||
explicit verireal(long val);
|
explicit verireal(long val);
|
||||||
|
explicit verireal(double val);
|
||||||
~verireal();
|
~verireal();
|
||||||
|
|
||||||
/* Return the value of the floating point number as an
|
/* Return the value of the floating point number as an
|
||||||
|
|
@ -85,6 +86,9 @@ extern verireal operator- (const verireal&);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: verireal.h,v $
|
* $Log: verireal.h,v $
|
||||||
|
* Revision 1.14 2006/10/03 05:06:00 steve
|
||||||
|
* Support real valued specify delays, properly scaled.
|
||||||
|
*
|
||||||
* Revision 1.13 2006/08/08 05:11:37 steve
|
* Revision 1.13 2006/08/08 05:11:37 steve
|
||||||
* Handle 64bit delay constants.
|
* Handle 64bit delay constants.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue