1 ------------------------------------------------------------------------------- 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-09-14 5 -- Last update: 2016-06-03 6 ------------------------------------------------------------------------------- 7 -- Description: Shift Register Delay module for std_logic_vectors 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 --! @ingroup base_general 31 SRL_EN_G : := false;
-- Allow an SRL to be inferred. Disables reset. 32 DELAY_G : := 1;
--number of clock cycle delays. MAX delay stages when using 34 REG_OUTPUT_G : := false; --
For use with Dynamic SRLs, adds extra delay
register on output
40 en : in sl := '1';
-- Optional clock enable 52 type RegType is record 55 constant REG_INIT_C : RegType := ( 56 shift => (others => INIT_C));
58 signal r : RegType := REG_INIT_C;
64 constant SRL_C : := ite(SRL_EN_G, "YES", "NO");
65 attribute shreg_extract : ;
66 attribute shreg_extract of r : signal is SRL_C;
70 NO_DELAY : if (DELAY_G = 0) generate 72 end generate NO_DELAY;
74 YES_DELAY : if (DELAY_G > 0) generate 76 iDelay <= conv_integer(delay);
78 comb :
process (
din,
en, iDelay, r,
rst)
is 81 -- Latch the current value 84 -- Check for clock enable 88 -- Check for multi-stage delay 100 -- Register the variable for next clock cycle 104 iDout <= r.shift(iDelay);
108 seq :
process (
clk)
is 110 if rising_edge(clk) then 111 r <= rin after TPD_G;
116 REG:
process (
clk)
is 118 if (rising_edge(clk)) then 126 end generate OUT_REG;
130 end generate NO_OUT_REG;
132 end generate YES_DELAY;
in dinslv( WIDTH_G- 1 downto 0)
REG_OUTPUT_Gboolean := false
in rstsl :=not RST_POLARITY_G
in delayslv( log2(DELAY_G )- 1 downto 0) := toSlv( DELAY_G- 1, log2(DELAY_G ))
out doutslv( WIDTH_G- 1 downto 0)