Fixed mem2reg for reg usage outside always block
authorClifford Wolf <clifford@clifford.at>
Mon, 18 Nov 2013 11:35:41 +0000 (12:35 +0100)
committerClifford Wolf <clifford@clifford.at>
Mon, 18 Nov 2013 11:35:41 +0000 (12:35 +0100)
frontends/ast/simplify.cc

index fdb6e9eddd0c2825467c710db00744284dfa9608..372a2bfd6998569ec676a3d6b6592f86af3af1d4 100644 (file)
@@ -1290,7 +1290,7 @@ void AstNode::mem2reg_as_needed_pass2(std::set<AstNode*> &mem2reg_set, AstNode *
                mod->children.push_back(wire_data);
                while (wire_data->simplify(true, false, false, 1, -1, false)) { }
 
-               AstNode *assign_addr = new AstNode(AST_ASSIGN_EQ, new AstNode(AST_IDENTIFIER), children[0]->children[0]->clone());
+               AstNode *assign_addr = new AstNode(block ? AST_ASSIGN_EQ : AST_ASSIGN, new AstNode(AST_IDENTIFIER), children[0]->children[0]->clone());
                assign_addr->children[0]->str = id_addr;
 
                AstNode *case_node = new AstNode(AST_CASE, new AstNode(AST_IDENTIFIER));