Fix for GitHub issue 14 : Bug in processing 1'b1 >= |1'bx.
During expression evaluation, the compiler attempts to optimise away relational operations when one side is constant and all possible values of the other side would result in the relation being true. This is not a valid optimisation if the other side is a 4-state variable, as an 'x' or 'z' will result in the relation being unknown.
This commit is contained in:
parent
830083d99b
commit
5a06602af2
|
|
@ -358,6 +358,10 @@ NetEConst* NetEBComp::eval_less_(const NetExpr*le, const NetExpr*re) const
|
|||
|
||||
NetEConst* NetEBComp::must_be_leeq_(const NetExpr*le, const verinum&rv, bool eq_flag) const
|
||||
{
|
||||
// The following optimization is not valid if le can contain 'x'
|
||||
// or 'z' values.
|
||||
if (le->expr_type() == IVL_VT_LOGIC) return 0;
|
||||
|
||||
assert(le->expr_width() > 0);
|
||||
verinum lv (verinum::V1, le->expr_width());
|
||||
if (le->has_sign() && rv.has_sign()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue