Catch that we do not currently support unsigned bit based power.

This patch adds a check and prints a warning message when the power
operator is used with unsigned bit based values. It also fixes a couple
of typos and adds an asserts if the above power operator happens to
get to the tgt-vvp back end.
This commit is contained in:
Cary R 2008-02-04 13:04:20 -08:00 committed by Stephen Williams
parent 0e6d6b7416
commit 40064b3181
3 changed files with 15 additions and 4 deletions

View File

@ -185,6 +185,12 @@ NetEBinary* PEBinary::elaborate_expr_base_(Design*des,
case 'p':
tmp = new NetEBPow(op_, lp, rp);
tmp->set_line(*this);
if (tmp->expr_type() == IVL_VT_LOGIC) {
cerr << get_fileline() << ": sorry: Power operator is not "
"currently supported on unsigned bit based values."
<< endl;
des->errors += 1;
}
break;
case '*':

View File

@ -948,7 +948,7 @@ extern unsigned ivl_lpm_lineno(ivl_lpm_t net);
* Multiply may be signed. If so, the output should be sign extended
* to fill in its result.
*
* - Power (IVL_LPM_POWR)
* - Power (IVL_LPM_POW)
* The power takes two inputs and generates an output. Unlike other
* arithmetic nodes, the width only refers to the output. The inputs
* have independent widths, to reflect the arithmetic truth that the
@ -1124,12 +1124,12 @@ extern ivl_scope_t ivl_lpm_define(ivl_lpm_t net);
/* IVL_LPM_FF */
extern ivl_nexus_t ivl_lpm_enable(ivl_lpm_t net);
/* IVL_LPM_ADD IVL_LPM_CONCAT IVL_LPM_FF IVL_LPM_PART IVL_LPM_MULT
IVL_LPM_MUX IVL_LPM_POWR IVL_LPM_SHIFTL IVL_LPM_SHIFTR IVL_LPM_SUB
IVL_LPM_MUX IVL_LPM_POW IVL_LPM_SHIFTL IVL_LPM_SHIFTR IVL_LPM_SUB
IVL_LPM_UFUNC */
extern ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx);
/* IVL_LPM_ADD IVL_LPM_MULT IVL_LPM_POWR IVL_LPM_SUB */
/* IVL_LPM_ADD IVL_LPM_MULT IVL_LPM_POW IVL_LPM_SUB */
extern ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx);
/* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_MULT IVL_LPM_PART IVL_LPM_POWR
/* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_MULT IVL_LPM_PART IVL_LPM_POW
IVL_LPM_SUB IVL_LPM_UFUNC */
extern ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx);
/* IVL_LPM_MUX */

View File

@ -1233,6 +1233,10 @@ static struct vector_info draw_binary_expr_arith(ivl_expr_t exp, unsigned wid)
lv.base, rv.base, wid);
break;
case 'p':
assert(0);
break;
default:
assert(0);
}
@ -1275,6 +1279,7 @@ static struct vector_info draw_binary_expr(ivl_expr_t exp,
case '*':
case '/':
case '%':
case 'p':
rv = draw_binary_expr_arith(exp, wid);
break;