First Word Fall Through FIFO Wrapper
A block-RAM FIFO returns data one cycle after you ask for it. A first-word-fall-through FIFO shows the next word before you ask. The wrapper hides that cycle by reading ahead.
The FWFT wrapper module interfaces with a standard synchronous FIFO and hides this latency. It automatically prefetches the next word from the standard FIFO so that fwft_dout always presents valid data immediately when fwft_empty is low. When the user asserts fwft_read, the current word is consumed, and the next word (if available) appears on fwft_dout on the following clock cycle.
The standard FIFO primitive being wrapped behaves as follows: it asserts std_empty when it contains no data. When std_read is asserted, the next word appears on std_dout on the following clock cycle and remains stable until the cycle after the next std_read is asserted.
Timing and Reset Rules
- Clock edge:
posedge clk - Reset type: Asynchronous, active-low (
rst_n) - Output values on reset:
std_readgoes to 0,fwft_emptygoes to 1, andfwft_doutgoes to8'b00000000 - Priority: If
fwft_readis asserted whilefwft_emptyis high, the read is invalid and must be ignored - Registered outputs:
std_read,fwft_emptyandfwft_doutare all registered. Each takes, on the clock edge, the value the worked trace shows for that cycle.
Worked Trace
Cycle 1: rst_n=0 → std_read=0, fwft_empty=1, fwft_dout=0
Cycle 2: rst_n=1, std_empty=0 (Standard FIFO has data) → Wrapper prefetches by asserting std_read=1
Cycle 3: std_dout=D1 (Data arrives) → std_read=0, fwft_empty=0, fwft_dout=D1
Cycle 4: fwft_read=1, std_empty=0 (User reads, standard FIFO has more data) → Wrapper fetches next word with std_read=1
Cycle 5: std_dout=D2 (Next data arrives) → std_read=0, fwft_empty=0, fwft_dout=D2. User asserts fwft_read=1, but std_empty=1 (Standard FIFO is empty) → std_read=0
Cycle 6: User read completes, no more data → fwft_empty=1, fwft_dout=0
Port Table
| Signal | Direction | Width | Description |
|---|---|---|---|
clk |
input | 1 | Positive-edge triggered clock |
rst_n |
input | 1 | Asynchronous active-low reset |
std_empty |
input | 1 | High when the standard FIFO has no data |
std_dout |
input | 8 | Data output from the standard FIFO (1-cycle latency) |
std_read |
output | 1 | Read enable to the standard FIFO |
fwft_read |
input | 1 | Read enable from the user to consume the current word |
fwft_empty |
output | 1 | High when no data is available for the user |
fwft_dout |
output | 8 | FWFT data output; must be 8'b0 when fwft_empty is 1 |
Constraints
- Clock is positive-edge triggered and reset is asynchronous active-low
fwft_doutmust explicitly output8'b00000000whenfwft_emptyis high, including during resetstd_readmust only be asserted ifstd_emptyis low- If
fwft_readis asserted whilefwft_emptyis high, the read must not corrupt the internal state
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's testbench. You get the waveform back, not a stored answer.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.
Part of Memory and Storage
Problem 19 of 26 in the Memory and Storage track.
Related problems
Browse all problems · Verilog practice problems · Learning tracks