Fixed at_zero evaluation of dynamic ranges
authorClifford Wolf <clifford@clifford.at>
Thu, 7 Nov 2013 10:25:19 +0000 (11:25 +0100)
committerClifford Wolf <clifford@clifford.at>
Thu, 7 Nov 2013 10:25:19 +0000 (11:25 +0100)
frontends/ast/simplify.cc

index d34960481259649394383ca3f36281ec7fc7d182..1bdd6862651fbbf488c5481f47ab5e3b8e4b46b8 100644 (file)
@@ -965,13 +965,8 @@ skip_dynamic_range_lvalue_expansion:;
                                if (children.size() == 0)
                                        newNode = current_scope[str]->children[0]->clone();
                        }
-                       else if (at_zero && current_module->wires.count(str) > 0) {
-                               assert(current_scope.count(str) > 0 && (current_scope[str]->type == AST_WIRE || current_scope[str]->type == AST_AUTOWIRE));
-                               if (children.size() != 0 && children[0]->type == AST_RANGE && children[0]->range_valid)
-                                       newNode = mkconst_int(0, false,  children[0]->range_left -  children[0]->range_right + 1);
-                               else
-                               if (children.size() == 0)
-                                       newNode = mkconst_int(0, current_scope[str]->is_signed, current_module->wires[str]->width);
+                       else if (at_zero && current_scope.count(str) > 0 && (current_scope[str]->type == AST_WIRE || current_scope[str]->type == AST_AUTOWIRE)) {
+                               newNode = mkconst_int(0, sign_hint, width_hint);
                        }
                        break;
                case AST_BIT_NOT: