Properly pad results of function calls.
The elaborator improperly allowed user function call nodes to take on the expression width requested of them. The result was that generated code had junk pad bits in certain cases.
This commit is contained in:
parent
a1495bb007
commit
a33619a0f5
|
|
@ -1711,7 +1711,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
|
|||
netlist. The compound statement is exactly equivalent. */
|
||||
|
||||
if (delay || event_) {
|
||||
unsigned wid = lv->lwidth();
|
||||
unsigned wid = count_lval_width(lv);
|
||||
|
||||
rv->set_width(wid);
|
||||
rv = pad_to_width(rv, wid);
|
||||
|
|
|
|||
|
|
@ -413,8 +413,10 @@ bool NetETernary::set_width(unsigned w, bool last_chance)
|
|||
*/
|
||||
bool NetEUFunc::set_width(unsigned wid, bool)
|
||||
{
|
||||
expr_width(wid);
|
||||
return true;
|
||||
if (result_sig_->expr_width() == wid)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetEUnary::set_width(unsigned w, bool)
|
||||
|
|
|
|||
|
|
@ -82,8 +82,9 @@ static void show_function_call(ivl_expr_t net, unsigned ind)
|
|||
const char*vt = vt_type_string(net);
|
||||
unsigned idx;
|
||||
|
||||
fprintf(out, "%*s<%s %s function %s with %u arguments>\n", ind, "",
|
||||
vt, sign, ivl_scope_name(def), ivl_expr_parms(net));
|
||||
fprintf(out, "%*s<%s %s function %s with %u arguments (width=%u)>\n",
|
||||
ind, "", vt, sign, ivl_scope_name(def), ivl_expr_parms(net),
|
||||
ivl_expr_width(net));
|
||||
|
||||
for (idx = 0 ; idx < ivl_expr_parms(net) ; idx += 1)
|
||||
show_expression(ivl_expr_parm(net,idx), ind+4);
|
||||
|
|
|
|||
Loading…
Reference in New Issue