]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
add reset counter to hub
authorJan Michel <j.michel@gsi.de>
Tue, 27 Mar 2018 08:03:17 +0000 (10:03 +0200)
committerJan Michel <j.michel@gsi.de>
Tue, 27 Mar 2018 08:03:17 +0000 (10:03 +0200)
trb_net16_hub_base.vhd
trb_net16_hub_streaming_port_sctrl_record.vhd

index 981b485d9d0b18b6d0987cb26f09e96629a8d6a4..f126196e23a563eec6a496462ba667da5c449cf6 100644 (file)
@@ -346,6 +346,8 @@ architecture trb_net16_hub_base_arch of trb_net16_hub_base is
   type counter8b_t is array (0 to 15) of unsigned(7 downto 0);
   signal received_retransmit_requests : counter8b_t := (others => (others => '0'));
   signal sent_retransmit_requests     : counter8b_t := (others => (others => '0'));
+  signal received_resets              : counter8b_t := (others => (others => '0'));
+  signal make_trbnet_reset, last_make_trbnet_reset : std_logic_vector(MII_NUMBER-1 downto 0);
 
   signal dummy : std_logic_vector(270 downto 0);
   signal tmp_buf_to_hub_REPLY_DATA_ctrl : std_logic_vector(15 downto 0);
@@ -1499,7 +1501,7 @@ HUB_MED_CONNECTED(31 downto MII_NUMBER) <= (others => '1');
         next_last_lsm_read          <= lsm_read;
         last_lsm_read               <= next_last_lsm_read;
         next_lsm_data(7 downto 0)   <= MED_STAT_OP(tmp*16+7 downto tmp*16+0);
-        next_lsm_data(15 downto 8)  <= (others => '0');
+        next_lsm_data(15 downto 8)  <= std_logic_vector(received_resets(tmp));
         next_lsm_data(23 downto 16) <= std_logic_vector(received_retransmit_requests(tmp));
         next_lsm_data(31 downto 24) <= std_logic_vector(sent_retransmit_requests(tmp));
         lsm_data                    <= next_lsm_data;
@@ -1520,6 +1522,13 @@ HUB_MED_CONNECTED(31 downto MII_NUMBER) <= (others => '1');
           elsif MED_STAT_OP(i*16+8) = '1' then
             received_retransmit_requests(i) <= received_retransmit_requests(i) + to_unsigned(1,1);
           end if;
+          if HC_COMMON_CTRL_REGS(5) = '1' then
+            received_resets(i) <= (others => '0');
+          elsif make_trbnet_reset(i) = '1' then
+            received_resets(i) <= received_resets(i) + to_unsigned(1,1);
+          end if;
+          last_make_trbnet_reset(i) <= MED_STAT_OP(i*16+13);
+          make_trbnet_reset(i)      <= MED_STAT_OP(i*16+13) and not last_make_trbnet_reset(i);
         end if;
       end process;
   end generate;
@@ -1527,6 +1536,7 @@ HUB_MED_CONNECTED(31 downto MII_NUMBER) <= (others => '1');
   gen_0s : for i in MII_NUMBER to 15 generate
     received_retransmit_requests(i) <= (others => '0');
     sent_retransmit_requests(i) <= (others => '0');
+    received_resets(i) <= (others => '0');
   end generate;
 
 ------------------------------------
index 5b0f92f3e4399c13ad388029ac6778cc10c2c599..1fefe124a5b1fbde8a85cf6b1a5b444e5205da1e 100644 (file)
@@ -215,9 +215,9 @@ begin
 --generate media resync
   gen_resync : for i in 0 to mii-1 generate
     med_ctrl_op(14+i*16 downto i*16) <= HUB_MED_CTRL_OP(14+i*16 downto i*16);
-    med_ctrl_op(15+i*16) <= hub_make_network_reset or HUB_MED_CTRL_OP(15+i*16);
+    med_ctrl_op(15+i*16) <= hub_make_network_reset or HUB_MED_CTRL_OP(15+i*16) or MEDIA_MED2INT(mii).stat_op(15);
   end generate;
-
+  MEDIA_INT2MED(mii).ctrl_op(15) <= hub_make_network_reset;
 
   hub_make_network_reset <= external_send_reset_long;