Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Dec 18, 2024
1 parent 78a4bc1 commit 66f3e87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/lib/test_allocators.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def deallocator(sim: TestbenchContext):
await dut.free.call(sim, ident=val)
else:
await dut.free_idx.call(sim, idx=idx)
free.insert(0, val)
free.append(val)
allocated.pop(idx)
await self.random_wait_geom(sim, 0.4)

Expand Down
6 changes: 2 additions & 4 deletions transactron/lib/allocators.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ def _():
@def_method(m, self.free_idx)
def _(idx):
for i in range(self.entries - 1):
with m.If((i >= idx) & (i + 1 < incr_used)):
with m.If(i >= idx):
m.d.sync += order[i].eq(order[i + 1])
for i in range(self.entries):
with m.If(i + 1 == incr_used):
m.d.sync += order[i].eq(order[idx])
m.d.sync += order[self.entries - 1].eq(order[idx])

@def_method(m, self.free)
def _(ident):
Expand Down

0 comments on commit 66f3e87

Please sign in to comment.