]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
improve Serdes reset routine
authorJan Michel <j.michel@gsi.de>
Tue, 27 Mar 2018 08:02:36 +0000 (10:02 +0200)
committerJan Michel <j.michel@gsi.de>
Tue, 27 Mar 2018 08:02:36 +0000 (10:02 +0200)
media_interfaces/med_ecp3_sfp_sync_4.vhd
media_interfaces/sync/med_sync_control.vhd
media_interfaces/sync/rx_control.vhd

index 17745db90db93a448fe54be6f0fce2b15f474af2..82c3e92c865d8438b710204b8651f597fbbc0d30 100644 (file)
@@ -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
 -------------------------------------------------      
index 56378387f1ff9f8fa684d69a72bcbfa033250849..71da688cf8582bab10960f0ed644b79d60d65c31 100644 (file)
@@ -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);
 
index fe838c487dc5aca4c14c4d9f5a572830d9dba514..204d4c394b810a35230717d95e3507a36b75e176 100644 (file)
@@ -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';