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 SYNC 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"      70       if ((d_width >= 37) and (d_width <= 72) and (a_width = 9)) then    72       elsif ((d_width >= 19) and (d_width <= 36) and (a_width = 10)) then    74       elsif ((d_width >= 19) and (d_width <= 36) and (a_width = 9)) then    76       elsif ((d_width >= 10) and (d_width <= 18) and (a_width = 11)) then    78       elsif ((d_width >= 10) and (d_width <= 18) and (a_width = 10)) then    80       elsif ((d_width >= 5) and (d_width <= 9) and (a_width = 12)) then    82       elsif ((d_width >= 5) and (d_width <= 9) and (a_width = 11)) then    84       elsif ((d_width >= 1) and (d_width <= 4) and (a_width = 13)) then    86       elsif ((d_width >= 1) and (d_width <= 4) and (a_width = 12)) then    89          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)-2)"   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    RstSync_FULL : 
entity work.
RstSync   190    RstSync_FIFO : 
entity work.
RstSync   199    FIFO_SYNC_MACRO_Inst : FIFO_SYNC_MACRO
   201          DO_REG              => 
0,
  --DO_REG must be set to 0 for flags and data to follow a standard synchronous FIFO operation   202          DEVICE              => 
XIL_DEVICE_G,
  -- Target Device: "VIRTEX5", "VIRTEX6", "7SERIES"   205          DATA_WIDTH          => 
DATA_WIDTH_G,
  -- Valid values are 1-72 (37-72 only valid when FIFO_SIZE="36Kb")   206          FIFO_SIZE           => 
FIFO_SIZE_C)   -- Target BRAM, "18Kb" or "36Kb"   208          RST         => 
fifoRst,
        -- 1-bit input reset   209          CLK         => 
clk,
            -- 1-bit input clock   210          WREN        => 
wrEn,
           -- 1-bit input write enable   211          RDEN        => 
readEnable,
     -- 1-bit input read enable   212          DI          => 
din,
            -- Input data, width defined by DATA_WIDTH parameter   213          DO          => 
dataOut,
        -- Output data, width defined by DATA_WIDTH parameter   214          RDCOUNT     => 
rdAddrPntr,
     -- Output read count, width determined by FIFO depth   215          WRCOUNT     => 
wrAddrPntr,
     -- Output write count, width determined by FIFO depth   216          WRERR       => 
dummyWRERR,
     -- 1-bit output write error   217          RDERR       => 
underflow,
      -- 1-bit output read error   218          ALMOSTFULL  => 
progFull,
       -- 1-bit output almost full   219          ALMOSTEMPTY => 
progEmpty,
      -- 1-bit output almost empty   223    -- Calculate data count   236       if rising_edge(clk) then   246       if rising_edge(clk) then   259    FIFO_Gen : if (FWFT_EN_G = false) generate   268          if rising_edge(clk) then   278    FWFT_Gen : if (FWFT_EN_G = true) generate   307          if rising_edge(clk) then   319 end architecture mapping;
 
bit_vector  :=   to_bitvector(toSlv((   FIFO_LENGTH_C-   FULL_THRES_G), 16)  ) ALMOST_FULL_OFFSET_C
 
string GetFifoTyped_width,a_width,
 
out doutslv(   DATA_WIDTH_G- 1 downto  0)  
 
ADDR_WIDTH_Ginteger   range  9 to  13:= 10
 
PIPE_STAGES_Gnatural   range  0 to  16:= 0
 
ReadStatusType  :=(prog_empty  => '1',almost_empty  => '1',empty  => '1') READ_STATUS_INIT_C
 
FWFT_EN_Gboolean  :=   false
 
RELEASE_DELAY_Ginteger   range  3 to    positive'high:= 3
 
slv(   DATA_WIDTH_G- 1 downto  0)   dataOut
 
in dinslv(   DATA_WIDTH_G- 1 downto  0)  
 
out data_countslv(   ADDR_WIDTH_G- 1 downto  0)  
 
FULL_THRES_Ginteger   range  1 to  8190:= 1
 
XIL_DEVICE_Gstring  :=   "7SERIES"
 
EMPTY_THRES_Ginteger   range  1 to  8190:= 1
 
ReadStatusType  :=   READ_STATUS_INIT_C fifoStatus
 
DATA_WIDTH_Ginteger   range  1 to  72:= 18
 
integer  :=(( 2**   ADDR_WIDTH_G)- 1) FIFO_LENGTH_C
 
slv(   ADDR_WIDTH_G- 1 downto  0)  :=( others => '0') wrAddrPntr
 
in rstsl  :=not    RST_POLARITY_G
 
PIPE_STAGES_Gnatural   range  0 to  16:= 1
 
ReadStatusType  :=   READ_STATUS_INIT_C fwftStatus
 
string  :=   GetFifoType(   DATA_WIDTH_G,   ADDR_WIDTH_G) FIFO_SIZE_C
 
DATA_WIDTH_Ginteger   range  1 to ( 2** 24):= 16
 
in sDataslv(   DATA_WIDTH_G- 1 downto  0)  
 
out mDataslv(   DATA_WIDTH_G- 1 downto  0)  
 
USE_DSP48_Gstring  :=   "no"
 
slv(   ADDR_WIDTH_G- 1 downto  0)  :=( others => '0') rdAddrPntr
 
bit_vector  :=   to_bitvector(toSlv(   EMPTY_THRES_G, 16)  ) ALMOST_EMPTY_OFFSET_C
 
slv(   ADDR_WIDTH_G- 1 downto  0)  :=( others => '0') cnt