Skip to content
Permalink
Browse files

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.
  • Loading branch information
martinwhitaker committed Feb 18, 2014
1 parent 830083d commit 5a06602af2a0c4087ecc99f16ebc5e0d67f78dcd
Showing with 4 additions and 0 deletions.
  1. +4 −0 eval_tree.cc
@@ -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()) {

0 comments on commit 5a06602

Please sign in to comment.