genlib/fifo: same 'level' semantics between SyncFIFOBuffered and FWFT SyncFIFO
authorSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 17 Sep 2014 11:58:43 +0000 (19:58 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 17 Sep 2014 11:58:43 +0000 (19:58 +0800)
migen/genlib/fifo.py

index f29309b56db8c4e7227b6aadc8f9974717a0c79b..2f3b8033aeb2022977aa96d685795302e0bc6228 100644 (file)
@@ -141,18 +141,19 @@ class SyncFIFOBuffered(Module, _FIFOInterface):
                self.we = fifo.we
                self.dout_bits = fifo.dout_bits
                self.dout = fifo.dout
-               self.level = fifo.level
+               self.level = Signal(max=depth+2)
                self.replace = fifo.replace
 
                ###
 
-               self.comb += fifo.re.eq(fifo.readable & (~self.readable | self.re)),
+               self.comb += fifo.re.eq(fifo.readable & (~self.readable | self.re))
                self.sync += \
                        If(fifo.re,
                                self.readable.eq(1),
                        ).Elif(self.re,
                                self.readable.eq(0),
                        )
+               self.comb += self.level.eq(fifo.level + self.readable)
 
 class AsyncFIFO(Module, _FIFOInterface):
        """Asynchronous FIFO (first in, first out)