]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
add counter for code violations
authorJan Michel <j.michel@gsi.de>
Thu, 12 Jul 2018 09:53:56 +0000 (11:53 +0200)
committerJan Michel <j.michel@gsi.de>
Thu, 12 Jul 2018 09:54:14 +0000 (11:54 +0200)
media_interfaces/med_ecp3_sfp_sync_4.vhd
media_interfaces/sync/rx_control.vhd

index 02612ebc67897889183e93e7848878a8f1377ab5..2af6d8c20dbe48615057cdc1b430dbc80d345313 100644 (file)
@@ -104,6 +104,9 @@ signal  hdinp, hdinn, hdoutp, hdoutn : std_logic_vector(3 downto 0);
 attribute nopad : string;
 attribute nopad of  hdinp, hdinn, hdoutp, hdoutn : signal is "true";
 
+type u8_arr is array (0 to 3) of unsigned(7 downto 0);
+signal cv_cnt, cv_cnt_sys : u8_arr;
+
 begin
 
 SD_TXDIS_OUT <= (others =>'0'); --not (rx_allow_q or not IS_SLAVE);   --slave only switches on when RX is ready
@@ -312,6 +315,8 @@ gen_control : for i in 0 to 3 generate
         DEBUG_RX_CONTROL => debug_rx_control_i(i*32+31 downto i*32),
         STAT_RESET       => stat_fsm_reset_i(i*32+31 downto i*32)
         );
+        
+    cv_cnt(i) <= cv_cnt(i) + 1 when rx_error(i) = '1' and rising_edge(clk_rx_full(i));
   end generate;   
 
   gen_not_used : if IS_USED(i) = c_NO generate
@@ -319,6 +324,7 @@ gen_control : for i in 0 to 3 generate
     MEDIA_MED2INT(i).tx_read   <= '1';
     MEDIA_MED2INT(i).stat_op   <= x"0007";
   end generate;
+
 end generate;     
 
 THE_SCI_READER : entity work.sci_reader
@@ -343,10 +349,17 @@ THE_SCI_READER : entity work.sci_reader
     MEDIA_STATUS_REG_IN(31 downto 0)   => stat_rx_control_i(31 downto 0),
     MEDIA_STATUS_REG_IN(63 downto 32)  => stat_tx_control_i(31 downto 0),
     MEDIA_STATUS_REG_IN(191 downto 64)  => stat_fsm_reset_i(127 downto 0),
-    MEDIA_STATUS_REG_IN(255 downto 192) => (others => '0'),
+    MEDIA_STATUS_REG_IN(199 downto 192) => cv_cnt_sys(0),
+    MEDIA_STATUS_REG_IN(207 downto 200) => cv_cnt_sys(1),
+    MEDIA_STATUS_REG_IN(215 downto 208) => cv_cnt_sys(2),
+    MEDIA_STATUS_REG_IN(223 downto 216) => cv_cnt_sys(3),
+   
+    MEDIA_STATUS_REG_IN(255 downto 224) => (others => '0'),
     DEBUG_OUT   => open
     );
 
+cv_cnt_sys <= cv_cnt when rising_edge(SYSCLK);    
+    
 wa_position <= (others => '0');
     
 STAT_DEBUG(13 downto 0)   <= debug_tx_control_i(13 downto 0);
index 204d4c394b810a35230717d95e3507a36b75e176..88c91fbce327fa3e934927ca49dbc15f6bc73b08 100644 (file)
@@ -183,7 +183,7 @@ PROC_RX_FSM : process begin
         idle_hist_i(0)      <= '1';
         got_link_ready_i    <= got_link_ready_i or (idle_hist_i(1) and idle_hist_i(3));
       elsif  reg_rx_k_in = '1' then
-        rx_state <= SLEEP;
+        rx_state <= FIRST; -- SLEEP;
       end if;
       
     when GET_DATA =>
@@ -196,7 +196,7 @@ PROC_RX_FSM : process begin
         ct_fifo_write       <= '1';
         rx_state            <= FIRST;
       else
-        rx_state <= SLEEP;        
+        rx_state <= FIRST; -- SLEEP;        
       end if;
      
     when GET_DLM =>