Handle real valued literals in net contexts.

This commit is contained in:
steve 2006-07-08 21:48:46 +00:00
parent 5348ac14a5
commit ed70db84ce
2 changed files with 34 additions and 6 deletions

View File

@ -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: PDelays.cc,v 1.14 2006/06/02 04:48:49 steve Exp $" #ident "$Id: PDelays.cc,v 1.15 2006/07/08 21:48:46 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -115,6 +115,12 @@ static NetExpr* make_delay_nets(Design*des, NetExpr*expr)
return expr; return expr;
NetNet*sig = expr->synthesize(des); NetNet*sig = expr->synthesize(des);
if (sig == 0) {
cerr << expr->get_line() << ": error: Expression " << *expr
<< " is not suitable for delay expression." << endl;
return 0;
}
expr = new NetESignal(sig); expr = new NetESignal(sig);
return expr; return expr;
} }
@ -163,6 +169,9 @@ void PDelays::eval_delays(Design*des, NetScope*scope,
/* /*
* $Log: PDelays.cc,v $ * $Log: PDelays.cc,v $
* Revision 1.15 2006/07/08 21:48:46 steve
* Handle real valued literals in net contexts.
*
* Revision 1.14 2006/06/02 04:48:49 steve * Revision 1.14 2006/06/02 04:48:49 steve
* Make elaborate_expr methods aware of the width that the context * Make elaborate_expr methods aware of the width that the context
* requires of it. In the process, fix sizing of the width of unary * requires of it. In the process, fix sizing of the width of unary

View File

@ -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: expr_synth.cc,v 1.77 2006/05/01 20:47:59 steve Exp $" #ident "$Id: expr_synth.cc,v 1.78 2006/07/08 21:48:46 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -564,12 +564,28 @@ NetNet* NetEConst::synthesize(Design*des)
return osig; return osig;
} }
/*
* Create a NetLiteral object to represent real valued constants.
*/
NetNet* NetECReal::synthesize(Design*des) NetNet* NetECReal::synthesize(Design*des)
{ {
cerr << get_line() << ": error: Real constants are " NetScope*scope = des->find_root_scope();
<< "not synthesizable." << endl; assert(scope);
des->errors += 1;
return 0; perm_string path = scope->local_symbol();
NetNet*osig = new NetNet(scope, path, NetNet::WIRE, 1);
osig->local_flag(true);
osig->data_type(IVL_VT_REAL);
osig->set_signed(has_sign());
osig->set_line(*this);
NetLiteral*con = new NetLiteral(scope, scope->local_symbol(), value_);
des->add_node(con);
con->set_line(*this);
connect(osig->pin(0), con->pin(0));
return osig;
} }
/* /*
@ -866,6 +882,9 @@ NetNet* NetESignal::synthesize(Design*des)
/* /*
* $Log: expr_synth.cc,v $ * $Log: expr_synth.cc,v $
* Revision 1.78 2006/07/08 21:48:46 steve
* Handle real valued literals in net contexts.
*
* Revision 1.77 2006/05/01 20:47:59 steve * Revision 1.77 2006/05/01 20:47:59 steve
* More explicit datatype setup. * More explicit datatype setup.
* *