otsdaq_prepmodernization  v2_05_02_indev
dest_info_container.vhd
1 -- Author: Ryan Rivera, FNAL
2 
3 library IEEE;
4 use IEEE.std_logic_1164.all;
5 use IEEE.std_logic_arith.all;
6 use IEEE.std_logic_unsigned.all;
7 
8 -- this block latches the mac, ip, and port for the destination
9  -- field of UDP packets. Info is valid whenever a properly addressed single byte packet is received.
10  -- Only set the first time after RESET!
12  port (
13 
14  clk : in std_logic;
15  reset : in std_logic;
16  we : in std_logic;
17 
18  mac_from_udp : in std_logic_vector(47 downto 0);
19  ip_from_udp : in std_logic_vector(31 downto 0);
20  port_from_udp : in std_logic_vector(15 downto 0);
21 
22  dest_mac : out std_logic_vector(47 downto 0);
23  dest_ip : out std_logic_vector(31 downto 0);
24  dest_port : out std_logic_vector(15 downto 0)
25  ) ;
26 end;
27 
28 
29 architecture dest_info_container_arch of dest_info_container is
30 begin
31 
32  process(clk)
33  begin
34  if rising_edge(clk) then
35  if reset = '1' then
36 
37  dest_mac <= (others => '0');
38  dest_ip <= (others => '0');
39  dest_port <= (others => '0');
40 
41  -- change only if ping packet received (1 byte packet)
42  elsif we = '1' then
43 
44  dest_mac <= mac_from_udp;
45  dest_ip <= ip_from_udp;
46  dest_port <= port_from_udp;
47 
48  end if;
49  end if;
50  end process;
51 
52 end dest_info_container_arch;