1 ------------------------------------------------------------------------------- 2 -- File : FifoOutputPipeline.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2014-05-05 5 -- Last update: 2016-09-06 6 ------------------------------------------------------------------------------- 7 -- Description: This module is used to sync a FWFT FIFO bus 8 -- either as a pass through or with pipeline register stages. 9 ------------------------------------------------------------------------------- 10 -- This file is part of 'SLAC Firmware Standard Library'. 11 -- It is subject to the license terms in the LICENSE.txt file found in the 12 -- top-level directory of this distribution and at: 13 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 14 -- No part of 'SLAC Firmware Standard Library', including this file, 15 -- may be copied, modified, propagated, or distributed except according to 16 -- the terms contained in the LICENSE.txt file. 17 ------------------------------------------------------------------------------- 20 use ieee.std_logic_1164.
all;
25 --! @ingroup base_fifo 45 end FifoOutputPipeline;
53 type RegType is record 56 mData : DataArray(0 to PIPE_STAGES_C);
59 constant REG_INIT_C : RegType := ( 62 mData => (others => (others => '0')));
64 signal r : RegType := REG_INIT_C;
83 -- Latch the current value 86 -- Check if we need to shift register 87 if (r.mValid(PIPE_STAGES_C) = '0') or (mRdEn = '1') then 88 -- Shift the data up the pipeline 89 for i in PIPE_STAGES_C downto 2 loop 94 -- Check if the lowest cell is empty 98 -- Check if we were pulling the FIFO last clock cycle 100 -- Shift the FIFO data 104 -- Clear valid in stage 1 108 -- Shift the lowest cell 111 -- Check if we were pulling the FIFO last clock cycle 112 if r.sRdEn = '1' then 113 -- Reset the read bit 115 -- Fill the lowest cell 121 -- Reset the lowest cell mValid 126 -- Reset the read bit 128 -- Check if we were pulling the FIFO last clock cycle 129 if r.sRdEn = '1' then 130 -- Fill the lowest cell 133 elsif r.mValid(0) = '0' then 137 -- Check if we need to internally shift the data to remove gaps 138 for i in PIPE_STAGES_C-1 downto 1 loop 139 -- Check for empty cell ahead of a filled cell 141 -- Shift the lowest cell 155 -- Register the variable for next clock cycle 165 seq :
process (
clk,
rst)
is 167 if rising_edge(clk) then 168 r <= rin after TPD_G;
170 -- Asynchronous Reset 172 r <= REG_INIT_C after TPD_G;
RST_ASYNC_Gboolean := false
in rstsl :=not RST_POLARITY_G
PIPE_STAGES_Gnatural range 0 to 16:= 1
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)