1 ------------------------------------------------------
6 -- Dominique Gigi Feb 2012
7 ------------------------------------------------------
12 ------------------------------------------------------
19 USE ieee.std_logic_1164.
all;
20 use ieee.numeric_std.
all;
24 -- USE lpm.lpm_components.all;
25 -- USE altera_mf.altera_mf_components.all;
26 -- USE altera.altera_primitives_components.all;
29 generic ( fifo_deep : := 6
33 aclr : in ;
-- active low
36 dataw : in (65 downto 0);
37 almost_f: out ;
-- active low
39 datar : out (65 downto 0);
41 empty : out -- active low
49 --***********************************************************
50 --********************** ALTERA DC FIFO *******************
51 --***********************************************************
52 -- component LPM_FIFO_DC --!!!!!!!!!!!!!!!!!!!!!!! ALTERA VERSION
54 -- LPM_WIDTH : ; -- MUST be greater than 0
55 -- LPM_WIDTHU : := 1; -- MUST be greater than
0
56 -- LPM_NUMWORDS : ; -- MUST be greater than 0
57 -- LPM_SHOWAHEAD : := "ON";
58 -- LPM_TYPE : := L_FIFO_DC;
59 -- UNDERFLOW_CHECKING : := "ON";
60 -- OVERFLOW_CHECKING : := "ON";
61 -- LPM_HINT : := "UNUSED");
63 -- DATA : in (LPM_WIDTH-1 downto 0);
69 -- Q : out (LPM_WIDTH-1 downto 0);
70 -- WRUSEDW : out (LPM_WIDTHU-1 downto 0);
71 -- RDUSEDW : out (LPM_WIDTHU-1 downto 0);
78 COMPONENT lpm_fifo_dc -- !!!!!!!!!!!!!!! XILINX VERSION !!!!!!!!!!!!!
85 din :
IN (
65 DOWNTO 0);
88 dout :
OUT (
65 DOWNTO 0);
91 wr_data_count :
OUT (
5 DOWNTO 0)
96 signal almost_full_reg : ;
98 signal word_used : (fifo_deep-1 downto 0);
101 --***********************************************************
102 --********************** BEGIN ****************************
103 --***********************************************************
106 resetp <= '1' when aclr = '0' else '0';
108 -- fifo_dc:LPM_FIFO_DC -- !!!!!!!!!!!!! ALTERA VERSION
110 -- LPM_WIDTH => 66, -- MUST be greater than
0
111 -- LPM_WIDTHU => fifo_deep, -- MUST be greater than 0
112 -- LPM_NUMWORDS => 64 -- MUST be greater than
0
122 -- WRUSEDW => word_used,
126 fifo_dc :
lpm_fifo_dc -- !!!!!!!!!!!!!!! XILINX VERSION !!!!!!!!!!!!!
139 wr_data_count => word_used
148 almost_full_reg <= '1';
149 elsif rising_edge(clk_w) then
150 if word_used >= "110000" then --enable almostFull when reaches 48 data
in FIFO
of 64
151 almost_full_reg <= '0';
152 elsif word_used < "100101" then -- realize almostFull below 37 data
in FIFO
of 64
153 almost_full_reg <= '1';
158 almost_f <= almost_full_reg;