From cc2ae76d5861790793548e3592c43956d601abef Mon Sep 17 00:00:00 2001 From: Thomas Gessler Date: Thu, 8 Oct 2020 21:13:29 +0200 Subject: [PATCH] XCKU media interface: Reset RX on errors In some cases the downlink RX logic did not come up correctly after a reset. This is solved by checking RX data validity after a reset and applying an RX PMA reset in case of errors. --- media_interfaces/med_xcku_sfp_sync.vhd | 30 +++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/media_interfaces/med_xcku_sfp_sync.vhd b/media_interfaces/med_xcku_sfp_sync.vhd index 0a0d743..5851651 100644 --- a/media_interfaces/med_xcku_sfp_sync.vhd +++ b/media_interfaces/med_xcku_sfp_sync.vhd @@ -1,5 +1,6 @@ library ieee; use ieee.std_logic_1164.all; +use ieee.numeric_std.all; library xpm; use xpm.vcomponents.all; @@ -86,9 +87,11 @@ architecture med_xcku_sfp_sync_arch of med_xcku_sfp_sync is signal rx_cdr_lol : std_logic; signal tx_lol : std_logic; - signal rxpmaresetdone_i : std_logic; + signal rxresetdone : std_logic; signal txpmaresetdone_i : std_logic; + signal rx_data_valid_count : unsigned(7 downto 0) := (others => '0'); + signal debug_rx_control_i : std_logic_vector(31 downto 0); signal debug_tx_control_i : std_logic_vector(31 downto 0); @@ -147,9 +150,9 @@ begin TXPMARESET => '0', TXPCSRESET => '0', INIT_DONE => open, - RXRESETDONE => open, + RXRESETDONE => rxresetdone, TXRESETDONE => open, - RXPMARESETDONE => rxpmaresetdone_i, + RXPMARESETDONE => RXPMARESETDONE, TXPMARESETDONE => txpmaresetdone_i, RXBYTEISALIGNED => open, RXN => RXN, @@ -181,9 +184,26 @@ begin ); tx_lol <= not txpmaresetdone_i; - rx_cdr_lol <= not rxpmaresetdone_i; - RXPMARESETDONE <= rxpmaresetdone_i; + process (RXUSRCLK_DOUBLE) is + begin + if rising_edge(RXUSRCLK_DOUBLE) then + if rxresetdone = '0' then + rx_cdr_lol <= '1'; + else + if rxnotintable = '1' then + rx_data_valid_count <= (others => '0'); + rx_cdr_lol <= '1'; + else + rx_data_valid_count <= rx_data_valid_count + 1; + if rx_data_valid_count(rx_data_valid_count'left) = '1' then + rx_cdr_lol <= '0'; + end if; + end if; + end if; + end if; + end process; + TXPMARESETDONE <= txpmaresetdone_i; THE_MED_CONTROL : entity work.med_sync_control -- 2.43.0