6 use ieee.std_logic_1164.
all;
7 use ieee.numeric_std.
all;
9 LIBRARY infrastructure_lib;
13 USE ipbus_lib.ipbus.
all;
17 RAM_ADDR_WIDTH : positive := 10
20 clk_320 : in std_logic;
21 rst_320 : in std_logic;
23 tob_mgt_packet_err_bus : in std_logic_vector(3 downto 0);
24 tob_mgt_length_err_bus : in std_logic_vector(3 downto 0);
25 tob_mgt_last_l1id_bus : in mgt_data_array(3 downto 0);
27 L1A_seen : in std_logic;
28 Last_L1ID_merged : in std_logic_vector(31 downto 0);
30 merged_fifo_data : in packet_data_array(1 downto 0);
31 merged_fifo_valid : in std_logic_vector(1 downto 0);
32 merged_fifo_last : in std_logic_vector(1 downto 0);
34 clk_ipb : in std_logic;
35 rst_ipb : in std_logic;
36 rst_ipbus_addr : in std_logic;
37 ipbus_wraparound : in std_logic;
39 ipb_out : out ipb_rbus
47 IPBUS_ADDR_WIDTH :
positive :=
10
51 clk_320 :
in std_logic;
52 rst_320 :
in std_logic;
53 fifo_data :
in std_logic_vector (
63 DOWNTO 0);
54 fifo_valid :
in std_logic;
55 fifo_last :
in std_logic;
56 fifo_tready :
in std_logic;
58 clk_ipb :
in std_logic;
59 rst_ipb :
in std_logic;
60 rst_ipbus_addr :
in std_logic;
61 ipbus_wraparound :
in std_logic;
63 ipb_out :
out ipb_rbus
65 END Component fifo_spy;
67 signal bad_l1id_sig, send_tob_sig, spy_last_sig, spy_valid_sig: std_logic;
68 signal spy_data_sig: std_logic_vector (63 DOWNTO 0);
76 Bad_mgt_L1ID_latch:
process(clk_320)
77 variable error_pending_bus: std_logic_vector(3 downto 0) := (Others => '0');
78 variable last_error_l1id_bus: mgt_data_array(3 downto 0) := (Others => (Others => '0'));
79 variable found_bad_l1id: std_logic := '0';
81 if (rising_edge(clk_320)) then
82 if (rst_320 = '1') then
83 error_pending_bus := (Others => '0');
84 for i in 3 downto 0 loop
85 last_error_l1id_bus(i) := (Others => '0');
88 found_bad_l1id := '0';
89 for i in 3 downto 0 loop
90 if (L1A_seen = '1') and (error_pending_bus(i) = '1') and (Last_L1ID_merged = last_error_l1id_bus(i)) then
91 error_pending_bus(i) := '0';
92 found_bad_l1id := '1';
94 if (tob_mgt_packet_err_bus(i) = '1') or (tob_mgt_length_err_bus(i) = '1') then
95 last_error_l1id_bus(i) := tob_mgt_last_l1id_bus(i);
96 error_pending_bus(i) := '1';
100 bad_l1id_sig <= found_bad_l1id;
102 end process Bad_mgt_L1ID_latch;
105 send_tob_latch:
process(clk_320)
106 variable send_tob: std_logic := '0';
108 if (rising_edge(clk_320)) then
109 if (rst_320 = '1') or (L1A_seen = '1') then
111 elsif (bad_l1id_sig = '1') or (merged_fifo_valid(1) = '1') then
114 send_tob_sig <= send_tob;
116 end process send_tob_latch;
118 send_to_spy_block:
process(clk_320)
119 variable spy_data: std_logic_vector(63 downto 0);
120 variable spy_valid, spy_last: std_logic;
122 if (rising_edge(clk_320)) then
123 if (merged_fifo_valid(1) = '1') then
124 spy_data := merged_fifo_data(1);
125 spy_last := merged_fifo_last(1);
127 elsif (merged_fifo_valid(0) = '1') and (send_tob_sig = '1') then
128 spy_data := merged_fifo_data(0);
129 spy_last := merged_fifo_last(0);
132 spy_data := (Others => '0');
136 spy_data_sig <= spy_data;
137 spy_last_sig <= spy_last;
138 spy_valid_sig <= spy_valid;
140 end process send_to_spy_block;
144 IPBUS_ADDR_WIDTH => RAM_ADDR_WIDTH
150 fifo_data => spy_data_sig,
151 fifo_valid => spy_valid_sig,
152 fifo_last => spy_last_sig,
157 rst_ipbus_addr => rst_ipbus_addr,
158 ipbus_wraparound => ipbus_wraparound,
163 END Architecture rtl;
Capture FIFO traffic into IPBus DPRAM64...