A FIFO queue is a first-in, first-out digital device that allows two parties to communicate with a channel of limited size by following specific rules: one party writes, the other reads. The first thing written will be the first thing read. Reading an empty queue is disallowed and writing to a full queue is disallowed. Empty and full status can be checked via the proper status pin before use. In psuedo-code, two parties can communicate with this FIFO as follows:
while !full: write_entry(item)
while !empty: item = read_entry()
The queue works in First-Word Fall-Through mode meaning that the top item is always available on the read bus even
if you haven’t set
read_request high. If you want to see the next item in the queue on your next read, be sure
almost_empty signals exist so you can batch reads and writes. Instead of checking for
empty on each read or write you can instead check
almost_empty and batch read or writes
based on how many slots are available. For this design taped out in TinyTapeout 4, almost_full means 12 of 16 slots
have been used and almost_empty means that 12 of 16 slots are free.
Write an item, read an item. Check the status bits. See the unit tests for more ideas!
|6||item||item||write_enable (set this high to write a value)|
|7||item||item||read_enable (set this high to read the latest entry from the FIFO)|