Skip to content

Commit

Permalink
conditional_overwrite: skip if there are no atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Jan 9, 2024
1 parent 4090d91 commit c258ac4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rtlrepair/templates/conditional_overwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ def visit_Always(self, node: vast.Always):
lvars = get_lvars(var)
filtered_conditions = filter_atom(conditions, lvars, self.vars)
filtered_case_inputs = filter_atom(analysis.case_inputs, lvars, self.vars)
cond = self.gen_condition(filtered_conditions, filtered_case_inputs)
assignment = self.make_assignment(var)
inner = vast.IfStatement(cond, assignment, None)
stmts.append(self.make_change_stmt(inner, 0))
if len(filtered_conditions) > 0 or len(filtered_case_inputs) > 0:
cond = self.gen_condition(filtered_conditions, filtered_case_inputs)
assignment = self.make_assignment(var)
inner = vast.IfStatement(cond, assignment, None)
stmts.append(self.make_change_stmt(inner, 0))
# append statements
node.statement = ensure_block(node.statement, self.blockified)
node.statement.statements = tuple(list(node.statement.statements) + stmts)
Expand Down

0 comments on commit c258ac4

Please sign in to comment.