ELGIP-129 Further testing cases for HPS-EMAC transactions and loopback. Fixes to tx_packet_combine found in test. Removal of packet generation and checking blocks from IP as not used in tests and consuming gates.

This commit is contained in:
Simon Southwell 2020-12-22 15:56:00 +00:00
commit 56afebaa30
4 changed files with 56 additions and 268 deletions

View file

@ -2236,7 +2236,7 @@ begin
MAC_RX_EOF_TOGGLE_D <= MAC_RX_EOF_TOGGLE;
MAC_RX_EOF_TOGGLE_D2 <= MAC_RX_EOF_TOGGLE_D;
if(MAC_RX_EOF_TOGGLE_D /= MAC_RX_EOF_TOGGLE_D2) then
if(MAC_RX_EOF_TOGGLE_D /= MAC_RX_EOF_TOGGLE_D2 or SYNC_RESET = '1') then
-- diagnostics were just updated. Safe to reclock with CLK now.
N_RX_FRAMES <= std_logic_vector(N_RX_FRAMES_local);
N_RX_BAD_CRCS <= std_logic_vector(N_RX_BAD_CRCS_local);

View file

@ -316,83 +316,8 @@
}
}
},
"tpg_ctrl" : {
"address" : "16",
"width" : "29",
"description" : "Test Pattern Generation Control",
"fields": {
"tpg_start" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0x0",
"description" : "TPG start"
},
"tpg_stop" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0x0",
"description" : "TPG stop"
},
"tpg_burst_size" : {
"type" : "w",
"bit_len" : "11",
"reset" : "0x0",
"description" : "Number of 64-bit words composing the burst. Shall be less than 1 MTU"
},
"tpg_burst_gap" : {
"type" : "w",
"bit_len" : "16",
"reset" : "0x0",
"description" : "Number clock cycles at 156.25 MHz between contiguous bursts"
}
}
},
"tpc_ctrl" : {
"address" : "17",
"width" : "3",
"description" : "Test Pattern Check Control",
"fields": {
"tpc_start" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0x0",
"description" : "TPC start"
},
"tpc_stop" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0x0",
"description" : "TPC stop"
},
"tpc_poll_error_req" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Request to poll the error status (tpc_errors)"
}
}
},
"tpc_status" : {
"address" : "18",
"width" : "17",
"description" : "Test Pattern Check Status",
"fields": {
"tpc_errors_is_valid" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0x0",
"description" : "tcp_errors field has a valid value"
},
"tpc_errors" : {
"type" : "r",
"bit_len" : "16",
"reset" : "0x0",
"description" : "Number of words affected by errors"
}
}
},
"mem_wr_if_ctrl" : {
"address" : "19",
"address" : "16",
"width" : "3",
"description" : "Memory write interface control",
"fields": {
@ -417,21 +342,21 @@
}
},
"mem_wr_if_base_addr" : {
"address" : "20",
"address" : "17",
"width" : "32",
"type" : "w",
"reset" : "0x20000000",
"description" : "Byte address of DMA circular buffer base"
},
"mem_wr_if_end_addr" : {
"address" : "21",
"address" : "18",
"width" : "32",
"type" : "w",
"reset" : "0x20010000",
"description" : "Byte address of DMA circular buffer end"
},
"mem_wr_if_status" : {
"address" : "22",
"address" : "19",
"width" : "2",
"description" : "Memory write interface status",
"fields": {

View file

@ -57,6 +57,7 @@ architecture rtl of tx_packet_combine_0 is
signal source_is_emac : std_logic;
signal packet_available : std_logic;
signal toe_tx_rts_d : std_logic;
signal toe_rx_eop_d : std_logic;
--
signal packet_cnt : std_logic_vector( 4 downto 0);
signal fifo_usew : std_logic_vector( 7 downto 0);
@ -126,12 +127,13 @@ begin
elsif(clk = '1' and clk'event) then
toe_tx_rts_d <= toe_tx_rts;
toe_rx_eop_d <= toe_tx_eop;
if(init = '1') then
packet_cnt <= (others => '0');
elsif(fifo_we = '1' and emac_tx_eop = '1') then
packet_cnt <= std_logic_vector(unsigned(packet_cnt)+1);
elsif(egress_completed = '1') then
elsif(egress_completed = '1' and toe_rx_eop_d = '0') then
packet_cnt <= std_logic_vector(unsigned(packet_cnt)-1);
end if;
@ -176,7 +178,7 @@ begin
egress_start <= '1' when egress_packet = '0' and (toe_tx_rts = '1' or packet_available = '1') else '0';
egress_completed <= '1' when fifo_q(73) = '1' and fifo_re_d = '1' else '0';
egress_completed <= '1' when (fifo_q(73) = '1' and fifo_re_d = '1') or toe_rx_eop_d = '1' else '0';
toe_tx_cts <= mac_tx_cts and not source_is_emac;

View file

@ -30,7 +30,6 @@ entity xgbe_oe_0 is
SIM_MODE : std_logic := '0';
XAUI : boolean := true;
XAUI_WIDTH : integer range 4 to 72 := 4;
TPG_ENABLED : boolean := false;
PHY_HW_RESET_LEN : integer := 1562500 -- The PHY HW reset duration is 10 ms
);
port(
@ -105,19 +104,16 @@ end entity xgbe_oe_0;
architecture rtl of xgbe_oe_0 is
-- constants
constant MTU_SIZE : natural := 1500;
constant PREAMBLE_LEN : natural := 7; -- HPS-EMAC Preamble length
-- TCP Server parameters
constant NTCPSTREAMS : natural := 1;
constant TX_IDLE_TIMEOUT : integer := 50;
constant TCP_KEEPALIVE_PERIOD : integer := 60;
constant TPG_SEED : std_logic_vector(63 downto 0) := X"5AA5BAD0BAD1A55A";
constant IPv4_MULTICAST_ADDR : std_logic_vector(31 downto 0) := X"00000000";
constant IPv4_SUBNET_MASK : std_logic_vector(31 downto 0) := X"FFFFFF00";
constant MTU_SIZE : natural := 1500;
constant PREAMBLE_LEN : natural := 7; -- HPS-EMAC Preamble length
-- TCP Server parameters
constant NTCPSTREAMS : natural := 1;
constant TX_IDLE_TIMEOUT : integer := 50;
constant TCP_KEEPALIVE_PERIOD : integer := 60;
constant IPv4_MULTICAST_ADDR : std_logic_vector(31 downto 0) := X"00000000";
constant IPv4_SUBNET_MASK : std_logic_vector(31 downto 0) := X"FFFFFF00";
signal reset_n_i : std_logic;
signal gmii_rx_clk : std_logic := '0';
@ -157,8 +153,6 @@ architecture rtl of xgbe_oe_0 is
signal phy_reset_start, phy_reset_done : std_logic;
signal gen_phy_reset, phy_rst_cnt_tc : std_logic := '0';
signal mac_loopback_en : std_logic;
signal tpg_start, tpg_stop : std_logic;
signal tpc_start, tpc_stop : std_logic;
signal tx_brg_buffer_ovfl_flag : std_logic;
signal tx_brg_clr_buffer_ovfl_flag : std_logic;
--
@ -195,9 +189,6 @@ architecture rtl of xgbe_oe_0 is
signal gmii_rx_rxd : std_logic_vector( 7 downto 0);
signal gmii_txd : std_logic_vector( 7 downto 0);
signal tx_brg_buffer_level : std_logic_vector(10 downto 0);
signal tpg_burst_size : std_logic_vector(10 downto 0);
signal tpg_burst_gap : std_logic_vector(15 downto 0);
signal tpc_errors : std_logic_vector(15 downto 0);
signal phy_id : std_logic_vector(15 downto 0);
signal n_tx_frames : std_logic_vector(15 downto 0);
signal n_rx_frames : std_logic_vector(15 downto 0);
@ -240,14 +231,6 @@ architecture rtl of xgbe_oe_0 is
signal filt_cfg_done : std_logic;
signal set_filt_cfg_wr_done_i : std_logic;
signal filt_cfg_wr_done_i : std_logic;
signal tpg_start_i, tpg_stop_i : std_logic;
signal tpc_start_i, tpc_stop_i : std_logic;
signal tpc_poll_error_req : std_logic;
signal tpc_poll_error_req_i : std_logic;
signal tpc_poll_error_req_d : std_logic;
signal tpc_errors_is_valid : std_logic;
signal tpc_errors_is_valid_i : std_logic;
signal set_tpc_errors_is_valid_i : std_logic;
signal mac_status_read_req : std_logic;
signal mac_status_read_req_i : std_logic;
signal mac_status_rdy_i : std_logic;
@ -262,19 +245,15 @@ architecture rtl of xgbe_oe_0 is
signal init_v : std_logic_vector(2 downto 0);
signal phy_reset_start_v : std_logic_vector(2 downto 0);
signal filt_cfg_write_v : std_logic_vector(2 downto 0);
signal tpg_start_v, tpg_stop_v : std_logic_vector(2 downto 0);
signal tpc_start_v, tpc_stop_v : std_logic_vector(2 downto 0);
signal mac_status_read_req_v : std_logic_vector(2 downto 0);
signal tx_brg_disc_stat_rd_req_v : std_logic_vector(2 downto 0);
signal tx_brg_clr_buffer_ovfl_flag_v : std_logic_vector(2 downto 0);
signal filt_cfg_done_v : std_logic_vector(3 downto 0);
signal tpc_errors_is_valid_v : std_logic_vector(3 downto 0);
signal mac_status_rdy_v : std_logic_vector(3 downto 0);
signal mac_status_addr_i : std_logic_vector(3 downto 0);
signal tx_brg_disc_stat_rdy_v : std_logic_vector(3 downto 0);
signal mac_status_val : std_logic_vector(15 downto 0);
signal mac_status_val_i : std_logic_vector(15 downto 0);
signal tpc_errors_i : std_logic_vector(15 downto 0);
signal tx_brg_disc_packets_i : std_logic_vector(15 downto 0);
@ -294,7 +273,7 @@ architecture rtl of xgbe_oe_0 is
signal reconfig_to_xcvr : std_logic_vector(349 downto 0) := (others => '0');
signal xaui_rx_ch_aligned_i : std_logic := '1';
signal mem_wr_if_ctrl_clr : std_logic;
signal mem_wr_if_ctrl_flush : std_logic;
signal mem_wr_if_ctrl_update_addr : std_logic;
@ -302,7 +281,7 @@ architecture rtl of xgbe_oe_0 is
signal mem_wr_if_end_addr : std_logic_vector(31 downto 0);
signal mem_wr_if_status_flushed : std_logic;
signal mem_wr_if_status_overflow : std_logic;
signal mem_wr_if_ctrl_clr_156 : std_logic;
signal mem_wr_if_ctrl_flush_156 : std_logic;
signal mem_wr_if_ctrl_update_addr_156 : std_logic;
@ -448,7 +427,7 @@ begin
mac_rx_config <= X"16";
-- Generate a synchronous reset to the MAC
mac_async_reset <= '1' when reset_n_i = '0' or init = '1' or xaui_tx_ready = '0' or xaui_rx_ready = '0' else '0';
mac_async_reset <= '1' when reset_n_i = '0' or init = '1' or (mac_loopback_en = '0' and (xaui_tx_ready = '0' or xaui_rx_ready = '0')) else '0';
iSYNC_MAC_RST : entity work.sync_wire
port map('1', clk_156, mac_async_reset, mac_sync_reset_i);
@ -582,11 +561,11 @@ begin
-- XAUI-PHY needs xgmii data and control bits interleaved
GXMII_REMAP: for j in 0 to 7 generate
xgmii_tx_dc( 7+j+8*j downto j+8*j) <= xgmii_txd(7+8*j downto 8*j);
xgmii_tx_dc(8*j+8+j) <= xgmii_txc(j);
xgmii_tx_dc( 7+j+8*j downto j+8*j) <= xgmii_txd(7+8*j downto 8*j) when mac_loopback_en = '0' else 8x"07";
xgmii_tx_dc(8*j+8+j) <= xgmii_txc(j) when mac_loopback_en = '0' else '1';
--
xgmii_rxd(7+8*j downto 8*j) <= xgmii_rx_dc( 7+j+8*j downto j+8*j);
xgmii_rxc(j) <= xgmii_rx_dc(8*j+8+j);
xgmii_rxd_xaui(7+8*j downto 8*j) <= xgmii_rx_dc( 7+j+8*j downto j+8*j);
xgmii_rxc_xaui(j) <= xgmii_rx_dc(8*j+8+j);
end generate;
@ -600,26 +579,7 @@ begin
port map(reset_n_avs, clk_avs, xaui_rx_ready_i and xaui_rx_ch_aligned_i, xaui_rx_ready);
else generate -- not XAUI and SIM_MODE
-----------------------------------------------------------------------------
-- MAC Loopback Switch
-----------------------------------------------------------------------------
-- the switch is used for testing the data-path: MAC XGMII Tx interface is
-- looped back to the MAC XGMII Rx interface, excluding the XAUI transceivers
pMAC_LOOPBACK: process(clk_156)
begin
if clk_156 = '1' and clk_156'event then
if mac_loopback_en = '0' then
xgmii_rxd <= xgmii_rxd_xaui;
xgmii_rxc <= xgmii_rxc_xaui;
else
xgmii_rxd <= xgmii_txd;
xgmii_rxc <= xgmii_txc;
end if;
end if;
end process pMAC_LOOPBACK;
--pragma translate_off
clk_156 <= xaui_ref_clk;
@ -639,8 +599,27 @@ begin
--pragma translate_on
end generate gPHY_SERIAL_ITF;
end generate gPHY_SERIAL_ITF;
-----------------------------------------------------------------------------
-- MAC Loopback Switch
-----------------------------------------------------------------------------
-- the switch is used for testing the data-path: MAC XGMII Tx interface is
-- looped back to the MAC XGMII Rx interface, excluding the XAUI transceivers
pMAC_LOOPBACK: process(clk_156)
begin
if clk_156 = '1' and clk_156'event then
if mac_loopback_en = '0' then
xgmii_rxd <= xgmii_rxd_xaui;
xgmii_rxc <= xgmii_rxc_xaui;
else
xgmii_rxd <= xgmii_txd;
xgmii_rxc <= xgmii_txc;
end if;
end if;
end process pMAC_LOOPBACK;
-----------------------------------------------------------------------------
-- Rx-Data Split: buffers rx-data from the MAC, identifies the destination of
-- the packet
@ -915,7 +894,7 @@ begin
-----------------------------------------------------------------------------
-- Memory write interafce
-----------------------------------------------------------------------------
mem_wr_if_inst : entity work.mem_wr_if_0
port map (
clk => clk_156,
@ -945,55 +924,13 @@ begin
avm_tx_last => avm_tx_last
);
sync_pulse_0 : entity work.sync_pulse port map(clk_in => clk_avs, rst_n=> reset_n_avs, pulse_in => mem_wr_if_ctrl_clr, clk_out => clk_156, pulse_out => mem_wr_if_ctrl_clr_156);
sync_pulse_1 : entity work.sync_pulse port map(clk_in => clk_avs, rst_n=> reset_n_avs, pulse_in => mem_wr_if_ctrl_update_addr, clk_out => clk_156, pulse_out => mem_wr_if_ctrl_update_addr_156);
sync_wire_0 : entity work.sync_wire port map(rstN => reset_n_i, clk => clk_156, async_in => mem_wr_if_ctrl_flush, sync_out => mem_wr_if_ctrl_flush_156);
sync_wire_2 : entity work.sync_wire port map(rstN => reset_n_avs, clk => clk_avs, async_in => mem_wr_if_status_flushed_156, sync_out => mem_wr_if_status_flushed);
sync_wire_3 : entity work.sync_wire port map(rstN => reset_n_avs, clk => clk_avs, async_in => mem_wr_if_status_overflow_156, sync_out => mem_wr_if_status_overflow);
-----------------------------------------------------------------------------
-- Test Pattern Generation and Checking
-----------------------------------------------------------------------------
gTPG : if TPG_ENABLED generate
iTPG: entity work.tcp_tpg_0
generic map (
SEED => TPG_SEED
)
port map (
clk => clk_156,
init => init,
gen_start => tpg_start,
gen_stop => tpg_stop,
burst_size => tpg_burst_size,
burst_gap => tpg_burst_gap,
tx_data => tcp_tx_data,
tx_data_valid => tcp_tx_data_valid,
tx_data_flush => tcp_tx_data_flush,
tx_cts => tcp_tx_cts
);
iTPC: entity work.tcp_tpc_0
generic map (
SEED => TPG_SEED
)
port map (
clk => clk_156,
init => init,
check_start => tpc_start,
check_stop => tpc_stop,
word_errors => tpc_errors,
rx_data => tcp_rx_data,
rx_data_valid => tcp_rx_data_valid,
rx_rts => tcp_rx_rts,
rx_cts => tcp_rx_cts,
rx_cts_ack => tcp_rx_cts_ack
);
end generate;
-----------------------------------------------------------------------------
-- Miscellanea
@ -1120,23 +1057,13 @@ begin
gmii_tx_brg_stat_disc_stat_rdy => tx_brg_disc_stat_rdy_i,
gmii_tx_brg_stat_disc_packets => tx_brg_disc_packets_i,
tpg_ctrl_tpg_start => tpg_start_i,
tpg_ctrl_tpg_stop => tpg_stop_i,
tpg_ctrl_tpg_burst_size => tpg_burst_size,
tpg_ctrl_tpg_burst_gap => tpg_burst_gap,
tpc_ctrl_tpc_start => tpc_start_i,
tpc_ctrl_tpc_stop => tpc_stop_i,
tpc_ctrl_tpc_poll_error_req => tpc_poll_error_req_i,
tpc_status_tpc_errors_is_valid => tpc_errors_is_valid_i,
tpc_status_tpc_errors => tpc_errors_i,
mem_wr_if_ctrl_clr => mem_wr_if_ctrl_clr,
mem_wr_if_ctrl_flush => mem_wr_if_ctrl_flush,
mem_wr_if_ctrl_clr => mem_wr_if_ctrl_clr,
mem_wr_if_ctrl_flush => mem_wr_if_ctrl_flush,
mem_wr_if_ctrl_update_addr => mem_wr_if_ctrl_update_addr,
mem_wr_if_base_addr => mem_wr_if_base_addr,
mem_wr_if_end_addr => mem_wr_if_end_addr,
mem_wr_if_status_flushed => mem_wr_if_status_flushed,
mem_wr_if_status_overflow => mem_wr_if_status_overflow,
mem_wr_if_base_addr => mem_wr_if_base_addr,
mem_wr_if_end_addr => mem_wr_if_end_addr,
mem_wr_if_status_flushed => mem_wr_if_status_flushed,
mem_wr_if_status_overflow => mem_wr_if_status_overflow,
avs_address => avs_address(4 downto 0),
avs_write => local_write,
@ -1188,36 +1115,6 @@ begin
filt_cfg_write_v <= '0' & filt_cfg_write_v(filt_cfg_write_v'left downto 1);
end if;
if tpg_start_i = '1' then
tpg_start_v <= (others => '1');
else
tpg_start_v <= '0' & tpg_start_v(tpg_start_v'left downto 1);
end if;
if tpg_stop_i = '1' then
tpg_stop_v <= (others => '1');
else
tpg_stop_v <= '0' & tpg_stop_v(tpg_stop_v'left downto 1);
end if;
if tpc_start_i = '1' then
tpc_start_v <= (others => '1');
else
tpc_start_v <= '0' & tpc_start_v(tpc_start_v'left downto 1);
end if;
if tpc_stop_i = '1' then
tpc_stop_v <= (others => '1');
else
tpc_stop_v <= '0' & tpc_stop_v(tpc_stop_v'left downto 1);
end if;
if init_i = '1' or tpc_poll_error_req_i = '1' then
tpc_errors_is_valid_i <= '0';
elsif set_tpc_errors_is_valid_i = '1' then
tpc_errors_is_valid_i <= '1';
end if;
if init_i = '1' or filt_cfg_write_i = '1' then
filt_cfg_wr_done_i <= '0';
elsif(set_filt_cfg_wr_done_i = '1') then
@ -1263,14 +1160,6 @@ begin
begin
if clk_156 = '1' and clk_156'event then
tpc_poll_error_req_d <= tpc_poll_error_req;
if tpc_poll_error_req_d = '1' then
tpc_errors_is_valid_v <= (others => '1');
else
tpc_errors_is_valid_v <= '0' & tpc_errors_is_valid_v(tpc_errors_is_valid_v'left downto 1);
end if;
filt_cfg_write_d <= filt_cfg_write;
if filt_cfg_write_d = '1' then
@ -1318,30 +1207,6 @@ begin
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_avs, clk => clk_avs, async_in => filt_cfg_done_v(0), sync_out => set_filt_cfg_wr_done_i);
iSYNC_TPG_START: entity work.sync_wire_redge
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_i, clk => clk_156, async_in => tpg_start_v(0), sync_out => tpg_start);
iSYNC_TPG_STOP: entity work.sync_wire_redge
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_i, clk => clk_156, async_in => tpg_stop_v(0), sync_out => tpg_stop);
iSYNC_TPC_START: entity work.sync_wire_redge
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_i, clk => clk_156, async_in => tpc_start_v(0), sync_out => tpc_start);
iSYNC_TPC_STOP: entity work.sync_wire_redge
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_i, clk => clk_156, async_in => tpc_stop_v(0), sync_out => tpc_stop);
iSYNC_TPC_ERROR_POLL: entity work.sync_wire_redge
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_i, clk => clk_156, async_in => tpc_poll_error_req_i, sync_out => tpc_poll_error_req);
iSYNC_TPC_ERROR_VALID: entity work.sync_wire_redge
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_avs, clk => clk_avs, async_in => tpc_errors_is_valid_v(0), sync_out => set_tpc_errors_is_valid_i);
iSYNC_MAC_STAT_REQ: entity work.sync_wire_redge
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n_i, clk => clk_156, async_in => mac_status_read_req_v(0), sync_out => mac_status_read_req);
@ -1368,10 +1233,6 @@ begin
begin
if clk_156 = '1' and clk_156'event then
if tpc_poll_error_req = '1' then
tpc_errors_i <= tpc_errors;
end if;
if mac_status_read_req = '1' then
mac_status_val_i <= mac_status_val;
end if;