1 ----------------------------------------------------------------------------------
5 -- Create Date: 13:
53:
06 04/29/2014
7 -- Module Name: AMC_DATA_FIFO - Behavioral
16 -- Revision 0.
01 -
File Created
17 -- Additional Comments:
19 ----------------------------------------------------------------------------------
21 use IEEE.STD_LOGIC_1164.
ALL;
22 use IEEE.STD_LOGIC_ARITH.
ALL;
23 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
24 use IEEE.std_logic_misc.
all;
26 -- Uncomment the following library declaration if using
27 -- arithmetic functions with or values
28 --use IEEE.NUMERIC_STD.ALL;
30 -- Uncomment the following library declaration if instantiating
31 -- any Xilinx primitives in this code.
33 use UNISIM.VComponents.
all;
35 use UNIMACRO.vcomponents.
all;
44 Di : in (63 downto 0);
45 Do : out (63 downto 0);
46 WRERR_OUT : out (7 downto 0);
47 RDERR_OUT : out (7 downto 0);
53 type array14x12 is array(0 to 13) of (11 downto 0);
54 signal RDCOUNT : array14x12;
55 signal WRCOUNT : array14x12;
56 signal RDCOUNT14 : (12 downto 0) := (others => '0');
57 signal WRCOUNT14 : (12 downto 0) := (others => '0');
58 signal FIFO_full : (13 downto 0) := (others => '0');
59 signal FIFO_empty : (13 downto 0) := (others => '0');
60 signal FIFO_RdEn : (6 downto 0) := (others => '0');
61 signal RDERR : (7 downto 0) := (others => '0');
62 signal WRERR : (7 downto 0) := (others => '0');
63 signal FIFO_Do : (62 downto 0) := (others => '0');
69 WRERR_OUT <= (others => '0');
70 elsif(wclk'event and wclk = '1')then
72 if(WRERR(i) = '1')then
81 RDERR_OUT <= (others => '0');
82 elsif(rclk'event and rclk = '1')then
84 if(RDERR(i) = '1')then
90 g_FIFO: for i in 0 to 6 generate
91 i_FIFO_i : FIFO_DUALCLOCK_MACRO
93 DEVICE =>
"7SERIES",
-- Target Device: "VIRTEX5",
"VIRTEX6",
"7SERIES"
94 ALMOST_FULL_OFFSET => X"0008",
-- Sets almost full threshold
95 ALMOST_EMPTY_OFFSET => X"0080",
-- Sets the almost empty threshold
96 DATA_WIDTH =>
9,
-- Valid values are 1-72 (37-72 only valid when FIFO_SIZE="36Kb")
97 FIFO_SIZE =>
"36Kb",
-- Target BRAM, "18Kb" or "36Kb"
98 FIRST_WORD_FALL_THROUGH => TRUE
) -- Sets the FIFO FWFT to TRUE or FALSE
100 ALMOSTEMPTY =>
open,
-- 1-bit output almost empty
101 ALMOSTFULL => FIFO_full
(i
),
-- 1-bit output almost full
102 DO => FIFO_Do
(i*9+8
downto i*9
),
-- Output data, width defined by DATA_WIDTH parameter
103 EMPTY => FIFO_empty
(i
),
-- 1-bit output empty
104 FULL =>
open,
-- 1-bit output full
105 RDCOUNT => RDCOUNT
(i
),
-- Output read count, width determined by FIFO depth
106 RDERR =>
open,
-- 1-bit output read error
107 WRCOUNT => WRCOUNT
(i
),
-- Output write count, width determined by FIFO depth
108 WRERR => WRERR
(i
),
-- 1-bit output write error
109 DI => Di
(i*9+8
downto i*9
),
-- Input data, width defined by DATA_WIDTH parameter
110 RDCLK => wclk,
-- 1-bit input read clock
111 RDEN => FIFO_Rden
(i
),
-- 1-bit input read enable
112 RST => reset,
-- 1-bit input reset
113 WRCLK => wclk,
-- 1-bit input write clock
114 WREN => we
-- 1-bit input write enable
116 i_FIFO_o : FIFO_DUALCLOCK_MACRO
118 DEVICE =>
"7SERIES",
-- Target Device: "VIRTEX5",
"VIRTEX6",
"7SERIES"
119 ALMOST_FULL_OFFSET => X"0004",
-- Sets almost full threshold
120 ALMOST_EMPTY_OFFSET => X"0006",
-- Sets the almost empty threshold
121 DATA_WIDTH =>
9,
-- Valid values are 1-72 (37-72 only valid when FIFO_SIZE="36Kb")
122 FIFO_SIZE =>
"36Kb",
-- Target BRAM, "18Kb" or "36Kb"
123 FIRST_WORD_FALL_THROUGH => TRUE
) -- Sets the FIFO FWFT to TRUE or FALSE
125 ALMOSTEMPTY => FIFO_empty
(i+7
),
-- 1-bit output almost empty
126 ALMOSTFULL =>
open,
-- 1-bit output almost full
127 DO => Do
(i*9+8
downto i*9
),
-- Output data, width defined by DATA_WIDTH parameter
128 EMPTY =>
open,
-- 1-bit output empty
129 FULL => FIFO_full
(i+7
),
-- 1-bit output full
130 RDCOUNT => RDCOUNT
(i+7
),
-- Output read count, width determined by FIFO depth
131 RDERR => RDERR
(i
),
-- 1-bit output read error
132 WRCOUNT => WRCOUNT
(i+7
),
-- Output write count, width determined by FIFO depth
133 WRERR =>
open,
-- 1-bit output write error
134 DI => FIFO_Do
(i*9+8
downto i*9
),
-- Input data, width defined by DATA_WIDTH parameter
135 RDCLK => rclk,
-- 1-bit input read clock
136 RDEN => re,
-- 1-bit input read enable
137 RST => reset,
-- 1-bit input reset
138 WRCLK => wclk,
-- 1-bit input write clock
139 WREN => FIFO_Rden
(i
) -- 1-bit input write enable
141 FIFO_Rden(i) <= fifo_en and not FIFO_full(i+7) and not FIFO_empty(i);
143 i_FIFO63 : FIFO_DUALCLOCK_MACRO
145 DEVICE =>
"7SERIES",
-- Target Device: "VIRTEX5",
"VIRTEX6",
"7SERIES"
146 ALMOST_FULL_OFFSET => X"0004",
-- Sets almost full threshold
147 ALMOST_EMPTY_OFFSET => X"0006",
-- Sets the almost empty threshold
148 DATA_WIDTH =>
1,
-- Valid values are 1-72 (37-72 only valid when FIFO_SIZE="36Kb")
149 FIFO_SIZE =>
"36Kb",
-- Target BRAM, "18Kb" or "36Kb" -- 18Kb max depth
is 4K, need 36Kb
to get 8K depth
150 FIRST_WORD_FALL_THROUGH => TRUE
) -- Sets the FIFO FWFT to TRUE or FALSE
152 ALMOSTEMPTY =>
open,
-- 1-bit output almost empty
153 ALMOSTFULL =>
open,
-- 1-bit output almost full
154 DO => Do
(63 downto 63),
-- Output data, width defined by DATA_WIDTH parameter
155 EMPTY =>
open,
-- 1-bit output empty
156 FULL =>
open,
-- 1-bit output full
157 RDCOUNT => RDCOUNT14,
-- Output read count, width determined by FIFO depth
158 RDERR => RDERR
(7),
-- 1-bit output read error
159 WRCOUNT => WRCOUNT14,
-- Output write count, width determined by FIFO depth
160 WRERR => WRERR
(7),
-- 1-bit output write error
161 DI => Di
(63 downto 63),
-- Input data, width defined by DATA_WIDTH parameter
162 RDCLK => rclk,
-- 1-bit input read clock
163 RDEN => re,
-- 1-bit input read enable
164 RST => reset,
-- 1-bit input reset
165 WRCLK => wclk,
-- 1-bit input write clock
166 WREN => we
-- 1-bit input write enable