]> jspc29.x-matter.uni-frankfurt.de Git - cri.git/commitdiff
fix in cri_hub's stat_op and ctrl_op handling to get stacked hub config running
authorAdrian Weber <adrian.a.weber@exp2.physik.uni-giessen.de>
Tue, 21 Jul 2020 07:38:36 +0000 (09:38 +0200)
committerAdrian Weber <adrian.a.weber@exp2.physik.uni-giessen.de>
Tue, 21 Jul 2020 07:38:36 +0000 (09:38 +0200)
src/hub/trb_net16_cri_hub.vhd

index 8f0cfad2db659c4ff3bdd0715bca6e8f60455d71..8edcbba9d6d171f9c5a23b8fcf65ddb5f993e837 100644 (file)
@@ -168,6 +168,10 @@ architecture trb_net16_cri_hub_arch of trb_net16_cri_hub is
   signal buf_DATA_SEQNMBR         : std_logic_vector((MII_NUMBER*8)-1 downto 0);
   signal buf_DATA_LENGTH          : std_logic_vector((MII_NUMBER*c_DATA_WIDTH)-1 downto 0);
   
+  -- Debug
+  signal datardy_cnt_ret   : std_logic_vector (15 downto 0);
+  signal datardy_cnt_int   : std_logic_vector (15 downto 0);
+  
 begin
 
   THE_HUB_CONTROLLER : entity work.trb_net16_cri_hub_base
@@ -349,9 +353,48 @@ THE_HUB_1 : entity work.trb_net16_cri_hub_base
       BUS_HUB_DBG_TX                  => bus_hub_dbg_1_tx
       );      
 
+
+THE_Event_Cntr : process begin
+  wait until rising_edge(CLK);
+  
+  if RESET = '1' then
+    datardy_cnt_ret <= (others => '0');
+    datardy_cnt_int <= (others => '0');
+  else 
+
+    if (int_med_dataready_out(0) = '1') then
+      datardy_cnt_int <= datardy_cnt_int + 1;
+    end if;        
+    
+    if (int_med_dataready_in(0) = '1') then
+      datardy_cnt_ret <= datardy_cnt_ret + 1;
+    end if;    
+  end if;
+  
+  end process;       
+   
+THE_CRI_DATA_RECEIVER_DEBUG_HANDLER : process begin
+  wait until rising_edge(CLK);
+  BUS_HUB_DBG_TX.ack     <= '0';
+  BUS_HUB_DBG_TX.nack    <= '0';
+  BUS_HUB_DBG_TX.unknown <= '0';
+  
+  if BUS_HUB_DBG_RX.read = '1' then
+    if BUS_HUB_DBG_RX.addr(7 downto 0) = x"00" then
+      BUS_HUB_DBG_TX.data(15 downto  0) <= datardy_cnt_int;
+      BUS_HUB_DBG_TX.data(31 downto 16) <= datardy_cnt_ret;
+      BUS_HUB_DBG_TX.ack  <= '1';
+    end if;
+  elsif BUS_HUB_DBG_RX.write = '1' then
+    --if BUS_HUB_DBG_RX.addr( 7 downto 0) = x"0B" then
+    --  loc_buff_windowOffset  <= BUS_HUB_DBG_RX.data(15 downto 0);
+    --  BUS_HUB_DBG_TX.ack <= '1';
+    --end if;
+  end if;
+  end process;      
       
-loc_stat_op_1   <= int_med_ctrl_op(15) & "000" & x"007"; 
-loc_ctrl_op_1   <= int_med_stat_op(15) & "000" & x"000"; 
+loc_stat_op_1       <= int_med_ctrl_op(15) & "000" & x"000";--7 
+int_med_stat_op     <= loc_ctrl_op_1(15) & "000" & x"000";  --7
 
 DATA_ACTIVE         <= buf_DATA_ACTIVE;       
 DATA_OUT            <= buf_DATA_OUT;