From 3b097fa6b15f458cc7f585bac88ac5c05b750096 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Thu, 12 Jul 2018 11:53:56 +0200 Subject: [PATCH] add counter for code violations --- media_interfaces/med_ecp3_sfp_sync_4.vhd | 15 ++++++++++++++- media_interfaces/sync/rx_control.vhd | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/media_interfaces/med_ecp3_sfp_sync_4.vhd b/media_interfaces/med_ecp3_sfp_sync_4.vhd index 02612eb..2af6d8c 100644 --- a/media_interfaces/med_ecp3_sfp_sync_4.vhd +++ b/media_interfaces/med_ecp3_sfp_sync_4.vhd @@ -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); diff --git a/media_interfaces/sync/rx_control.vhd b/media_interfaces/sync/rx_control.vhd index 204d4c3..88c91fb 100644 --- a/media_interfaces/sync/rx_control.vhd +++ b/media_interfaces/sync/rx_control.vhd @@ -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 => -- 2.43.0