Skip to content
Permalink
Browse files
bus/asmibus: fix slot aging timer
  • Loading branch information
Sebastien Bourdeauducq committed Jun 14, 2013
1 parent 1ec1fb9 commit 0c52c08989d3bee4b78572efc69ac583bd0fa757
Showing with 8 additions and 7 deletions.
  1. +8 −7 migen/bus/asmibus.py
@@ -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()
@@ -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)
)
]

0 comments on commit 0c52c08

Please sign in to comment.