Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

50%
+0 −0
Q&A Synchronous FIFO design code review

Your current FIFO acts as a standard FIFO. What you desire is a First Word Fall Through (FWFT) FIFO or a showahead FIFO. Changing the rd_data to be combinational logic instead of registered logic i...

posted 3d ago by EsotericaEnthusiast‭

Answer
#1: Initial revision by user avatar EsotericaEnthusiast‭ · 2024-12-15T00:47:57Z (3 days ago)
Your current FIFO acts as a standard FIFO. What you desire is a First Word Fall Through (FWFT) FIFO or a showahead FIFO. Changing the rd_data to be combinational logic instead of registered logic is the way to do this, the modification would look like this:

><pre>//read data from fifo
>
>always@(posedge clk)begin 
>   if(rd_en && !empty)begin 
>      //rd_data<=sync_fifo[rd_ptr]; // this would yield a value next cc
>       rd_ptr<=rd_ptr+1;
>   end
>end
>
>// remove 'reg' from rd_data port and make a continuous assignment
>assign rd_data = sync_fifo[rd_ptr];</pre>

![An image of GTKWave output from a simulation of the modified FIFO HDL that acts like a FWFT FIFO](https://electrical.codidact.com/uploads/sa2ssstda6wck0mral0pk9rrhk9f)

Changing the read enable (rd_en) net name to a read acknowledge (rd_ack) may be a more descriptive label in this case.

More information can be found at places like Eli Billauer's spin-off FPGA blog: https://www.01signal.com/using-ip/fpga-fifo/variants/