This is a functional model of FIFO intended for VHDL simulations.
- VHDL-2008 compatible simulator.
Testing:
- ghdl
- make
This simfifo design unit supports generic data bus width, defined on package declaration using the DATA_WIDTH argument:
package simfifo_pkg_dword is new work.simfifo_pkg
generic map (DATA_WIDTH => 32);simfifo uses the std_logic_vector type for its arguments, meaning that this type must be declared prior the package declaration. Which means that the design unit should start with:
library ieee;
context ieee.ieee_std_context;
package simfifo_pkg_dword is new work.simfifo_pkg
generic map (DATA_WIDTH => 32);
-- The lines above could be in a separate file
library ieee;
context ieee.ieee_std_context;
use work.simfifo_pkg_dword.all;
use ieee.numeric_std_unsigned.all;simfifo exposes the following objects:
data_t:std_logic_vectorwith a width ofDATA_WIDTHbits.level_t: defining the type of FIFO level in data words.simfifo: the core object supporting the following methods:push(data_t): pushes a givendata_tin the FIFO.pop(): returns the oldestdata_tvalue pushed in the FIFO.get_level(): returns number ofdata_tvalues currently residing in the FIFO.
See simfifo_tb.vhd as an example.