from ...tools import deprecated, extend
-from ...lib.fifo import FIFOInterface as NativeFIFOInterface, \
- SyncFIFO, SyncFIFOBuffered, AsyncFIFO, AsyncFIFOBuffered
+from ...lib.fifo import (FIFOInterface as NativeFIFOInterface,
+ SyncFIFO as NativeSyncFIFO, SyncFIFOBuffered as NativeSyncFIFOBuffered,
+ AsyncFIFO as NativeAsyncFIFO, AsyncFIFOBuffered as NativeAsyncFIFOBuffered)
__all__ = ["_FIFOInterface", "SyncFIFO", "SyncFIFOBuffered", "AsyncFIFO", "AsyncFIFOBuffered"]
class CompatFIFOInterface(NativeFIFOInterface):
@deprecated("attribute `fwft` must be provided to FIFOInterface constructor")
def __init__(self, width, depth):
- super().__init__(width, depth, fwft=False)
+ super().__init__(width=width, depth=depth, fwft=False)
del self.fwft
-_FIFOInterface = CompatFIFOInterface
-
-
@extend(NativeFIFOInterface)
def read(self):
"""Read method for simulation."""
yield
yield self.w_en.eq(0)
yield
+
+
+class CompatSyncFIFO(NativeSyncFIFO):
+ def __init__(self, width, depth, fwft=True):
+ super().__init__(width=width, depth=depth, fwft=fwft)
+
+
+class CompatSyncFIFOBuffered(NativeSyncFIFOBuffered):
+ def __init__(self, width, depth):
+ super().__init__(width=width, depth=depth)
+
+
+class CompatAsyncFIFO(NativeAsyncFIFO):
+ def __init__(self, width, depth):
+ super().__init__(width=width, depth=depth)
+
+
+class CompatAsyncFIFOBuffered(NativeAsyncFIFOBuffered):
+ def __init__(self, width, depth):
+ super().__init__(width=width, depth=depth)
+
+
+_FIFOInterface = CompatFIFOInterface
+SyncFIFO = CompatSyncFIFO
+SyncFIFOBuffered = CompatSyncFIFOBuffered
+AsyncFIFO = CompatAsyncFIFO
+AsyncFIFOBuffered = CompatAsyncFIFOBuffered
w_attributes="",
r_attributes="")
- def __init__(self, width, depth, *, fwft):
+ def __init__(self, *, width, depth, fwft):
if not isinstance(width, int) or width < 0:
raise TypeError("FIFO width must be a non-negative integer, not '{!r}'"
.format(width))
""".strip(),
w_attributes="")
- def __init__(self, width, depth, *, fwft=True):
- super().__init__(width, depth, fwft=fwft)
+ def __init__(self, *, width, depth, fwft=True):
+ super().__init__(width=width, depth=depth, fwft=fwft)
self.level = Signal.range(depth + 1)
do_read = self.r_rdy & self.r_en
do_write = self.w_rdy & self.w_en
- storage = Memory(self.width, self.depth)
+ storage = Memory(width=self.width, depth=self.depth)
w_port = m.submodules.w_port = storage.write_port()
r_port = m.submodules.r_port = storage.read_port(
domain="comb" if self.fwft else "sync", transparent=self.fwft)
""".strip(),
w_attributes="")
- def __init__(self, width, depth):
- super().__init__(width, depth, fwft=True)
+ def __init__(self, *, width, depth):
+ super().__init__(width=width, depth=depth, fwft=True)
self.level = Signal.range(depth + 1)
# Effectively, this queue treats the output register of the non-FWFT inner queue as
# an additional storage element.
- m.submodules.unbuffered = fifo = SyncFIFO(self.width, self.depth - 1, fwft=False)
+ m.submodules.unbuffered = fifo = SyncFIFO(width=self.width, depth=self.depth - 1,
+ fwft=False)
m.d.comb += [
fifo.w_data.eq(self.w_data),
r_attributes="",
w_attributes="")
- def __init__(self, width, depth, *, r_domain="read", w_domain="write", exact_depth=False):
+ def __init__(self, *, width, depth, r_domain="read", w_domain="write", exact_depth=False):
try:
depth_bits = log2_int(depth, need_pow2=exact_depth)
except ValueError as e:
raise ValueError("AsyncFIFO only supports depths that are powers of 2; requested "
"exact depth {} is not"
.format(depth)) from None
- super().__init__(width, 1 << depth_bits, fwft=True)
+ super().__init__(width=width, depth=1 << depth_bits, fwft=True)
self._r_domain = r_domain
self._w_domain = w_domain
r_empty.eq(consume_r_gry == produce_r_gry),
]
- storage = Memory(self.width, self.depth)
+ storage = Memory(width=self.width, depth=self.depth)
w_port = m.submodules.w_port = storage.write_port(domain=self._w_domain)
r_port = m.submodules.r_port = storage.read_port (domain=self._r_domain,
transparent=False)
r_attributes="",
w_attributes="")
- def __init__(self, width, depth, *, r_domain="read", w_domain="write", exact_depth=False):
+ def __init__(self, *, width, depth, r_domain="read", w_domain="write", exact_depth=False):
try:
depth_bits = log2_int(max(0, depth - 1), need_pow2=exact_depth)
except ValueError as e:
raise ValueError("AsyncFIFOBuffered only supports depths that are one higher "
"than powers of 2; requested exact depth {} is not"
.format(depth)) from None
- super().__init__(width, (1 << depth_bits) + 1, fwft=True)
+ super().__init__(width=width, depth=(1 << depth_bits) + 1, fwft=True)
self._r_domain = r_domain
self._w_domain = w_domain
def elaborate(self, platform):
m = Module()
- m.submodules.unbuffered = fifo = AsyncFIFO(self.width, self.depth - 1,
+ m.submodules.unbuffered = fifo = AsyncFIFO(width=self.width, depth=self.depth - 1,
r_domain=self._r_domain, w_domain=self._w_domain)
m.d.comb += [
"""
Non-synthesizable first-in first-out queue, implemented naively as a chain of registers.
"""
- def __init__(self, width, depth, *, fwft, r_domain, w_domain):
- super().__init__(width, depth, fwft=fwft)
+ def __init__(self, *, width, depth, fwft, r_domain, w_domain):
+ super().__init__(width=width, depth=depth, fwft=fwft)
self.r_domain = r_domain
self.w_domain = w_domain
def elaborate(self, platform):
m = Module()
- storage = Memory(self.width, self.depth)
+ storage = Memory(width=self.width, depth=self.depth)
w_port = m.submodules.w_port = storage.write_port(domain=self.w_domain)
r_port = m.submodules.r_port = storage.read_port (domain="comb")
def elaborate(self, platform):
m = Module()
m.submodules.dut = dut = self.fifo
- m.submodules.gold = gold = FIFOModel(dut.width, dut.depth, fwft=dut.fwft,
+ m.submodules.gold = gold = FIFOModel(width=dut.width, depth=dut.depth, fwft=dut.fwft,
r_domain=self.r_domain, w_domain=self.w_domain)
m.d.comb += [
consecutively, they must be read out consecutively at some later point, no matter all other
circumstances, with the exception of reset.
"""
- def __init__(self, fifo, r_domain, w_domain, bound):
- self.fifo = fifo
+ def __init__(self, fifo, *, r_domain, w_domain, bound):
+ self.fifo = fifo
self.r_domain = r_domain
self.w_domain = w_domain
- self.bound = bound
+ self.bound = bound
def elaborate(self, platform):
m = Module()