diff --git a/eval_tree.cc b/eval_tree.cc index 13926ea0f..b5b198c1f 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -979,12 +979,7 @@ NetExpr* NetEBPow::eval_tree(int prune_to_width) verinum lval = lc->value(); verinum rval = rc->value(); - if (lc->has_sign() || rc->has_sign()) { - return new NetEConst( pow(lval,rval) ); - } else { - return 0; // For now force this to the runtime. - } - + return new NetEConst( pow(lval,rval) ); } /* diff --git a/verinum.cc b/verinum.cc index 27c32e224..6fa5ee75f 100644 --- a/verinum.cc +++ b/verinum.cc @@ -496,11 +496,15 @@ verinum trim_vnum(const verinum&that) } else { /* If the result is unsigned and has an indefinite - length, then trim off leading zeros. */ - tlen = 1; - for (unsigned idx = tlen ; idx < that.len() ; idx += 1) - if (that.get(idx) != verinum::V0) - tlen = idx+1; + length, then trim off all but one leading zero. */ + unsigned top = that.len()-1; + while ((top > 0) && (that.get(top) == verinum::V0)) + top -= 1; + tlen = top+2; + + /* This can only happen when the verinum is all zeros, + so make it a single bit wide. */ + if (that.get(top) == verinum::V0) tlen -= 1; } @@ -1211,4 +1215,3 @@ verinum::V operator ^ (verinum::V l, verinum::V r) return verinum::Vx; } -