From 0c359c71b09225d5d59e3aded1c6ec9ad95e8b49 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Tue, 27 Mar 2018 10:02:36 +0200 Subject: [PATCH] improve Serdes reset routine --- media_interfaces/med_ecp3_sfp_sync_4.vhd | 4 ++-- media_interfaces/sync/med_sync_control.vhd | 24 ++++++++++++++-------- media_interfaces/sync/rx_control.vhd | 6 +++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/media_interfaces/med_ecp3_sfp_sync_4.vhd b/media_interfaces/med_ecp3_sfp_sync_4.vhd index 17745db..82c3e92 100644 --- a/media_interfaces/med_ecp3_sfp_sync_4.vhd +++ b/media_interfaces/med_ecp3_sfp_sync_4.vhd @@ -106,8 +106,8 @@ attribute nopad of hdinp, hdinn, hdoutp, hdoutn : signal is "true"; begin --- SD_TXDIS_OUT <= (others =>'0'); --not (rx_allow_q or not IS_SLAVE); --slave only switches on when RX is ready -SD_TXDIS_OUT <= (others => RESET); +SD_TXDIS_OUT <= (others =>'0'); --not (rx_allow_q or not IS_SLAVE); --slave only switches on when RX is ready +-- SD_TXDIS_OUT <= (others => RESET); ------------------------------------------------- -- Serdes ------------------------------------------------- diff --git a/media_interfaces/sync/med_sync_control.vhd b/media_interfaces/sync/med_sync_control.vhd index 5637838..71da688 100644 --- a/media_interfaces/sync/med_sync_control.vhd +++ b/media_interfaces/sync/med_sync_control.vhd @@ -87,6 +87,7 @@ signal send_link_reset_i : std_logic; signal make_link_reset_real_i : std_logic := '0'; signal make_link_reset_sys_i : std_logic := '0'; signal send_link_reset_real_i : std_logic := '0'; +signal send_link_reset_sys_i : std_logic := '0'; signal reset_i, rst_n, rst_n_tx : std_logic; signal media_med2int_i : MED2INT; @@ -95,12 +96,12 @@ signal finished_reset_tx, finished_reset_tx_q : std_logic; begin -rst_n_tx <= not (CLEAR or sd_los_i or make_link_reset_real_i) when (IS_SYNC_SLAVE = 1 and IS_TX_RESET = 1) - else not (CLEAR or make_link_reset_real_i); +rst_n_tx <= not (CLEAR or sd_los_i or make_link_reset_real_i or RESET) when (IS_SYNC_SLAVE = 1 and IS_TX_RESET = 1) + else not (CLEAR or make_link_reset_real_i or RESET); -rst_n <= not (CLEAR or sd_los_i or make_link_reset_real_i); +rst_n <= not (CLEAR or sd_los_i or make_link_reset_real_i or RESET); reset_i <= (RESET or sd_los_i or make_link_reset_real_i); @@ -295,9 +296,12 @@ STAT_RESET(9) <= rx_allow; STAT_RESET(15 downto 10) <= (others => '0'); STAT_RESET(16) <= RX_CDR_LOL; STAT_RESET(17) <= RX_LOS; -STAT_RESET(18) <= '0'; --RX_PCS_RST; -STAT_RESET(19) <= '0'; -STAT_RESET(31 downto 20) <= start_timer(start_timer'left downto start_timer'left - 11); +STAT_RESET(18) <= QUAD_RST; --RX_PCS_RST; +STAT_RESET(19) <= TX_PCS_RST; +STAT_RESET(20) <= TX_LOL; +STAT_RESET(21) <= rst_n; +STAT_RESET(22) <= rst_n_tx; +STAT_RESET(31 downto 23) <= start_timer(start_timer'left downto start_timer'left - 8); gen_link_reset : if IS_SYNC_SLAVE = 1 generate @@ -306,11 +310,13 @@ gen_link_reset : if IS_SYNC_SLAVE = 1 generate PULSE_B_OUT => make_link_reset_sys_i); link_reset_send : signal_sync port map(RESET => '0',CLK0 => CLK_RXI,CLK1 => CLK_SYS, D_IN(0) => send_link_reset_i, - D_OUT(0) => send_link_reset_real_i); + D_OUT(0) => send_link_reset_sys_i); end generate; -make_link_reset_real_i <= make_link_reset_sys_i when IS_SYNC_SLAVE = 0 else - make_link_reset_sys_i or sd_los_i when IS_SYNC_SLAVE = 1; +make_link_reset_real_i <= make_link_reset_sys_i or sd_los_i when IS_SYNC_SLAVE = 1 + else '0'; +send_link_reset_real_i <= send_link_reset_sys_i when IS_SYNC_SLAVE = 1 + else '0'; sd_los_i <= SFP_LOS when rising_edge(CLK_SYS); diff --git a/media_interfaces/sync/rx_control.vhd b/media_interfaces/sync/rx_control.vhd index fe838c4..204d4c3 100644 --- a/media_interfaces/sync/rx_control.vhd +++ b/media_interfaces/sync/rx_control.vhd @@ -217,17 +217,17 @@ PROC_RX_FSM : process begin send_link_reset_i <= '1'; make_reset_i <= '0'; got_link_ready_i <= '0'; - if reset_cnt < x"1ff" then + if reset_cnt <= x"3ff" then reset_cnt <= reset_cnt + 1; -- else -- make_reset_i <= '1'; end if; - elsif reset_cnt >= x"1ff" or reset_cnt < x"40" then + elsif reset_cnt > x"3ff" then -- or reset_cnt < x"40" send_link_reset_i <= '0'; make_reset_i <= '1'; rx_state <= SLEEP; else - if reset_cnt < x"1ff" then + if reset_cnt <= x"3ff" then reset_cnt <= reset_cnt + 1; end if; send_link_reset_i <= '1'; -- 2.43.0