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_L1CaloHubRodInputCaptureRegisters.
all;
20 packet_version : std_logic_vector(2 downto 0) := "001";
21 addr_width_64 : integer := 4;
27 ipb_clk : in std_logic;
28 ipb_rst : in std_logic;
30 ipb_out : out ipb_rbus;
31 pp_clock : in std_logic;
32 current_chan : in STD_LOGIC_VECTOR (4 downto 0);
33 s_tdata : in STD_LOGIC_VECTOR (63 downto 0);
34 s_tvalid : in std_logic;
35 s_tlast : in std_logic;
36 s_header_mark : in std_logic;
37 poll_chan : in std_logic;
38 timeout_err : in std_logic
46 packet_version :
std_logic_vector(
2 downto 0) := "
001";
47 addr_width :
integer := (addr_width_64);
52 pp_clock :
in std_logic;
53 ipb_rst :
in std_logic;
54 input_capture_control :
in std_logic_vector(
31 downto 0);
55 s_tvalid :
in std_logic;
56 s_tlast :
in std_logic;
57 s_tdata :
in std_logic_vector(
63 downto 0);
58 poll_chan :
in std_logic;
60 current_chan :
in std_logic_vector(
4 downto 0);
61 selected_chan :
in std_logic_vector(
4 downto 0);
63 timeout_err :
in std_logic;
65 pkt_count :
out std_logic_vector(
31 downto 0);
67 input_header :
out std_logic_vector(
63 downto 0);
68 input_trailer :
out std_logic_vector(
63 downto 0);
69 capture_status :
out std_logic_vector(
31 downto 0);
70 header_crc9_error :
out std_logic;
71 payload_crc20_error :
out std_logic;
72 length_error :
out std_logic;
74 spy_we :
out std_logic;
75 spy_addr :
out std_logic_vector(addr_width
-1 downto 0)
79 component ipbus_dpram
is
81 ADDR_WIDTH:
positive := addr_width_64;
82 DATA_WIDTH:
positive :=
32
89 ipb_out:
out ipb_rbus;
91 we:
in std_logic := '
0';
92 d:
in std_logic_vector(DATA_WIDTH
- 1 downto 0) := (
others => '
0');
93 q:
out std_logic_vector(DATA_WIDTH
- 1 downto 0);
94 addr:
in std_logic_vector(ADDR_WIDTH
- 1 downto 0)
102 signal version : std_logic_vector(3 downto 0);
104 signal ipbw: ipb_wbus_array(N_SLAVES - 1 downto 0);
105 signal ipbr: ipb_rbus_array(N_SLAVES - 1 downto 0);
106 signal capture_control_reg_rst : std_logic;
107 signal capture_control_reg_stb : std_logic;
108 signal input_capture_control : std_logic_vector(31 downto 0);
110 signal clear : std_logic;
111 signal clear_s : std_logic;
112 signal clear_s_del : std_logic;
113 signal armed : std_logic;
114 signal armed_s : std_logic;
115 signal armed_s_del : std_logic;
116 signal armed_pulse : std_logic;
117 signal armed_stat : std_logic;
118 signal triggered : std_logic;
119 signal capture : std_logic;
120 signal tvalid_prev : std_logic;
121 signal l_header_marker : std_logic;
130 signal capture_status : std_logic_vector(31 downto 0);
132 signal pkt_count : std_logic_vector(31 downto 0);
134 signal selected_chan : std_logic_vector(31 downto 0);
136 signal input_header : std_logic_vector(63 downto 0);
137 signal input_trailer : std_logic_vector(63 downto 0);
138 signal header_crc9_error : std_logic;
139 signal payload_crc20_error : std_logic;
140 signal length_error : std_logic;
142 signal spy_we : std_logic;
143 signal spy_addr : std_logic_vector(addr_width_64 - 1 downto 0);
144 signal spy_reset : std_logic;
147 signal ipb_mux_data: std_logic_vector(31 downto 0);
148 signal capture_data_lsw : std_logic_vector(31 downto 0);
149 signal capture_data_msw : std_logic_vector(31 downto 0);
150 signal ipb_strobe_lsw : std_logic;
151 signal ipb_strobe_msw : std_logic;
152 signal ipb_rdata_lsw : std_logic_vector(31 downto 0);
153 signal ipb_rdata_msw : std_logic_vector(31 downto 0);
155 signal ipb_in_lsw: ipb_wbus;
156 signal ipb_out_lsw: ipb_rbus;
157 signal ipb_in_msw: ipb_wbus;
158 signal ipb_out_msw: ipb_rbus;
162 fabric:
entity work.ipbus_fabric_sel
165 SEL_WIDTH => IPBUS_SEL_WIDTH
)
170 sel => ipbus_sel_L1CaloHubRodInputCaptureRegisters
(ipb_in.ipb_addr
),
171 ipb_to_slaves => ipbw,
172 ipb_from_slaves => ipbr
176 Input_channel_select_reg:
entity work.ipbus_reg_v
180 ipbus_in => ipbw
(N_SLV_input_channel_select
),
181 ipbus_out => ipbr
(N_SLV_input_channel_select
),
182 q
(0) => selected_chan
188 Capture_Control_reg:
entity work.ipbus_reg_v
191 reset => capture_control_reg_rst,
192 ipbus_in => ipbw
(N_SLV_INPUT_CAPTURE_CONTROL
),
193 ipbus_out => ipbr
(N_SLV_INPUT_CAPTURE_CONTROL
),
194 stb
(0) => capture_control_reg_stb,
195 q
(0) => input_capture_control
197 capture_control_reg_rst <= capture_control_reg_stb or ipb_rst;
199 Capture_status_reg:
entity work.ipbus_syncreg_v
207 ipb_in => ipbw
(N_SLV_INPUT_CAPTURE_STATUS
),
208 ipb_out => ipbr
(N_SLV_INPUT_CAPTURE_STATUS
),
210 d
(0) => capture_status,
211 qmask =>
(others =>
(others => '1'
)),
217 Header_0_reg:
entity work.ipbus_syncreg_v
225 ipb_in => ipbw
(N_SLV_HEADER_0
),
226 ipb_out => ipbr
(N_SLV_HEADER_0
),
228 d
(0) => input_header
(31 downto 0),
229 qmask =>
(others =>
(others => '1'
)),
236 Header_1_reg:
entity work.ipbus_syncreg_v
244 ipb_in => ipbw
(N_SLV_HEADER_1
),
245 ipb_out => ipbr
(N_SLV_HEADER_1
),
247 d
(0) => input_header
(63 downto 32),
248 qmask =>
(others =>
(others => '1'
)),
255 trailer_0_reg:
entity work.ipbus_syncreg_v
263 ipb_in => ipbw
(N_SLV_TRAILER_0
),
264 ipb_out => ipbr
(N_SLV_TRAILER_0
),
266 d
(0) => input_trailer
(31 downto 0),
267 qmask =>
(others =>
(others => '1'
)),
272 trailer_1_reg:
entity work.ipbus_syncreg_v
280 ipb_in => ipbw
(N_SLV_TRAILER_1
),
281 ipb_out => ipbr
(N_SLV_TRAILER_1
),
283 d
(0) => input_trailer
(63 downto 32),
284 qmask =>
(others =>
(others => '1'
)),
289 pkt_count_reg:
entity work.ipbus_syncreg_v
297 ipb_in => ipbw
(N_SLV_PKT_COUNT
),
298 ipb_out => ipbr
(N_SLV_PKT_COUNT
),
301 qmask =>
(others =>
(others => '1'
)),
306 capture_lsw : ipbus_dpram
308 ADDR_WIDTH => addr_width_64,
314 ipb_in => ipb_in_lsw,
315 ipb_out => ipb_out_lsw,
318 d => s_tdata
(31 downto 0),
319 q => capture_data_lsw,
324 capture_msw : ipbus_dpram
326 ADDR_WIDTH => addr_width_64,
332 ipb_in => ipb_in_msw,
333 ipb_out => ipb_out_msw,
336 d => s_tdata
(63 downto 32),
337 q => capture_data_msw,
343 ipb_in_lsw.ipb_strobe <= ipbw(N_SLV_TRACE_Memory).ipb_strobe and not ipbw(N_SLV_TRACE_MEMORY).ipb_addr(0);
344 ipb_in_msw.ipb_strobe <= ipbw(N_SLV_TRACE_Memory).ipb_strobe and ipbw(N_SLV_TRACE_MEMORY).ipb_addr(0);
346 ipb_in_lsw.ipb_addr(addr_width_64 -1 downto 0) <= ipbw(N_SLV_TRACE_MEMORY).ipb_addr((addr_width_64) downto 1);
347 ipb_in_msw.ipb_addr(addr_width_64 -1 downto 0) <= ipbw(N_SLV_TRACE_MEMORY).ipb_addr((addr_width_64) downto 1);
349 ipb_in_lsw.ipb_wdata <= ipbw(N_SLV_TRACE_MEMORY).ipb_wdata;
350 ipb_in_msw.ipb_wdata <= ipbw(N_SLV_TRACE_MEMORY).ipb_wdata;
352 ipb_in_lsw.ipb_write <= ipbw(N_SLV_TRACE_MEMORY).ipb_write and not ipbw(N_SLV_TRACE_MEMORY).ipb_addr(0);
353 ipb_in_msw.ipb_write <= ipbw(N_SLV_TRACE_MEMORY).ipb_write and ipbw(N_SLV_TRACE_MEMORY).ipb_addr(0);
357 with ipbw(N_SLV_TRACE_MEMORY).ipb_addr(0) select
358 ipbr(N_SLV_TRACE_MEMORY).ipb_rdata <= ipb_out_lsw.ipb_rdata when '0',
359 ipb_out_msw.ipb_rdata when others;
362 with ipbw(N_SLV_TRACE_MEMORY).ipb_addr(0) select
363 ipbr(N_SLV_TRACE_MEMORY).ipb_ack <= ipb_out_lsw.ipb_ack when '0',
364 ipb_out_msw.ipb_ack when others;
367 with ipbw(N_SLV_TRACE_MEMORY).ipb_addr(0) select
368 ipbr(N_SLV_TRACE_MEMORY).ipb_err <= ipb_out_lsw.ipb_err when '0',
369 ipb_out_msw.ipb_err when others;
374 spy_reset <= ipb_rst or input_capture_control(1);
388 packet_version => "
001",
389 addr_width => addr_width_64
393 pp_clock => pp_clock,
395 input_capture_control => input_capture_control,
396 s_tvalid => s_tvalid,
399 poll_chan => poll_chan,
401 current_chan => current_chan,
402 selected_chan => selected_chan
(4 downto 0),
403 timeout_err => timeout_err,
404 pkt_count => pkt_count,
406 input_header => input_header,
407 input_trailer => input_trailer,
408 capture_status => capture_status,
409 header_crc9_error =>
open,
410 payload_crc20_error =>
open,
411 length_error =>
open,