1 ------------------------------------------------------------------------------- 2 -- File : FifoAsyncBuiltIn.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2013-07-28 5 -- Last update: 2014-07-14 6 ------------------------------------------------------------------------------- 7 -- Description: Wrapper for Xilinx's built-in ASYNC FIFO module 8 ------------------------------------------------------------------------------- 9 -- This file is part of 'SLAC Firmware Standard Library'. 10 -- It is subject to the license terms in the LICENSE.txt file found in the 11 -- top-level directory of this distribution and at: 12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 13 -- No part of 'SLAC Firmware Standard Library', including this file, 14 -- may be copied, modified, propagated, or distributed except according to 15 -- the terms contained in the LICENSE.txt file. 16 ------------------------------------------------------------------------------- 19 use ieee.std_logic_1164.
all;
20 use ieee.std_logic_unsigned.
all;
21 use ieee.std_logic_arith.
all;
26 use UNISIM.vcomponents.
all;
29 use UNIMACRO.vcomponents.
all;
32 --! @ingroup base_fifo 39 XIL_DEVICE_G : := "7SERIES";
-- Target Device: "VIRTEX5", "VIRTEX6", "7SERIES" 49 -- Write Ports (wr_clk domain) 60 -- Read Ports (rd_clk domain) 76 if ((d_width >= 37) and (d_width <= 72) and (a_width = 9)) then 78 elsif ((d_width >= 19) and (d_width <= 36) and (a_width = 10)) then 80 elsif ((d_width >= 19) and (d_width <= 36) and (a_width = 9)) then 82 elsif ((d_width >= 10) and (d_width <= 18) and (a_width = 11)) then 84 elsif ((d_width >= 10) and (d_width <= 18) and (a_width = 10)) then 86 elsif ((d_width >= 5) and (d_width <= 9) and (a_width = 12)) then 88 elsif ((d_width >= 5) and (d_width <= 9) and (a_width = 11)) then 90 elsif ((d_width >= 1) and (d_width <= 4) and (a_width = 13)) then 92 elsif ((d_width >= 1) and (d_width <= 4) and (a_width = 12)) then 95 return "???Kb";
-- Generate error in Xilinx marco 134 -- Check ADDR_WIDTH_G and DATA_WIDTH_G when USE_BUILT_IN_G = true 144 report "Invalid DATA_WIDTH_G or ADDR_WIDTH_G for built-in FIFO configuration" 146 ----------------------------------------------------------------- 147 -- DATA_WIDTH | FIFO_SIZE | FIFO Depth | RDCOUNT/WRCOUNT Width -- 148 -- ===========|===========|============|=======================-- 149 -- 37-72 | "36Kb" | 512 | 9-bit -- 150 -- 19-36 | "36Kb" | 1024 | 10-bit -- 151 -- 19-36 | "18Kb" | 512 | 9-bit -- 152 -- 10-18 | "36Kb" | 2048 | 11-bit -- 153 -- 10-18 | "18Kb" | 1024 | 10-bit -- 154 -- 5-9 | "36Kb" | 4096 | 12-bit -- 155 -- 5-9 | "18Kb" | 2048 | 11-bit -- 156 -- 1-4 | "36Kb" | 8192 | 13-bit -- 157 -- 1-4 | "18Kb" | 4096 | 12-bit -- 158 ----------------------------------------------------------------- 159 -- FULL_THRES_G upper range check 161 report "FULL_THRES_G must be <= ((2**ADDR_WIDTH_G)-1)" 163 -- EMPTY_THRES_G upper range check 165 report "EMPTY_THRES_G must be <= ((2**ADDR_WIDTH_G)-2)" 169 report "USE_DSP48_G must be either yes, no, auto, or automax" 172 ------------------------------- 174 ------------------------------- 175 RstSync_FULL :
entity work.
RstSync 193 RstSync_FIFO :
entity work.
RstSync 202 RstSync_RD :
entity work.
RstSync 212 RstSync_EMPTY :
entity work.
RstSync 222 FIFO_DUALCLOCK_MACRO_inst : FIFO_DUALCLOCK_MACRO
224 DEVICE =>
XIL_DEVICE_G,
-- Target Device: "VIRTEX5", "VIRTEX6", "7SERIES" 225 ALMOST_FULL_OFFSET => x"000F",
-- Sets almost full threshold 226 ALMOST_EMPTY_OFFSET => x"000F",
-- Sets the almost empty threshold 227 DATA_WIDTH =>
DATA_WIDTH_G,
-- Valid values are 1-72 (37-72 only valid when FIFO_SIZE="36Kb") 228 FIFO_SIZE =>
FIFO_SIZE_C,
-- Target BRAM, "18Kb" or "36Kb" 229 FIRST_WORD_FALL_THROUGH =>
FWFT_EN_G) -- Sets the FIFO FWFT to TRUE or FALSE 232 WRCLK =>
wr_clk,
-- 1-bit input write clock 233 WREN =>
wrEn,
-- 1-bit input write enable 234 DI =>
din,
-- Input data, width defined by DATA_WIDTH parameter 235 WRCOUNT =>
wrAddrPntr,
-- Output write address pointer 236 WRERR =>
dummyWRERR,
-- 1-bit output write error 239 RDCLK =>
rd_clk,
-- 1-bit input read clock 240 RDEN =>
sRdEn,
-- 1-bit input read enable 241 DO =>
dataOut,
-- Output data, width defined by DATA_WIDTH parameter 242 RDCOUNT =>
rdAddrPntr,
-- Output read address pointer 243 RDERR =>
underflow,
-- 1-bit output read error 248 ------------------------------- 250 ------------------------------- 263 -- Calculate wr_data_count 276 if rising_edge(wr_clk) then 286 if rising_edge(wr_clk) then 294 ------------------------------- 296 ------------------------------- 309 -- Calculate rd_data_count 318 FIFO_Gen : if (FWFT_EN_G = false) generate 324 if rising_edge(rd_clk) then 333 FWFT_Gen : if (FWFT_EN_G = true) generate 359 end architecture mapping;
out wr_data_countslv( ADDR_WIDTH_G- 1 downto 0)
USE_DSP48_Gstring := "no"
sl := '0' dummyALMOSTEMPTY
slv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0') wrAddrPntr
out rd_data_countslv( ADDR_WIDTH_G- 1 downto 0)
RST_ASYNC_Gboolean := false
DATA_WIDTH_Ginteger range 1 to 72:= 18
out doutslv( DATA_WIDTH_G- 1 downto 0)
ADDR_WIDTH_Ginteger range 9 to 13:= 10
FULL_THRES_Ginteger range 1 to 8190:= 1
RST_ASYNC_Gboolean := false
integer :=(( 2** ADDR_WIDTH_G)- 1) FIFO_LENGTH_C
sl := '0' dummyALMOSTFULL
in dataInslv( WIDTH_G- 1 downto 0)
string GetFifoTyped_width,a_width,
EMPTY_THRES_Ginteger range 1 to 8190:= 1
XIL_DEVICE_Gstring := "7SERIES"
string := GetFifoType( DATA_WIDTH_G, ADDR_WIDTH_G) FIFO_SIZE_C
FWFT_EN_Gboolean := false
slv( DATA_WIDTH_G- 1 downto 0) dataOut
RELEASE_DELAY_Ginteger range 3 to positive'high:= 3
SYNC_STAGES_Ginteger range 3 to ( 2** 24):= 3
slv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0') rdGrayPntr
in dinslv( DATA_WIDTH_G- 1 downto 0)
out dataOutslv( WIDTH_G- 1 downto 0)
in rstsl :=not RST_POLARITY_G
slv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0') rcnt
PIPE_STAGES_Gnatural range 0 to 16:= 1
slv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0') rdAddrPntr
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16
in sDataslv( DATA_WIDTH_G- 1 downto 0)
in rstsl :=not RST_POLARITY_G
out mDataslv( DATA_WIDTH_G- 1 downto 0)
slv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0') wcnt
PIPE_STAGES_Gnatural range 0 to 16:= 0
slv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0') wrGrayPntr