2 use ieee.numeric_std.all;
3 use ieee.std_logic_1164.all;
5 entity generic_fifo_fwft is
9 async_reset : boolean := false
15 dataout : out stream_t;
16 empty : out std_logic;
22 architecture a_generic_fifo_fwft of generic_fifo_fwft is
23 type memory_t is array(size-1 downto 0) of stream_t;
24 signal wrptr : integer range 0 to size - 1;
25 signal rdptr : integer range 0 to size - 1;
26 signal mem : memory_t;
27 signal inverted : boolean;
30 empty <= '1' when (rdptr = wrptr) and not inverted else '0';
31 full <= '1' when (rdptr = wrptr) and inverted else '0';
33 dataout <= mem(rdptr);
37 if rising_edge(clk) then
38 if wr and not full then
42 if rd and not empty then
47 elsif wr and not full then
48 inverted <= not inverted when wrptr + 1 mod size < wrptr;
49 elsif rd and not empty then
50 inverted <= not inverted when rdptr + 1 mod size < rdptr;
52 if not async_reset then