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

Back to eFEX documentation
synch_stg_1.vhd
Go to the documentation of this file.
1 
13 
14 
15 library IEEE;
16 use IEEE.STD_LOGIC_1164.ALL;
17 USE ieee.std_logic_arith.all;
18 LIBRARY xil_defaultlib;
19 
21 entity synch_stage_1 is
22  Port (
23 
25  clk_280 : in std_logic;
27  reset : in std_logic;
29  mux_cntrl : in std_logic_vector(3 downto 0);
31  latch_enable : in std_logic;
33  enable_mgt : in std_logic;
35  MGT_Commadet : in std_logic;
37  commdet_delay: out std_logic := '0';
39  data_in : in std_logic_vector(31 downto 0);
41  data_out : out std_logic_vector(227 downto 0);
43  align_frame : in std_logic;
45  disperr_error: in std_logic;
47  notable_error: in std_logic;
49  crc_error_in : in std_logic
50 
51 
52  );
53 end synch_stage_1;
55 architecture Behavioral of synch_stage_1 is
56 
57 signal data_int,data_int_i,data_temp_i,reg,reg1: std_logic_vector(35 downto 0):=(others => '0');
58 signal data_temp:std_logic_vector(35 downto 0):=(others => '0');
59 signal temp7,temp8,temp9,temp10,temp11,temp12:std_logic_vector(35 downto 0):=(others => '0');
60 signal data_out_int,reg0 : std_logic_vector(227 downto 0);
61 signal cntr_delay: unsigned( 3 downto 0);
62 signal mux_out,mux_out_i,datain_temp:std_logic_vector(36 downto 0):= (others=>'0');
63 signal disperr_error_i, notable_error_i, align_frame_i,crc_error_i: std_logic;
64 
65 
66 begin
67 
68 process (clk_280) -- This register captures the first data from the rx mgt
69 
70  begin
71  if clk_280' event and clk_280 ='1' then
72  -- the comma dected should always be the MSB in case if some other bits are added
74  data_int_i <= data_temp_i ;
75  end if;
76  end process;
77 
78  process (clk_280) -- This register captures the first data from the rx mgt
79 
80  begin
81  if clk_280' event and clk_280 ='1' then
82  if enable_mgt ='1' then
83  data_int <= data_int_i ;
84  else
85  data_int <= (others =>'0');
86  end if;
87  end if;
88  end process;
89 
90 commdet_delay <= mux_out(35);
91 datain_temp <= crc_error_in & data_int(35 downto 0);
92 ------------------------------------------------------------------------------------------------------
93  SRL_16E_35: entity work.SRL16E_35
94  port map (
95  clk => clk_280,
96  address => mux_cntrl,
97  data_in => datain_temp, -- data_int,
98  data_out => mux_out_i,
99  srl_en => '1' --enable_mgt
100  );
101 reg_mux_out_i: process (clk_280) -- register for mux_out_i
102 
103  begin
104 
105  if clk_280'event and clk_280 ='1' then
106  mux_out <= mux_out_i ;
107  end if;
108  end process;
109 
110 -------------------------------------------------------------------------------------------
111 Shifter_1: process (clk_280) -- Second stages of data shifter performs serial to parallel conversion
112 
113  begin
114 
115  if clk_280'event and clk_280 ='1' then
116  temp7 <= mux_out(36)& mux_out(34 downto 0);
117  temp8 <= temp7;
118  temp9 <= temp8;
119  temp10 <= temp9;
120  temp11 <= temp10;
121  temp12 <= temp11;
122  end if;
123  end process;
124 
125  notable_error_i <= mux_out(32) or temp7(32) or temp8(32) or temp9(32) or temp10(32) or temp11(32) or temp12(32) ;
126  disperr_error_i <= mux_out(33) or temp7(33) or temp8(33) or temp9(33) or temp10(33) or temp11(33) or temp12(33) ;
127  align_frame_i <= temp12(34); --only check the first word of the packet
128  crc_error_i <= mux_out(36);
129  data_out_int <= crc_error_i & align_frame_i & disperr_error_i & notable_error_i & mux_out(31 downto 0) & temp7(31 downto 0) & temp8(31 downto 0) & temp9(31 downto 0) & temp10(31 downto 0) & temp11(31 downto 0) & temp12(31 downto 0) ; -- Concatenate the shifted data in order to form 224 bits
130 
131 
132 Sipo_reg: process(clk_280) -- latch when data ready 224 bits, waits 7 clocks of 280MHz
133  begin
134  if clk_280'event and clk_280 ='1' then
135  if latch_enable ='1' then
136  data_out <= data_out_int ;--after 1 ns;
137  end if;
138  end if;
139  end process;
140 
141 end Behavioral;
shift register
Definition: srl16e_35.vhd:14
in clk std_logic
clock
Definition: srl16e_35.vhd:17
in srl_en std_logic
enable of shifter
Definition: srl16e_35.vhd:19
in data_in std_logic_vector( 36 downto 0)
data in
Definition: srl16e_35.vhd:23
out data_out std_logic_vector( 36 downto 0)
data out
Definition: srl16e_35.vhd:26
in address std_logic_vector( 3 downto 0)
shift depth
Definition: srl16e_35.vhd:21
First Stage Synchronisation of process FPGA.
Definition: synch_stg_1.vhd:55
First Stage Synchronisation of process FPGA.
Definition: synch_stg_1.vhd:21
in reset std_logic
reset
Definition: synch_stg_1.vhd:27
in clk_280 std_logic
MGT rx clock.
Definition: synch_stg_1.vhd:25
in MGT_Commadet std_logic
MGT commadet.
Definition: synch_stg_1.vhd:35
in latch_enable std_logic
latch enable of 226 bits
Definition: synch_stg_1.vhd:31
in align_frame std_logic
align frame
Definition: synch_stg_1.vhd:43
out data_out std_logic_vector( 227 downto 0)
frame data out of 226 bits
Definition: synch_stg_1.vhd:41
in mux_cntrl std_logic_vector( 3 downto 0)
first stage mux slect bits
Definition: synch_stg_1.vhd:29
in notable_error std_logic
nottable error
Definition: synch_stg_1.vhd:47
in disperr_error std_logic
disperr erro
Definition: synch_stg_1.vhd:45
in data_in std_logic_vector( 31 downto 0)
rx data
Definition: synch_stg_1.vhd:39
out commdet_delay std_logic := '0'
MGT commadet pipe.
Definition: synch_stg_1.vhd:37
in crc_error_in std_logic
crc error
Definition: synch_stg_1.vhd:52
in enable_mgt std_logic
MGT rx data regsiter enable.
Definition: synch_stg_1.vhd:33