ROHD HCL comes with a simple FIFO (First In, First Out). The detailed API docs are available here.
The underlying implementation uses a flop-based memory (see RegisterFile
) to store data until it is ready to be popped, with independent read and write pointers.
When writeEnable
is high, writeData
is added to the FIFO. When readEnable
is high, readData
is popped off the FIFO.
The FIFO has a configurable depth
.
When readEnable
is low, the readData
continually provides access to "peek" the next data.
The empty
signal indicates when nothing is in the FIFO. The full
signal indicates when the FIFO can store no additional data.
THe FIFO optionally supports a bypass if generateBypass
is set. When generated, if the FIFO is empty and both readEnable
and writeEnable
are high at the same time, then the FIFO will do a bypass of the internal storage, allowing for a combinational passthrough.
Error information can optionally be generated and provided if generateError
is set. If data is popped when the FIFO is empty, or pushed when the FIFO is full, then the error
signal will assert.
There is no guarantee that the error
signal will hold high once asserted once. Behavior after an error condition is undefined.
Occupancy information can optionally be generated and provided if generateOccupancy
is set. The occupancy
signal will indicate the number of items currently stored in the FIFO.
An example schematic for one configuration is viewable here: FIFO Schematic
The FIFO comes with both a checker and a tracker that you can leverage in your testbench.
The FifoChecker
is a ROHD-VF component which will watch for proper usge of a FIFO in your simulation. It is intended to check usage, not the internal workings of the FIFO, which are already pre-validated in the unit tests. This means it covers things like underflow, overflow, and that the FIFO is empty at the end of the test.
The FifoTracker
will generate log files using the Tracker
from ROHD-VF in either table or JSON format. It tracks reads and writes per timestamp, including data pushed/popped and the current occupancy. An example table is shown below (from one of the unit tests):
----------------------------------------
| T | C | D | O |
| I | O | A | C |
| M | M | T | C |
| E | M | A | U |
| | A | | P |
| | N | | A |
| | D | | N |
| | | | C |
| | | | Y |
----------------------------------------
| 55 | WR | 32'h111 | 1 | {Time: 55, Command: WR, Data: 32'h111, Occupancy: 1}
| 75 | WR | 32'h222 | 2 | {Time: 75, Command: WR, Data: 32'h222, Occupancy: 2}
| 75 | RD | 32'h111 | 1 | {Time: 75, Command: RD, Data: 32'h111, Occupancy: 1}
| 85 | RD | 32'h222 | 0 | {Time: 85, Command: RD, Data: 32'h222, Occupancy: 0}