concatentations that reduce to constants need proper signed-ness

It is possible, via the use of the $signed() function, for concatenation
expressions to be signed. Make sure the evaluated constant had the
proper sign by checking explicitly.
This commit is contained in:
Stephen Williams 2008-10-13 20:50:56 -07:00
parent 1a3e655285
commit 1c90997499
1 changed files with 5 additions and 0 deletions

View File

@ -1200,6 +1200,11 @@ NetEConst* NetEConcat::eval_tree(int prune_to_width)
val = verinum(val.as_string());
}
// Normally, concatenations are unsigned. However, the
// $signed() function works by marking the expression as
// signed, so we really have to check.
val.has_sign( this->has_sign() );
NetEConst*res = new NetEConst(val);
res->set_width(val.len());
return res;