]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
made some stress tests, ID
authorIngo Froehlich <ingo@nomail.fake>
Tue, 24 Apr 2018 14:55:25 +0000 (16:55 +0200)
committerIngo Froehlich <ingo@nomail.fake>
Tue, 24 Apr 2018 14:55:25 +0000 (16:55 +0200)
media_interfaces/sync/rx_control.vhd
media_interfaces/sync/tb/med_sync_tb.vhd

index 8c9c0e6684fbb86266df9fb6189e30f78414f64f..0eee36071fd971a638b008f75a8c273ef67b6a7f 100644 (file)
@@ -104,7 +104,7 @@ begin
 
  
 ct_fifo_read <= not ct_fifo_reset and not ct_fifo_empty and (pulse_good_100 or got_pulse_good or pulse_bad_100 or got_pulse_bad); -- when rising_edge(CLK_100);
-buf_rx_write_out <=  last_ct_fifo_read and not last_ct_fifo_empty and (pulse_good_100 or got_pulse_good) when rising_edge(CLK_100);
+buf_rx_write_out <=  last_ct_fifo_read and not last_ct_fifo_empty and (pulse_good_100 or got_pulse_good) and not (pulse_bad_100 or got_pulse_bad) when rising_edge(CLK_100);
 
 RX_DATA_OUT   <= ct_fifo_data_out(15 downto 0) ;
 RX_WRITE_OUT  <= buf_rx_write_out;
@@ -122,7 +122,8 @@ process begin
     got_pulse_good <= '0';
   end if;
   if pulse_bad_100 = '1' then
-    got_pulse_bad <= '1';
+    got_pulse_bad  <= '1';
+    got_pulse_good <= '0';
   elsif ct_fifo_empty = '1' then
     got_pulse_bad <= '0';
   end if;  
index 408d92425cca6524c1eafc8af6ba08ee0fb0cd92..f9dfb9f099d91f4da3260dd778a9cca8f177eb32 100644 (file)
@@ -80,7 +80,7 @@ signal int2med_m, int2med_s : INT2MED;
 signal tx_data_m, tx_data_s, rx_data_m, rx_data_s : std_logic_vector(7 downto 0);
 signal tx_k_m, tx_k_s, rx_k_m, rx_k_s : std_logic;
 
-signal do_once : std_logic := '0';
+signal do_once : std_logic_vector(1 downto 0) := "00";
 
 begin
 
@@ -91,25 +91,45 @@ clear_s <= '0' after 51 ns;
 
 process (tx_data_m)
 begin
-  if (tx_data_m = x"11" and do_once = '0') then
-    rx_data_s(7 downto 1) <= transport tx_data_m(7 downto 1) after 250 ns;
-    rx_data_s(0) <= transport '0' after 250 ns;
-    do_once <= '1';
+  if (tx_data_m = x"11") then
+    rx_k_s <= transport tx_k_m after 250 ns;
+    rx_data_s <= transport tx_data_m after 250 ns;
+    if do_once = "00" then
+      rx_data_s(7 downto 1) <= transport tx_data_m(7 downto 1) after 250 ns;
+      rx_data_s(0) <= transport '0' after 250 ns;
+
+      --rx_k_s <= transport (not tx_k_m) after 250 ns;
+      do_once <= "01"; --2 errors, one good
+      --do_once <= "10";  --1 error, 2 good
+    elsif do_once = "01" then
+      rx_data_s(7 downto 1) <= transport tx_data_m(7 downto 1) after 250 ns;
+      rx_data_s(0) <= transport '0' after 250 ns;
+      do_once <= "10";
+    elsif do_once = "10" then
+      do_once <= "11";
+      rx_data_s <= transport tx_data_m after 250 ns;
+    else
+      do_once <= "00";
+      rx_data_s <= transport tx_data_m after 250 ns;
+    end if;
   else
+    rx_k_s    <= transport tx_k_m after 250 ns; 
     rx_data_s <= transport tx_data_m after 250 ns;
   end if;
 end process;
 
 rx_data_m <= transport tx_data_s after 250 ns;
-rx_k_s    <= transport tx_k_m after 250 ns;
+
 rx_k_m    <= transport tx_k_s after 250 ns;
 
 clk_100_m <= not clk_100_m after 5 ns;
 clk_200_m <= not clk_200_m after 2.5 ns;
-clk_100_s <= not clk_100_s after 5 ns;
-clk_200_s <= not clk_200_s after 2.5 ns;
-
-
+--clk_100_s <= not clk_100_s after 5 ns;
+--clk_100_s <= not clk_100_s after 5.1 ns;
+clk_100_s <= not clk_100_s after 4.8 ns;
+--clk_200_s <= not clk_200_s after 2.5 ns;
+--clk_200_s <= not clk_200_s after 2.55 ns;
+clk_200_s <= not clk_200_s after 2.4 ns;
 
 
 process begin
@@ -121,7 +141,8 @@ process begin
   wait for 30 us;
 
   -- generate good packages to test the RAM overflow
-  GEN_GOOD: for i in 0 to 3 loop
+  --GEN_GOOD: for i in 0 to 3 loop
+  GEN_GOOD: for i in 0 to 0 loop
   wait until rising_edge(clk_100_m); wait for 1 ns;
   int2med_m.data <= x"0001";
   int2med_m.packet_num <= "100";
@@ -147,10 +168,12 @@ process begin
   int2med_m.data <= x"0000";
   end loop;
 
-  --bad package
-  --wait for 1 us;
+  GEN_BAD: for i in 0 to 2 loop
+  --bad packages
+  wait for 500ns;
   wait until rising_edge(clk_100_m); wait for 1 ns;
   int2med_m.data <= x"1122";
+  --int2med_m.data <= x"1111";  --for k flip
   int2med_m.packet_num <= "100";
   int2med_m.dataready <= '1';
   wait until rising_edge(clk_100_m); wait for 1 ns;
@@ -172,13 +195,14 @@ process begin
   wait until rising_edge(clk_100_m); wait for 1 ns;
   int2med_m.dataready <= '0';
   wait until rising_edge(clk_100_m); wait for 1 ns;
-  wait until rising_edge(clk_100_m); wait for 1 ns;
-  wait until rising_edge(clk_100_m); wait for 1 ns;
-  wait until rising_edge(clk_100_m); wait for 1 ns;
-  wait until rising_edge(clk_100_m); wait for 1 ns;
-  wait until rising_edge(clk_100_m); wait for 1 ns;
+  end loop;
+--  wait until rising_edge(clk_100_m); wait for 1 ns;
+--  wait until rising_edge(clk_100_m); wait for 1 ns;
+--  wait until rising_edge(clk_100_m); wait for 1 ns;
+--  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
+  --good package
   wait until rising_edge(clk_100_m); wait for 1 ns;
   int2med_m.data <= x"ff01";
   int2med_m.packet_num <= "100";