2 use IEEE.STD_LOGIC_1164.
ALL;
3 use ieee.std_logic_unsigned.
all;
4 use IEEE.NUMERIC_STD.
ALL;
8 use work.ipbus_decode_L1CaloHubRodPktCaptureRegisters.
all;
20 packet_version : std_logic_vector(2 downto 0) := "001";
26 ipb_clk : in std_logic;
27 ipb_rst : in std_logic;
29 ipb_out : out ipb_rbus;
30 pp_clock : in std_logic;
31 full_mode_stat : in STD_LOGIC_VECTOR (31 downto 0);
32 m_tdata : in STD_LOGIC_VECTOR (63 downto 0);
33 m_tvalid : in std_logic;
34 m_tlast : in std_logic;
35 m_header_marker : in std_logic
41 COMPONENT pkt_capture_ila
45 probe0 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
46 probe1 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
47 probe2 :
IN STD_LOGIC_VECTOR(
63 DOWNTO 0);
48 probe3 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
49 probe4 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
50 probe5 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
51 probe6 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
52 probe7 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
53 probe8 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
54 probe9 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
55 probe10 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
56 probe11 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0)
62 signal version : std_logic_vector(3 downto 0);
64 signal ipbw: ipb_wbus_array(N_SLAVES - 1 downto 0);
65 signal ipbr: ipb_rbus_array(N_SLAVES - 1 downto 0);
66 signal capture_control_reg_rst : std_logic;
67 signal capture_control_reg_stb : std_logic;
68 signal pkt_capture_control : std_logic_vector(31 downto 0);
70 signal clear : std_logic;
71 signal clear_s : std_logic;
72 signal clear_s_del : std_logic;
73 signal armed : std_logic;
74 signal armed_s : std_logic;
75 signal armed_s_del : std_logic;
76 signal armed_pulse : std_logic;
77 signal armed_stat : std_logic;
78 signal triggered : std_logic;
79 signal capture : std_logic;
80 signal tvalid_prev : std_logic;
81 signal l_header_marker : std_logic;
83 signal m_header_marker_2 : std_logic;
84 signal header_0 : std_logic_vector(63 downto 0);
85 signal header_0_i : std_logic_vector(31 downto 0);
86 signal header_2 : std_logic_vector(31 downto 0);
87 signal trailer : std_logic_vector(63 downto 0);
88 signal header_1 : std_logic_vector(31 downto 0);
89 signal trailer_1 : std_logic_vector(31 downto 0);
91 signal incomp_pkt : std_logic;
92 signal capture_status : std_logic_vector(31 downto 0);
94 signal pkt_count : std_logic_vector(31 downto 0);
100 fabric:
entity work.ipbus_fabric_sel
103 SEL_WIDTH => IPBUS_SEL_WIDTH
)
108 sel => ipbus_sel_L1CaloHubRodPktCaptureRegisters
(ipb_in.ipb_addr
),
109 ipb_to_slaves => ipbw,
110 ipb_from_slaves => ipbr
113 no_sim_regs: if SIM=0 generate
116 Capture_Control_reg:
entity work.ipbus_reg_v
119 reset => capture_control_reg_rst,
120 ipbus_in => ipbw
(N_SLV_PKT_CAPTURE_CONTROL
),
121 ipbus_out => ipbr
(N_SLV_PKT_CAPTURE_CONTROL
),
122 stb
(0) => capture_control_reg_stb,
123 q
(0) => pkt_capture_control
125 capture_control_reg_rst <= capture_control_reg_stb or ipb_rst;
127 Capture_status_reg:
entity work.ipbus_syncreg_v
135 ipb_in => ipbw
(N_SLV_PKT_CAPTURE_STATUS
),
136 ipb_out => ipbr
(N_SLV_PKT_CAPTURE_STATUS
),
138 d
(0) => capture_status,
139 qmask =>
(others =>
(others => '1'
)),
145 Header_0_reg:
entity work.ipbus_syncreg_v
153 ipb_in => ipbw
(N_SLV_HEADER_0
),
154 ipb_out => ipbr
(N_SLV_HEADER_0
),
156 d
(0) => header_0
(31 downto 0),
157 qmask =>
(others =>
(others => '1'
)),
165 Header_1_reg:
entity work.ipbus_syncreg_v
173 ipb_in => ipbw
(N_SLV_HEADER_1
),
174 ipb_out => ipbr
(N_SLV_HEADER_1
),
176 d
(0) => header_0
(63 downto 32),
177 qmask =>
(others =>
(others => '1'
)),
183 Header_2_reg:
entity work.ipbus_syncreg_v
191 ipb_in => ipbw
(N_SLV_HEADER_2
),
192 ipb_out => ipbr
(N_SLV_HEADER_2
),
194 d
(0) => header_2
(31 downto 0),
195 qmask =>
(others =>
(others => '1'
)),
200 trailer_0_reg:
entity work.ipbus_syncreg_v
208 ipb_in => ipbw
(N_SLV_TRAILER_0
),
209 ipb_out => ipbr
(N_SLV_TRAILER_0
),
211 d
(0) => trailer
(31 downto 0),
212 qmask =>
(others =>
(others => '1'
)),
217 trailer_1_reg:
entity work.ipbus_syncreg_v
225 ipb_in => ipbw
(N_SLV_TRAILER_1
),
226 ipb_out => ipbr
(N_SLV_TRAILER_1
),
228 d
(0) => trailer
(63 downto 32),
229 qmask =>
(others =>
(others => '1'
)),
234 pkt_count_reg:
entity work.ipbus_syncreg_v
242 ipb_in => ipbw
(N_SLV_PKT_COUNT
),
243 ipb_out => ipbr
(N_SLV_PKT_COUNT
),
246 qmask =>
(others =>
(others => '1'
)),
251 end generate no_sim_regs;
253 header_0_i <= header_0(31 downto 0);
265 process(pp_clock)
begin
266 if rising_edge (pp_clock) then
267 clear_s <= pkt_capture_control(1);
268 clear_s_del <= clear_s;
272 clear <= clear_s_del and not clear_s;
275 process(pp_clock)
begin
276 if rising_edge (pp_clock) then
277 armed_s <= pkt_capture_control(0);
278 armed_s_del <= armed_s;
282 armed_pulse <= armed_s_del and not armed_s;
284 process(pp_clock)
begin
285 if rising_edge (pp_clock) then
286 if (ipb_rst = '1') or (capture = '1') or (clear = '1') then
288 elsif (armed_pulse = '1') then
291 armed_stat <= armed_stat;
298 process (pp_clock)
begin
299 if rising_edge (pp_clock) then
300 if (ipb_rst = '1') or (clear = '1') then
303 tvalid_prev <= (not m_tvalid) or (m_tlast and m_tvalid);
308 l_header_marker <= m_tvalid and tvalid_prev and not m_tlast;
314 process(pp_clock)
begin
315 if rising_edge (pp_clock) then
316 if (ipb_rst = '1') or (clear = '1') then
318 elsif (armed_stat = '1') and (l_header_marker = '1') then
320 elsif (capture = '1') and (m_tlast = '1') then
329 process(pp_clock)
begin
330 if rising_edge (pp_clock) then
331 if (ipb_rst = '1') or (clear = '1') then
333 elsif (capture = '1') then
335 elsif (armed_pulse = '1') then
338 triggered <= triggered;
344 process(pp_clock)
begin
345 if rising_edge (pp_clock) then
346 if (clear = '1') then
347 header_0 <= (others => '0');
348 elsif (armed_stat = '1' ) and (l_header_marker = '1') then
351 header_0 <= header_0;
357 process(pp_clock)
begin
358 if rising_edge (pp_clock) then
359 m_header_marker_2 <= l_header_marker;
363 process(pp_clock)
begin
364 if rising_edge (pp_clock) then
365 if (clear = '1') then
366 header_2 <= (others => '0');
367 elsif (capture = '1' ) and (m_header_marker_2 = '1') then
368 header_2 <= m_tdata(31 downto 0);
370 header_2 <= header_2;
376 process(pp_clock)
begin
377 if rising_edge (pp_clock) then
378 if (clear = '1') then
379 trailer <= (others => '0');
380 elsif (capture = '1' ) and (m_tlast = '1') then
390 incomp_pkt <= capture;
393 capture_status <= '0' & packet_version & x"000000" & '0' & incomp_pkt & triggered & armed_stat;
396 process(pp_clock)
begin
397 if rising_edge (pp_clock) then
398 if (ipb_rst = '1') or (clear = '1') then
399 pkt_count <= (others => '0');
400 elsif (m_tlast = '1') and (m_tvalid = '1') then
401 pkt_count <= (pkt_count + 1);
403 pkt_count <= pkt_count;