11 use IEEE.STD_LOGIC_1164.
all;
12 use ieee.numeric_std.
all;
14 use ipbus_lib.ipbus.
all;
19 generic(ENABLE : in std_logic := '1'
43 mux_sel : out std_logic_vector(15 downto 0);
53 tx_pd : in std_logic_vector(3 downto 0);
55 rx_pd : in std_logic_vector(3 downto 0);
86 phase_mux : out std_logic_vector(15 downto 0);
134 signal ipbw : ipb_wbus_array(N_SLAVES-1 downto 0);
135 signal ipbr, ipbr_d : ipb_rbus_array(N_SLAVES-1 downto 0);
136 signal error_counter_reset : std_logic;
137 signal encode_error_int, rx_disperr_int,rdy, mgtdata_enable : std_logic_vector (3 downto 0);
138 signal softreset_rx_int, softreset_tx_int, error_counter_reset_int : std_logic;
139 signal control_reg, synch_reg, pulse_reg, quad_status, phase_reg : std_logic_vector (31 downto 0);
140 signal pulse_reset, softreset_rx_i, error_counter_reset_i, softreset_tx_i : std_logic;
141 signal clr_pulse_reg, cntr_reset,sel_bcn_or_bc_cnt : std_logic;
144 attribute keep : string ;
145 attribute max_fanout : integer;
146 attribute keep of softreset_tx_i : signal is "true" ;
147 attribute max_fanout of softreset_tx_i : signal is 40;
148 attribute keep of softreset_rx_i : signal is "true" ;
149 attribute max_fanout of softreset_rx_i : signal is 40;
150 attribute keep of error_counter_reset_i : signal is "true" ;
151 attribute max_fanout of error_counter_reset_i : signal is 40;
156 ENABLED_QUAD : if ENABLE = '1' generate
157 fabric_quad :
entity ipbus_lib.ipbus_fabric_sel
158 generic map(NSLV => N_SLAVES,
159 SEL_WIDTH => ipbus_sel_width
)
163 sel => ipbus_sel_efex_mgt_quad
(ipb_in.ipb_addr
),
164 ipb_to_slaves => ipbw,
165 ipb_from_slaves => ipbr
167 end generate ENABLED_QUAD;
169 DISABLED_QUAD : if ENABLE = '0' generate
170 fabric_quad :
entity ipbus_lib.ipbus_fabric_sel
171 generic map(NSLV => N_SLAVES,
172 SEL_WIDTH => ipbus_sel_width
)
174 ipb_in => IPB_WBUS_NULL,
176 sel =>
(others => '0'
),
177 ipb_to_slaves =>
open,
178 ipb_from_slaves =>
(others => IPB_RBUS_NULL
)
180 ipb_out <= (x"DEADBEEF", '1', '0');
181 end generate DISABLED_QUAD;
197 loopback <= control_reg(2 downto 0);
199 rdy <= control_reg( 11 downto 8);
200 mgtdata_enable <= control_reg( 15 downto 12);
202 mux_sel <= synch_reg (31 downto 16);
203 softreset_tx_int <= pulse_reg(0);
204 softreset_rx_int <= pulse_reg(1);
205 error_counter_reset_int <= pulse_reg(2);
209 phase_mux <= phase_reg(15 downto 0);
211 softreset_rx_pulse :
entity work.
led_stretch -- softresetrx pulse generator
213 input => softreset_rx_int,
218 softreset_tx_pulse :
entity work.
led_stretch -- softresettx pulse generator
220 input => softreset_tx_int,
225 error_counter_reset_pulse :
entity work.
led_stretch -- pulse generator
227 input => error_counter_reset_int,
229 output => error_counter_reset_i
232 cntr_reset <= error_counter_reset_i or softreset_rx_i;
233 pulse_reset <= softreset_rx_i or error_counter_reset_i or softreset_tx_i;
234 clr_pulse_reg <= ipb_rst or pulse_reset;
236 MGT_QUAD_Control :
entity ipbus_lib.ipbus_ctrlreg_v --- control
register
243 ipbus_in => ipbw
(N_SLV_QUAD_MGT_CONTROL
),
244 ipbus_out => ipbr
(N_SLV_QUAD_MGT_CONTROL
),
245 d =>
(others =>
(others => '0'
)) ,
249 MGT_QUAD_Synch:
entity ipbus_lib.ipbus_ctrlreg_v -- reads the module ID
register
256 ipbus_in => ipbw
(N_SLV_QUAD_SYNCH_CONTROL
),
257 ipbus_out => ipbr
(N_SLV_QUAD_SYNCH_CONTROL
),
258 d =>
(others =>
(others => '0'
)) ,
262 MGT_QUAD_Pulse:
entity ipbus_lib.ipbus_ctrlreg_v -- reads the module ID
register
268 reset => clr_pulse_reg,
269 ipbus_in => ipbw
(N_SLV_QUAD_MGT_PULSE
),
270 ipbus_out => ipbr
(N_SLV_QUAD_MGT_PULSE
),
271 d =>
(others =>
(others => '0'
)) ,
275 MGT_QUAD_status:
entity ipbus_lib.ipbus_ctrlreg_v
282 ipbus_in => ipbw
(N_SLV_QUAD_MGT_STATUS
),
283 ipbus_out => ipbr
(N_SLV_QUAD_MGT_STATUS
),
284 d =>
(0 => quad_status
) ,
288 MGT_QUAD_PHASE:
entity ipbus_lib.ipbus_ctrlreg_v -- reads the module ID
register
295 ipbus_in => ipbw
(N_SLV_QUAD_PHASE_CONTROL
),
296 ipbus_out => ipbr
(N_SLV_QUAD_PHASE_CONTROL
),
297 d =>
(others =>
(others => '0'
)) ,
303 generic map (addr_width =>
8)
312 ipb_in => ipbw
(N_SLV_GT0
),
338 generic map (addr_width =>
8)
347 ipb_in => ipbw
(N_SLV_GT1
),
373 generic map (addr_width =>
8)
382 ipb_in => ipbw
(N_SLV_GT2
),
408 generic map (addr_width =>
8)
417 ipb_in => ipbw
(N_SLV_GT3
),
out output std_logic
output
in delay_cntr_2 std_logic_vector( 3 downto 0)
first stage delay count of gt2
in qpll_lock std_logic
qpll lock of the MGT if high
out mgt_enable std_logic_vector( 3 downto 0)
mgt enable of the quad
out softreset_rx std_logic
rx soft reset of the quad
in clk40 std_logic
fabric clock of 40MHz
in bc_cntr_1 std_logic_vector( 6 downto 0)
bc value of gt1
in ipb_rst std_logic
ipbus reset
out ram_data_gt0 std_logic_vector( 227 downto 0)
ram_data from the plyback ram gt0
in BCR_in std_logic
BCR from TTC information.
in delay_cntr_1 std_logic_vector( 3 downto 0)
first stage delay count of gt1
in rx_pd std_logic_vector( 3 downto 0)
power control for rx side of the mgt
in tx_resetdone std_logic_vector( 3 downto 0)
tx reset done of the quad if high is done
in rx_realign std_logic_vector( 3 downto 0)
rx realign status
out bc_reg_sel std_logic_vector( 15 downto 0)
BC level mux setting value.
in crc_error std_logic_vector( 3 downto 0)
crc error of the quad
in tx_pd std_logic_vector( 3 downto 0)
power control for tx side of the mgt
in bc_mux_cntr_3 std_logic_vector( 6 downto 0)
bc value after the mux gt3
out loopback std_logic_vector( 2 downto 0)
Loopback Ports.
out ram_data_gt2 std_logic_vector( 227 downto 0)
ram_data from the plyback ram gt2
in rxclk280 std_logic_vector( 3 downto 0)
rxclk
in bc_cntr_0 std_logic_vector( 6 downto 0)
bc value of gt0
in bc_mux_cntr_1 std_logic_vector( 6 downto 0)
bc value after the mux gt1
out mux_sel std_logic_vector( 15 downto 0)
first stage sync mux setting value
in tx_bufstatus std_logic_vector( 7 downto 0)
tx buffer status
in delay_cntr_3 std_logic_vector( 3 downto 0)
first stage delay count of gt3
out ram_data_gt3 std_logic_vector( 227 downto 0)
ram_data from the plyback ram gt3
in rx_resetdone std_logic_vector( 3 downto 0)
rx reset done of the quad if high is done
in tx_fsm_resetdone std_logic_vector( 3 downto 0)
tx fsm reset done of the quad if high is done
in rx_byteisaligned std_logic_vector( 3 downto 0)
RX Byte and Word Alignment.
in delay_cntr_0 std_logic_vector( 3 downto 0)
first stage delay count of gt0
out notable_error std_logic_vector( 3 downto 0)
notable_error
in clk280 std_logic
fabric clock 280MHz
in rx_disperr std_logic_vector( 15 downto 0)
rx disperr error
in ipb_clk std_logic
ipbus clock
in bc_cntr_2 std_logic_vector( 6 downto 0)
bc value of gt2
in rxdata_gt3 std_logic_vector( 31 downto 0)
rx_data from gt3
out ipb_out ipb_rbus
IPBus output bus going from slaves to master.
in rx_fsm_resetdone std_logic_vector( 3 downto 0)
rx fsm reset done of the quad if high is done
in bc_cntr_3 std_logic_vector( 6 downto 0)
bc value of gt3
out disperr_error std_logic_vector( 3 downto 0)
disperr_error
in bc_mux_cntr_0 std_logic_vector( 6 downto 0)
bc value after the mux gt0
in ipb_in ipb_wbus
IPBus input bus going from master to slaves.
in rxdata_gt0 std_logic_vector( 31 downto 0)
rx_data from gt0
in encode_error std_logic_vector( 15 downto 0)
B/10B Decoder error.
in bc_mux_cntr_2 std_logic_vector( 6 downto 0)
bc value after the mux gt2
in qpll_refclklost std_logic
qpll refrence clcok lost if high
in rxdata_gt2 std_logic_vector( 31 downto 0)
rx_data from gt2
out softreset_tx std_logic
tx soft reset of the quad
out ram_data_gt1 std_logic_vector( 227 downto 0)
ram_data from the plyback ram gt1
in rxdata_gt1 std_logic_vector( 31 downto 0)
rx_data from gt1