From c93e91144c07492d438cc81ec45e2f950df44256 Mon Sep 17 00:00:00 2001 From: Ingo Froehlich Date: Wed, 28 Feb 2018 13:54:39 +0100 Subject: [PATCH] basic functions working, IF --- media_interfaces/sync/rx_control.vhd | 10 ++++++---- media_interfaces/sync/tb/med_sync_tb.vhd | 8 +++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/media_interfaces/sync/rx_control.vhd b/media_interfaces/sync/rx_control.vhd index b447a8f..7345eb8 100644 --- a/media_interfaces/sync/rx_control.vhd +++ b/media_interfaces/sync/rx_control.vhd @@ -93,6 +93,8 @@ signal got_pulse_bad : std_logic := '0'; signal pulse_good_100 : std_logic; signal pulse_bad_100 : std_logic; signal waiting_for_retr : std_logic := '0'; +signal good_pos_counter : unsigned(7 downto 0) := (others => '0'); + begin @@ -115,6 +117,7 @@ process begin wait until rising_edge(CLK_100); if pulse_good_100 = '1' then got_pulse_good <= '1'; + good_pos_counter <= good_pos_counter+5; elsif ct_fifo_empty = '1' then got_pulse_good <= '0'; end if; @@ -125,6 +128,7 @@ process begin end if; if RX_ALLOW_IN = '0' then rx_packet_num <= "100"; + good_pos_counter <= (others => '0'); elsif buf_rx_write_out = '1' then if rx_packet_num = "100" then rx_packet_num <= "000"; @@ -367,10 +371,8 @@ PULSE_BAD_SYNC : pulse_sync ); - - - -REQUEST_POSITION_OUT <= x"00"; --TODO: check incoming data +--REQUEST_POSITION_OUT <= x"00"; --TODO: check incoming data +REQUEST_POSITION_OUT <= std_logic_vector(good_pos_counter); SEND_LINK_RESET_OUT <= send_link_reset_i when rising_edge(CLK_200); MAKE_RESET_OUT <= make_reset_i when rising_edge(CLK_200); diff --git a/media_interfaces/sync/tb/med_sync_tb.vhd b/media_interfaces/sync/tb/med_sync_tb.vhd index 9884208..663c72a 100644 --- a/media_interfaces/sync/tb/med_sync_tb.vhd +++ b/media_interfaces/sync/tb/med_sync_tb.vhd @@ -120,6 +120,8 @@ process begin int2med_m.dataready <= '0'; wait for 30 us; + -- generate good packages to test the RAM overflow + GEN_GOOD: for i in 0 to 60 loop wait until rising_edge(clk_100_m); wait for 1 ns; int2med_m.data <= x"affe"; int2med_m.packet_num <= "100"; @@ -143,7 +145,10 @@ process begin wait until rising_edge(clk_100_m); wait for 1 ns; int2med_m.dataready <= '0'; int2med_m.data <= x"0000"; - wait for 1 us; + end loop; + + --bad package + --wait for 1 us; wait until rising_edge(clk_100_m); wait for 1 ns; int2med_m.data <= x"1122"; int2med_m.packet_num <= "100"; @@ -169,6 +174,7 @@ process begin wait until rising_edge(clk_100_m); wait for 1 ns; wait until rising_edge(clk_100_m); wait for 1 ns; + --good package which should be thrown away wait until rising_edge(clk_100_m); wait for 1 ns; int2med_m.data <= x"dead"; int2med_m.packet_num <= "100"; -- 2.43.0