eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
unique_address.vhd
1 -- First version of mapping function from geographic location to IP address...
2 --
3 -- Dave Sankey, May 2019
4 
5 library ieee;
6 use ieee.std_logic_1164.all;
7 use ieee.numeric_std.all;
8 
9 entity unique_address is
10  port (
11  mac_clk : in std_logic;
12  rst_macclk : in std_logic;
13  hardware_addr : in std_logic_vector (11 DOWNTO 0);
14  serial_number : in std_logic_vector (5 DOWNTO 0) := (others => '0');
15  mac_addr : out std_logic_vector(47 DOWNTO 0);
16  ip_addr : out std_logic_vector(31 DOWNTO 0);
17  enable : out std_logic;
18  use_dhcp : out std_logic
19  );
20 end unique_address;
21 
22 architecture efex of unique_address is
23 begin
24 
25 parse_address: process(mac_clk)
26  type eFEX_mapping_array is array(15 downto 0) of std_logic_vector(3 downto 0);
27  constant eFEX_mapping: eFEX_mapping_array := (x"C", x"B", x"0", x"A", x"1", x"9", x"2", x"8", x"3", x"7", x"4", x"6", x"5", x"C", x"C", x"C"); -- Logical Slot Address to eFEX number
28  constant mac_address_root: std_logic_vector(39 downto 0) := X"80D336003C";
29  variable enable_int, dhcp_int: std_logic := '0';
30  variable mac_addr_int: std_logic_vector(7 downto 0) := (others => '0');
31  variable ip_addr_int: std_logic_vector(31 downto 0) := (others => '0');
32  variable efex_number: std_logic_vector(5 downto 0);
33  begin
34  if rising_edge(mac_clk) then
35  if (rst_macclk = '1') then
36  enable_int := '1';
37  efex_number := "00" & eFEX_mapping(to_integer(unsigned(hardware_addr(3 downto 0))));
38  if (serial_number = "100101") or (serial_number = "000010") then -- Cambridge or Brummie eFEX sn 37 or 2
39  mac_addr_int := X"1" & efex_number(3 downto 0);
40  ip_addr_int := X"C0A80C0" & efex_number(3 downto 0);
41  dhcp_int := '0';
42  else
43  ip_addr_int := (Others => '0');
44  dhcp_int := '1';
45  case hardware_addr(11 downto 8) is
46  when x"0" => -- l1c-efc0
47  mac_addr_int := X"2" & efex_number(3 downto 0);
48  when x"1" => -- l1c-efc1
49  mac_addr_int := X"3" & efex_number(3 downto 0);
50  when x"C" => -- STF4
51  mac_addr_int := X"0" & efex_number(3 downto 0);
52  when Others =>
53  mac_addr_int := "10" & serial_number;
54  end case;
55  end if;
56  end if;
57  enable <= enable_int
58 -- pragma translate_off
59  after 4 ns
60 -- pragma translate_on
61  ;
62  use_dhcp <= dhcp_int
63 -- pragma translate_off
64  after 4 ns
65 -- pragma translate_on
66  ;
67  mac_addr <= mac_address_root & mac_addr_int
68 -- pragma translate_off
69  after 4 ns
70 -- pragma translate_on
71  ;
72  ip_addr <= ip_addr_int
73 -- pragma translate_off
74  after 4 ns
75 -- pragma translate_on
76  ;
77  end if;
78  end process parse_address;
79 
80 end efex;