1 ------------------------------------------------------
6 -- Dominique Gigi May 2015
7 ------------------------------------------------------
8 -- This file contain un instatiation of a FIFO (ALTERA or XILINX)
9 -- with he almost FUll signal
12 ------------------------------------------------------
14 USE ieee.std_logic_1164.
all;
15 use ieee.numeric_std.
all;
19 generic ( fifo_deep : := 6
23 aclr : in ;
-- active low
26 dataw : in (65 downto 0);
27 almost_f : out ;
-- active low
29 datar : out (65 downto 0);
31 empty : out -- active low
39 --***********************************************************
40 --********************** ALTERA DC FIFO *******************
41 --***********************************************************
43 -- component LPM_FIFO_v14
47 -- data : IN (65 DOWNTO 0);
52 -- q : OUT (65 DOWNTO 0);
54 -- wrusedw : OUT (5 DOWNTO 0)
59 COMPONENT lpm_fifo_dc -- !!!!!!!!!!!!!!! XILINX ISE and VIVADO VERSION !!!!!!!!!!!!!
64 din :
IN (
65 DOWNTO 0);
67 dout :
OUT (
65 DOWNTO 0);
70 wr_data_count :
OUT (
5 DOWNTO 0)
76 signal almost_full_reg : ;
78 signal word_used : (fifo_deep-1 downto 0);
81 --***********************************************************
82 --********************** BEGIN ****************************
83 --***********************************************************
86 resetp <= '1' when aclr = '0' else '0';
89 -- fifo_dc:LPM_FIFO_v14 -- !!!!!!!!!!!!! ALTERA VERSION
98 -- WRUSEDW => word_used,
102 fifo_dc :
lpm_fifo_dc -- !!!!!!!!!!!!!!! XILINX ISE
and Vivado VERSION !!!!!!!!!!!!!
108 wr_data_count => word_used,
123 almost_full_reg <= '1';
124 elsif rising_edge(clk_w) then
125 if word_used >= "110000" then --enable almostFull when reaches 48 data
in FIFO
of 64
126 almost_full_reg <= '0';
127 elsif word_used < "100101" then -- realize almostFull below 37 data
in FIFO
of 64
128 almost_full_reg <= '1';
133 almost_f <= almost_full_reg;