Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piezo, PIFOTree: static option! #1783

Merged
merged 17 commits into from
Nov 20, 2023
Prev Previous commit
Next Next commit
Support for non-static choice
  • Loading branch information
anshumanmohan committed Nov 19, 2023
commit 7c3d46e07395fc4ceba098222b7661a9851b33c2
17 changes: 12 additions & 5 deletions calyx-py/test/correctness/piezo_pifotree.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def insert_stats(prog, name, static=False):
count_1_sto = stats.reg("count_1_sto", 32)

# Wiring to increment the appropriate register.
count_0_incr = stats.incr_static(count_0_sto)
count_1_incr = stats.incr_static(count_1_sto)
count_0_incr = stats.incr_static(count_0_sto) if static else stats.incr(count_0_sto)
count_1_incr = stats.incr_static(count_1_sto) if static else stats.incr(count_1_sto)

# Equality checks.
flow_eq_0 = stats.eq_use(flow, 0)
Expand All @@ -48,9 +48,16 @@ def insert_stats(prog, name, static=False):
stats.this().count_1 = count_1_sto.out

# The main logic.
stats.control += cb.static_par(
cb.if_with(flow_eq_0, count_0_incr),
cb.if_with(flow_eq_1, count_1_incr),
stats.control += (
cb.static_par(
cb.if_with(flow_eq_0, count_0_incr),
cb.if_with(flow_eq_1, count_1_incr),
)
if static
else cb.par(
cb.if_with(flow_eq_0, count_0_incr),
cb.if_with(flow_eq_1, count_1_incr),
)
)

return stats
Expand Down