Skip to content

Commit

Permalink
add guard changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Jan 9, 2024
1 parent 6f7513a commit 2734317
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions rtlrepair/templates/add_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,19 @@ def find_atoms(lvars: set[str], a: AnalysisResults) -> list[vast.Node]:
# ignore clock signals
if var.is_clock:
continue
# check to see if the variable would create a loop
lvar_deps = lvars & var.depends_on
if len(lvar_deps) > 0 or var.name in lvars:
continue
# check to see if we would create a new dependency
if verbose:
print(f"{var.name}.depends_on = {var.depends_on}")
new_deps = (var.depends_on | {var.name}) - l_deps
if len(new_deps) > 0:
continue

# check which only mater for comb assignments
if len(lvars) > 0 and len(var.depends_on) > 0:
# check to see if the variable would create a loop
lvar_deps = lvars & var.depends_on
if len(lvar_deps) > 0 or var.name in lvars:
continue
# check to see if we would create a new dependency
if verbose:
print(f"{var.name}.depends_on = {var.depends_on}")
new_deps = (var.depends_on | {var.name}) - l_deps
if len(new_deps) > 0:
continue
# otherwise this might be a good candidate
atoms.append(vast.Identifier(var.name))
return atoms

0 comments on commit 2734317

Please sign in to comment.