Skip to content

Commit

Permalink
bus/asmibus: fix slot aging timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed Jun 14, 2013
1 parent 1ec1fb9 commit 0c52c08
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions migen/bus/asmibus.py
Expand Up @@ -9,10 +9,11 @@

class Slot(Module):
def __init__(self, aw, time):
self.time = time
self.state = Signal(2)
self.we = Signal()
self.adr = Signal(aw)
if time:
if self.time:
self.mature = Signal()

self.allocate = Signal()
Expand All @@ -32,14 +33,14 @@ def __init__(self, aw, time):
If(self.process, self.state.eq(SLOT_PROCESSING)),
If(self.call, self.state.eq(SLOT_EMPTY))
]
if time:
_counter = Signal(max=time+1)
self.comb += self.mature.eq(self._counter == 0)
if self.time:
counter = Signal(max=self.time+1)
self.comb += self.mature.eq(counter == 0)
self.sync += [
If(self.allocate,
self._counter.eq(self.time)
).Elif(self._counter != 0,
self._counter.eq(self._counter - 1)
counter.eq(self.time)
).Elif(counter != 0,
counter.eq(counter - 1)
)
]

Expand Down

0 comments on commit 0c52c08

Please sign in to comment.