otsdaq_prepmodernization  v2_05_02_indev
icmp_ping_shift_reg.vhd
1 -- Author: Ryan Rivera, FNAL
2 
3 library IEEE;
4 use IEEE.std_logic_1164.all;
5 
7  port (
8  clk : in std_logic;
9  us_clken : in std_logic;
10  ds_clken : in std_logic;
11 
12  din : in STD_LOGIC_VECTOR(7 downto 0);
13  dout : out STD_LOGIC_VECTOR(7 downto 0)
14  ) ;
15 end;
16 
17 
18 architecture arch of icmp_ping_shift_reg is
19 
20  constant SHR_DEPTH : natural := 44; -- was 33, but was not considering dest addr or type (so extraneous pings replies were occuring)
21  type shReg_t is array(natural range <>) of std_logic_vector(7 downto 0);
22  signal shReg : shReg_t(SHR_DEPTH-1 downto 0);
23  signal din_latch : STD_LOGIC_VECTOR(7 downto 0);
24 
25 begin
26 
27  dout <= shReg(SHR_DEPTH-1);
28  process(clk)
29  begin
30  if rising_edge(clk) then
31  if us_clken = '1' then
32  din_latch <= din;
33  end if;
34 
35  if ds_clken = '1' then
36  shReg <= shReg(SHR_DEPTH-2 downto 0) & din_latch;
37  end if;
38  end if;
39  end process;
40 
41 end arch;