3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-08 07:03:24 +00:00

Merge pull request #5154 from georgerennie/george/post_incdec_undo_fix

read_verilog: fix -1 constant used to correct post increment/decrement
This commit is contained in:
George Rennie 2025-06-04 14:22:32 +01:00 committed by GitHub
commit ab40403d90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 70 additions and 1 deletions

View file

@ -336,7 +336,8 @@ static AstNode *addIncOrDecExpr(AstNode *lhs, dict<IdString, AstNode*> *attr, AS
log_assert(stmt->type == AST_ASSIGN_EQ);
AstNode *expr = stmt->children[0]->clone();
if (undo) {
AstNode *minus_one = AstNode::mkconst_int(-1, true, 1);
AstNode *one = AstNode::mkconst_int(1, false, 1);
AstNode *minus_one = new AstNode(AST_NEG, one);
expr = new AstNode(op, expr, minus_one);
}
SET_AST_NODE_LOC(expr, begin, end);