Skip to content

Commit

Permalink
Fix for GitHub issue 14 : Bug in processing 1'b1 >= |1'bx.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
martinwhitaker committed Feb 18, 2014
1 parent 830083d commit 5a06602
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eval_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 5a06602

Please sign in to comment.