diff --git a/design_dump.cc b/design_dump.cc index 38de69c4a..7d06a673c 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #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 # include "config.h" @@ -916,11 +916,24 @@ void NetScope::dump(ostream&o) const } // Dump specparams - typedef map::const_iterator specparam_it_t; + typedef map::const_iterator specparam_it_t; for (specparam_it_t cur = specparams.begin() ; cur != specparams.end() ; cur ++ ) { 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 << ""; + break; + } + o << endl; } switch (type_) { @@ -1216,6 +1229,9 @@ void Design::dump(ostream&o) const /* * $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 * Missing PSpec.cc file. * diff --git a/elab_expr.cc b/elab_expr.cc index e8802a7c1..9fb49a272 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #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 # include "config.h" @@ -674,12 +674,23 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope, // specify blocks are disabled. if (gn_specify_blocks_flag) { - map::const_iterator specp; + map::const_iterator specp; perm_string key = perm_string::literal(path_.peek_name(0)); if (path_.component_count() == 1 && ((specp = scope->specparams.find(key)) != scope->specparams.end())) { - verinum val ((*specp).second); - NetEConst*tmp = new NetEConst(val); + NetScope::spec_val_t value = (*specp).second; + 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); return tmp; } @@ -1416,6 +1427,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, /* * $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 * Support selective control of specify and xtypes features. * diff --git a/elaborate.cc b/elaborate.cc index 9433b4a61..4c9492b1a 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #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 # include "config.h" @@ -2887,13 +2887,22 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const if (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) { PExpr*exp = delays[idx]; NetExpr*cur = elab_and_eval(des, scope, exp, 0); if (NetEConst*cur_con = dynamic_cast (cur)) { 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(cur)) { + delay_value[idx] = cur_rcon->value().as_long(shift); + } else { cerr << get_line() << ": error: Path delay value " << "must be constant." << endl; @@ -2994,21 +3003,38 @@ bool Module::elaborate(Design*des, NetScope*scope) const ; cur != specparams.end() ; cur ++ ) { NetExpr*val = elab_and_eval(des, scope, (*cur).second, -1); - NetEConst*val_c = dynamic_cast (val); - if (! val_c ) { + NetScope::spec_val_t value; + + if (NetECReal*val_c = dynamic_cast (val)) { + + value.type = IVL_VT_REAL; + value.real_val = val_c->value().as_double(); + + if (debug_elaborate) + cerr << get_line() << ": debug: Elaborate " + << "specparam " << (*cur).first + << " value=" << value.real_val << endl; + + } else if (NetEConst*val_c = dynamic_cast (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; - continue; } - scope->specparams[(*cur).first] = val_c->value().as_long(); - - if (debug_elaborate) - cerr << get_line() << ": debug: Elaborate " - << "specparam " << (*cur).first - << " value=" << val_c->value().as_long() << endl; + assert(val); + delete val; + scope->specparams[(*cur).first] = value; } @@ -3284,6 +3310,9 @@ Design* elaborate(listroots) /* * $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 * Support selective control of specify and xtypes features. * diff --git a/netlist.h b/netlist.h index 5d1d94424..3eee11d66 100644 --- a/netlist.h +++ b/netlist.h @@ -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.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 /* @@ -3369,7 +3369,15 @@ class NetScope : public Attrib { }; mapparameters; maplocalparams; - mapspecparams; + + struct spec_val_t { + ivl_variable_type_t type; + union { + double real_val; // type == IVL_VT_REAL + long integer; // type == IVL_VT_BOOL + }; + }; + mapspecparams; /* Module instance arrays are collected here for access during the multiple elaboration passes. */ @@ -3559,6 +3567,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $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 * Missing PSpec.cc file. * diff --git a/verireal.cc b/verireal.cc index 575132b18..e88c8bd25 100644 --- a/verireal.cc +++ b/verireal.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #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 # include "config.h" @@ -56,6 +56,11 @@ verireal::verireal(long val) value_ = (double)val; } +verireal::verireal(double val) +{ + value_ = val; +} + verireal::~verireal() { } @@ -156,6 +161,9 @@ ostream& operator<< (ostream&out, const verireal&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 * Handle 64bit delay constants. * diff --git a/verireal.h b/verireal.h index caf355ab0..3874f585e 100644 --- a/verireal.h +++ b/verireal.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #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 #ifdef HAVE_IOSFWD @@ -58,6 +58,7 @@ class verireal { explicit verireal(); explicit verireal(const char*text); explicit verireal(long val); + explicit verireal(double val); ~verireal(); /* Return the value of the floating point number as an @@ -85,6 +86,9 @@ extern verireal operator- (const verireal&); /* * $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 * Handle 64bit delay constants. *