Constant concat operands are self determined
distinguish between self-determined and value-preserving when evaluating constants that are arguments to concatenations. Signed-off-by: Stephen Williams <steve@icarus.com>
This commit is contained in:
parent
f46be09914
commit
3b94c122b7
12
elab_expr.cc
12
elab_expr.cc
|
|
@ -558,6 +558,11 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope,
|
|||
{
|
||||
NetExpr* repeat = 0;
|
||||
|
||||
if (debug_elaborate) {
|
||||
cerr << get_line() << ": debug: Elaborate expr=" << *this
|
||||
<< ", expr_wid=" << expr_wid << endl;
|
||||
}
|
||||
|
||||
/* If there is a repeat expression, then evaluate the constant
|
||||
value and set the repeat count. */
|
||||
if (repeat_) {
|
||||
|
|
@ -593,7 +598,7 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope,
|
|||
}
|
||||
|
||||
assert(parms_[idx]);
|
||||
NetExpr*ex = elab_and_eval(des, scope, parms_[idx], -1);
|
||||
NetExpr*ex = elab_and_eval(des, scope, parms_[idx], 0, 0);
|
||||
if (ex == 0) continue;
|
||||
|
||||
ex->set_line(*parms_[idx]);
|
||||
|
|
@ -1760,8 +1765,3 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
|
|||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: elab_expr.cc,v $
|
||||
*/
|
||||
|
||||
|
|
|
|||
120
eval_tree.cc
120
eval_tree.cc
|
|
@ -128,6 +128,21 @@ NetExpr* NetEBAdd::eval_tree(int prune_to_width)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Result might have known width. */
|
||||
if (has_width()) {
|
||||
if (debug_eval_tree) {
|
||||
cerr << get_line() << ": debug: Evaluate expr=" << *this
|
||||
<< " --- prune=" << prune_to_width << endl;
|
||||
}
|
||||
unsigned lwid = lc->expr_width();
|
||||
unsigned rwid = rc->expr_width();
|
||||
unsigned wid = (rwid > lwid) ? rwid : lwid;
|
||||
if (prune_to_width < 0)
|
||||
wid += 1;
|
||||
verinum val2=verinum(val,wid);
|
||||
val=val2;
|
||||
}
|
||||
|
||||
return new NetEConst(val);
|
||||
}
|
||||
|
||||
|
|
@ -1104,6 +1119,11 @@ NetEConst* NetEConcat::eval_tree(int prune_to_width)
|
|||
unsigned repeat_val = repeat();
|
||||
unsigned local_errors = 0;
|
||||
|
||||
if (debug_eval_tree) {
|
||||
cerr << get_line() << ": debug: Evaluate expr=" << *this
|
||||
<< ", prune_to_width=" << prune_to_width << endl;
|
||||
}
|
||||
|
||||
unsigned gap = 0;
|
||||
for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1) {
|
||||
|
||||
|
|
@ -1124,7 +1144,7 @@ NetEConst* NetEConcat::eval_tree(int prune_to_width)
|
|||
// that is here. If I succeed, reset the parameter to
|
||||
// the evaluated value.
|
||||
assert(parms_[idx]);
|
||||
NetExpr*expr = parms_[idx]->eval_tree();
|
||||
NetExpr*expr = parms_[idx]->eval_tree(0);
|
||||
if (expr) {
|
||||
delete parms_[idx];
|
||||
parms_[idx] = expr;
|
||||
|
|
@ -1652,101 +1672,3 @@ NetEConst* NetEUReduce::eval_tree(int prune_to_width)
|
|||
return new NetEConst(verinum(res, 1));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: eval_tree.cc,v $
|
||||
* Revision 1.77 2007/06/02 03:42:12 steve
|
||||
* Properly evaluate scope path expressions.
|
||||
*
|
||||
* Revision 1.76 2007/05/31 18:36:06 steve
|
||||
* Fix warning (ldolittle)
|
||||
*
|
||||
* Revision 1.75 2007/04/07 04:46:18 steve
|
||||
* Handle evaluate of addition of real valued constants.
|
||||
*
|
||||
* Revision 1.74 2007/03/08 05:30:02 steve
|
||||
* Limit the calculated widths of constants.
|
||||
*
|
||||
* Revision 1.73 2007/01/16 05:44:15 steve
|
||||
* Major rework of array handling. Memories are replaced with the
|
||||
* more general concept of arrays. The NetMemory and NetEMemory
|
||||
* classes are removed from the ivl core program, and the IVL_LPM_RAM
|
||||
* lpm type is removed from the ivl_target API.
|
||||
*
|
||||
* Revision 1.72 2006/11/04 06:16:27 steve
|
||||
* Fix padding of constant eval of NetESelect.
|
||||
*
|
||||
* Revision 1.71 2006/10/30 05:44:49 steve
|
||||
* Expression widths with unsized literals are pseudo-infinite width.
|
||||
*
|
||||
* Revision 1.70 2006/09/19 23:00:15 steve
|
||||
* Use elab_and_eval for bit select expressions.
|
||||
*
|
||||
* Revision 1.69 2006/07/31 03:50:17 steve
|
||||
* Add support for power in constant expressions.
|
||||
*
|
||||
* Revision 1.68 2006/03/18 22:52:27 steve
|
||||
* Properly handle signedness in compare.
|
||||
*
|
||||
* Revision 1.67 2005/11/27 05:56:20 steve
|
||||
* Handle bit select of parameter with ranges.
|
||||
*
|
||||
* Revision 1.66 2005/11/10 13:28:12 steve
|
||||
* Reorganize signal part select handling, and add support for
|
||||
* indexed part selects.
|
||||
*
|
||||
* Expand expression constant propagation to eliminate extra
|
||||
* sums in certain cases.
|
||||
*
|
||||
* Revision 1.65 2005/09/14 02:53:14 steve
|
||||
* Support bool expressions and compares handle them optimally.
|
||||
*
|
||||
* Revision 1.64 2005/07/11 16:56:50 steve
|
||||
* Remove NetVariable and ivl_variable_t structures.
|
||||
*
|
||||
* Revision 1.63 2005/06/17 05:05:53 steve
|
||||
* Watch out for signed constants in magnitude compare.
|
||||
*
|
||||
* Revision 1.62 2004/10/04 01:10:53 steve
|
||||
* Clean up spurious trailing white space.
|
||||
*
|
||||
* Revision 1.61 2004/09/10 23:51:42 steve
|
||||
* Fix the evaluation of constant ternary expressions.
|
||||
*
|
||||
* Revision 1.60 2004/02/20 06:22:56 steve
|
||||
* parameter keys are per_strings.
|
||||
*
|
||||
* Revision 1.59 2003/10/31 02:47:11 steve
|
||||
* NetEUReduce has its own dup_expr method.
|
||||
*
|
||||
* Revision 1.58 2003/10/26 04:54:56 steve
|
||||
* Support constant evaluation of binary ^ operator.
|
||||
*
|
||||
* Revision 1.57 2003/09/04 01:52:50 steve
|
||||
* Evaluate real parameter expressions that contain real parameters.
|
||||
*
|
||||
* Revision 1.56 2003/08/01 02:12:30 steve
|
||||
* Fix || with true case on the right.
|
||||
*
|
||||
* Revision 1.55 2003/06/24 01:38:02 steve
|
||||
* Various warnings fixed.
|
||||
*
|
||||
* Revision 1.54 2003/06/05 04:28:24 steve
|
||||
* Evaluate <= with real operands.
|
||||
*
|
||||
* Revision 1.53 2003/06/04 01:26:17 steve
|
||||
* internal error for <= expression errors.
|
||||
*
|
||||
* Revision 1.52 2003/05/30 02:55:32 steve
|
||||
* Support parameters in real expressions and
|
||||
* as real expressions, and fix multiply and
|
||||
* divide with real results.
|
||||
*
|
||||
* Revision 1.51 2003/04/15 05:06:56 steve
|
||||
* Handle real constants evaluation > and >=.
|
||||
*
|
||||
* Revision 1.50 2003/04/14 03:40:21 steve
|
||||
* Make some effort to preserve bits while
|
||||
* operating on constant values.
|
||||
*/
|
||||
|
||||
|
|
|
|||
260
netlist.h
260
netlist.h
|
|
@ -1122,7 +1122,11 @@ class NetExpr : public LineInfo {
|
|||
// constants.
|
||||
//
|
||||
// The prune_to_width is the maximum width that the result
|
||||
// should be. If it is -1, then do not prune the result.
|
||||
// should be. If it is 0 or -1, then do not prune the
|
||||
// result. If it is -1, go through special efforts to preserve
|
||||
// values that may expand. A width of 0 corresponds to a
|
||||
// self-determined context, and a width of -1 corresponds to
|
||||
// an infinitely wide context.
|
||||
virtual NetExpr*eval_tree(int prune_to_width = -1);
|
||||
|
||||
// Make a duplicate of myself, and subexpressions if I have
|
||||
|
|
@ -3505,257 +3509,3 @@ inline __ScopePathManip scope_path(const NetScope*scope)
|
|||
|
||||
extern ostream& operator << (ostream&o, __ScopePathManip);
|
||||
|
||||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.380 2007/06/02 03:42:13 steve
|
||||
* Properly evaluate scope path expressions.
|
||||
*
|
||||
* Revision 1.379 2007/05/24 04:07:12 steve
|
||||
* Rework the heirarchical identifier parse syntax and pform
|
||||
* to handle more general combinations of heirarch and bit selects.
|
||||
*
|
||||
* Revision 1.378 2007/04/26 03:06:22 steve
|
||||
* Rework hname_t to use perm_strings.
|
||||
*
|
||||
* Revision 1.377 2007/04/17 04:34:23 steve
|
||||
* Fix handling calls to tasks in combinational always block
|
||||
*
|
||||
* Revision 1.376 2007/04/07 04:46:18 steve
|
||||
* Handle evaluate of addition of real valued constants.
|
||||
*
|
||||
* Revision 1.375 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.374 2007/03/26 18:17:50 steve
|
||||
* Remove pretense of general use for t_cookie.
|
||||
*
|
||||
* Revision 1.373 2007/03/22 16:08:16 steve
|
||||
* Spelling fixes from Larry
|
||||
*
|
||||
* Revision 1.372 2007/03/08 05:30:03 steve
|
||||
* Limit the calculated widths of constants.
|
||||
*
|
||||
* Revision 1.371 2007/03/02 06:13:22 steve
|
||||
* Add support for edge sensitive spec paths.
|
||||
*
|
||||
* Revision 1.370 2007/03/01 06:19:38 steve
|
||||
* Add support for conditional specify delay paths.
|
||||
*
|
||||
* Revision 1.369 2007/02/20 05:58:36 steve
|
||||
* Handle unary minus of real valued expressions.
|
||||
*
|
||||
* Revision 1.368 2007/02/14 05:59:46 steve
|
||||
* Handle type of ternary expressions properly.
|
||||
*
|
||||
* Revision 1.367 2007/02/02 04:33:00 steve
|
||||
* Use inttypes.h instead of stdint.h for portability.
|
||||
*
|
||||
* Revision 1.366 2007/01/16 05:44:15 steve
|
||||
* Major rework of array handling. Memories are replaced with the
|
||||
* more general concept of arrays. The NetMemory and NetEMemory
|
||||
* classes are removed from the ivl core program, and the IVL_LPM_RAM
|
||||
* lpm type is removed from the ivl_target API.
|
||||
*
|
||||
* Revision 1.365 2006/11/04 06:19:25 steve
|
||||
* Remove last bits of relax_width methods, and use test_width
|
||||
* to calculate the width of an r-value expression that may
|
||||
* contain unsized numbers.
|
||||
*
|
||||
* Revision 1.364 2006/10/30 05:44:49 steve
|
||||
* Expression widths with unsized literals are pseudo-infinite width.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Revision 1.361 2006/09/23 04:57:19 steve
|
||||
* Basic support for specify timing.
|
||||
*
|
||||
* Revision 1.360 2006/08/08 05:11:37 steve
|
||||
* Handle 64bit delay constants.
|
||||
*
|
||||
* Revision 1.359 2006/07/31 03:50:17 steve
|
||||
* Add support for power in constant expressions.
|
||||
*
|
||||
* Revision 1.358 2006/06/18 04:15:50 steve
|
||||
* Add support for system functions in continuous assignments.
|
||||
*
|
||||
* Revision 1.357 2006/04/10 00:37:42 steve
|
||||
* Add support for generate loops w/ wires and gates.
|
||||
*
|
||||
* Revision 1.356 2006/03/18 22:53:04 steve
|
||||
* Properly handle signedness in compare.
|
||||
*
|
||||
* Revision 1.355 2006/02/02 02:43:58 steve
|
||||
* Allow part selects of memory words in l-values.
|
||||
*
|
||||
* Revision 1.354 2006/01/02 05:33:19 steve
|
||||
* Node delays can be more general expressions in structural contexts.
|
||||
*
|
||||
* Revision 1.353 2005/11/27 05:56:20 steve
|
||||
* Handle bit select of parameter with ranges.
|
||||
*
|
||||
* Revision 1.352 2005/11/26 00:35:43 steve
|
||||
* More precise about r-value width of constants.
|
||||
*
|
||||
* Revision 1.351 2005/09/19 21:45:36 steve
|
||||
* Spelling patches from Larry.
|
||||
*
|
||||
* Revision 1.350 2005/09/14 02:53:14 steve
|
||||
* Support bool expressions and compares handle them optimally.
|
||||
*
|
||||
* Revision 1.349 2005/09/01 04:11:37 steve
|
||||
* Generate code to handle real valued muxes.
|
||||
*
|
||||
* Revision 1.348 2005/08/31 05:07:31 steve
|
||||
* Handle memory references is continuous assignments.
|
||||
*
|
||||
* Revision 1.347 2005/07/14 23:34:19 steve
|
||||
* gcc4 compile errors.
|
||||
*
|
||||
* Revision 1.346 2005/07/11 16:56:50 steve
|
||||
* Remove NetVariable and ivl_variable_t structures.
|
||||
*
|
||||
* Revision 1.345 2005/07/07 16:22:49 steve
|
||||
* Generalize signals to carry types.
|
||||
*
|
||||
* Revision 1.344 2005/05/24 01:44:28 steve
|
||||
* Do sign extension of structuran nets.
|
||||
*
|
||||
* Revision 1.343 2005/05/17 20:56:55 steve
|
||||
* Parameters cannot have their width changed.
|
||||
*
|
||||
* Revision 1.342 2005/05/08 23:44:08 steve
|
||||
* Add support for variable part select.
|
||||
*
|
||||
* Revision 1.341 2005/04/24 23:44:02 steve
|
||||
* Update DFF support to new data flow.
|
||||
*
|
||||
* Revision 1.340 2005/04/08 04:51:16 steve
|
||||
* All memory addresses are signed.
|
||||
*
|
||||
* Revision 1.339 2005/04/06 05:29:08 steve
|
||||
* Rework NetRamDq and IVL_LPM_RAM nodes.
|
||||
*
|
||||
* Revision 1.338 2005/03/18 02:56:03 steve
|
||||
* Add support for LPM_UFUNC user defined functions.
|
||||
*
|
||||
* Revision 1.337 2005/03/12 06:43:36 steve
|
||||
* Update support for LPM_MOD.
|
||||
*
|
||||
* Revision 1.336 2005/03/09 05:52:04 steve
|
||||
* Handle case inequality in netlists.
|
||||
*
|
||||
* Revision 1.335 2005/02/19 02:43:38 steve
|
||||
* Support shifts and divide.
|
||||
*
|
||||
* Revision 1.334 2005/02/12 06:25:40 steve
|
||||
* Restructure NetMux devices to pass vectors.
|
||||
* Generate NetMux devices from ternary expressions,
|
||||
* Reduce NetMux devices to bufif when appropriate.
|
||||
*
|
||||
* Revision 1.333 2005/02/08 00:12:36 steve
|
||||
* Add the NetRepeat node, and code generator support.
|
||||
*
|
||||
* Revision 1.332 2005/02/03 04:56:20 steve
|
||||
* laborate reduction gates into LPM_RED_ nodes.
|
||||
*
|
||||
* Revision 1.331 2005/01/30 01:43:48 steve
|
||||
* Clarify width argument to NetNet constructor.
|
||||
*
|
||||
* Revision 1.330 2005/01/28 05:39:33 steve
|
||||
* Simplified NetMult and IVL_LPM_MULT.
|
||||
*
|
||||
* Revision 1.329 2005/01/24 05:28:31 steve
|
||||
* Remove the NetEBitSel and combine all bit/part select
|
||||
* behavior into the NetESelect node and IVL_EX_SELECT
|
||||
* ivl_target expression type.
|
||||
*
|
||||
* Revision 1.328 2005/01/22 18:16:01 steve
|
||||
* Remove obsolete NetSubnet class.
|
||||
*
|
||||
* Revision 1.327 2005/01/22 01:06:55 steve
|
||||
* Change case compare from logic to an LPM node.
|
||||
*
|
||||
* Revision 1.326 2005/01/16 04:20:32 steve
|
||||
* Implement LPM_COMPARE nodes as two-input vector functors.
|
||||
*
|
||||
* Revision 1.325 2005/01/12 03:17:37 steve
|
||||
* Properly pad vector widths in pgassign.
|
||||
*
|
||||
* Revision 1.324 2005/01/09 20:16:01 steve
|
||||
* Use PartSelect/PV and VP to handle part selects through ports.
|
||||
*
|
||||
* Revision 1.323 2004/12/29 23:55:43 steve
|
||||
* Unify elaboration of l-values for all proceedural assignments,
|
||||
* including assing, cassign and force.
|
||||
*
|
||||
* Generate NetConcat devices for gate outputs that feed into a
|
||||
* vector results. Use this to hande gate arrays. Also let gate
|
||||
* arrays handle vectors of gates when the outputs allow for it.
|
||||
*
|
||||
* Revision 1.322 2004/12/11 02:31:27 steve
|
||||
* Rework of internals to carry vectors through nexus instead
|
||||
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
|
||||
* down this path.
|
||||
*
|
||||
* Revision 1.321 2004/10/04 01:10:54 steve
|
||||
* Clean up spurious trailing white space.
|
||||
*
|
||||
* Revision 1.320 2004/10/04 00:25:18 steve
|
||||
* Remove inaccurate comment.
|
||||
*
|
||||
* Revision 1.319 2004/09/05 17:44:42 steve
|
||||
* Add support for module instance arrays.
|
||||
*
|
||||
* Revision 1.318 2004/09/04 04:24:15 steve
|
||||
* PR1026: assignment statements can have sensitivities in the l-values.
|
||||
*
|
||||
* Revision 1.317 2004/08/28 16:23:05 steve
|
||||
* Fix use of system tasks in AT_STAR statements.
|
||||
*
|
||||
* Revision 1.316 2004/08/28 15:08:31 steve
|
||||
* Do not change reg to wire in NetAssign_ unless synthesizing.
|
||||
*
|
||||
* Revision 1.315 2004/06/30 15:32:18 steve
|
||||
* nex_output for NetPDelay statements.
|
||||
*
|
||||
* Revision 1.314 2004/06/30 02:16:26 steve
|
||||
* Implement signed divide and signed right shift in nets.
|
||||
*
|
||||
* Revision 1.313 2004/06/13 04:56:55 steve
|
||||
* Add support for the default_nettype directive.
|
||||
*
|
||||
* Revision 1.312 2004/05/31 23:34:38 steve
|
||||
* Rewire/generalize parsing an elaboration of
|
||||
* function return values to allow for better
|
||||
* speed and more type support.
|
||||
*
|
||||
* Revision 1.311 2004/02/20 06:22:57 steve
|
||||
* parameter keys are per_strings.
|
||||
*
|
||||
* Revision 1.310 2004/02/19 07:06:57 steve
|
||||
* LPM, logic and Variables have perm_string names.
|
||||
*
|
||||
* Revision 1.309 2004/02/19 06:57:10 steve
|
||||
* Memory and Event names use perm_string.
|
||||
*
|
||||
* Revision 1.308 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.307 2003/12/17 16:52:39 steve
|
||||
* Debug dumps for synth2.
|
||||
*
|
||||
* Revision 1.306 2003/11/10 20:59:03 steve
|
||||
* Design::get_flag returns const char* instead of string.
|
||||
*
|
||||
* Revision 1.305 2003/11/08 20:06:21 steve
|
||||
* Spelling fixes in comments.
|
||||
*
|
||||
* Revision 1.304 2003/10/31 02:47:11 steve
|
||||
* NetEUReduce has its own dup_expr method.
|
||||
*/
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue