Skip to content

Commit

Permalink
Arbiter works
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanmohan committed Aug 15, 2023
1 parent 8d66d43 commit b317c80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions calyx-py/calyx/builder_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def insert_comb_group(comp: cb.ComponentBuilder, left, right, cell, groupname=No
return cell, comb_group


def insert_eq(comp: cb.ComponentBuilder, left, right, width):
def insert_eq(comp: cb.ComponentBuilder, left, right, width, cellname=None):
"""Inserts wiring into component {comp} to check if {left} == {right}.
<cellname> = std_eq(<width>);
Expand All @@ -26,7 +26,7 @@ def insert_eq(comp: cb.ComponentBuilder, left, right, width):
Returns handles to the cell and the combinational group.
"""
return insert_comb_group(comp, left, right, comp.eq(width))
return insert_comb_group(comp, left, right, comp.eq(width, cellname))


def insert_neq(comp: cb.ComponentBuilder, left, right, cellname, width):
Expand Down
10 changes: 5 additions & 5 deletions calyx-py/test/correctness/arbiter_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def add_wrap2(prog):
j_mod_4 = wrap.reg("j_mod_4", 32)

# Additional cells and groups to compute equality and lt
i_eq_0_cell, i_eq_0_grp = util.insert_eq(wrap, i, 0, "i_eq_0", 32)
i_eq_1_cell, i_eq_1_group = util.insert_eq(wrap, i, 1, "i_eq_1", 32)
i_eq_0_cell, i_eq_0_grp = util.insert_eq(wrap, i, 0, 32, "i_eq_0")
i_eq_1_cell, i_eq_1_group = util.insert_eq(wrap, i, 1, 32, "i_eq_1")
j_lt_4_cell, j_lt_4_group = util.insert_lt(wrap, j, 4, "j_lt_4", 32)
j_lt_8_cell, j_lt_8_group = util.insert_lt(wrap, j, 8, "j_lt_8", 32)

Expand Down Expand Up @@ -126,9 +126,9 @@ def add_wrap3(prog):
j_mod_4 = wrap.reg("j_mod_4", 32)

# Additional cells to compute equality, and lt
i_eq_0_cell, i_eq_0_group = util.insert_eq(wrap, i, 0, "i_eq_0", 32)
i_eq_1_cell, i_eq_1_group = util.insert_eq(wrap, i, 1, "i_eq_1", 32)
i_eq_2_cell, i_eq_2_group = util.insert_eq(wrap, i, 2, "i_eq_2", 32)
i_eq_0_cell, i_eq_0_group = util.insert_eq(wrap, i, 0, 32, "i_eq_0")
i_eq_1_cell, i_eq_1_group = util.insert_eq(wrap, i, 1, 32, "i_eq_1")
i_eq_2_cell, i_eq_2_group = util.insert_eq(wrap, i, 2, 32, "i_eq_2")
j_lt_4_cell, j_lt_4_group = util.insert_lt(wrap, j, 4, "j_lt_4", 32)

# Load `j` unchanged into `j_mod_4`.
Expand Down

0 comments on commit b317c80

Please sign in to comment.