From b95e67a99481cab5c03e5f9547326213e43cfc95 Mon Sep 17 00:00:00 2001 From: Adrian Weber Date: Tue, 21 Jul 2020 09:38:36 +0200 Subject: [PATCH] fix in cri_hub's stat_op and ctrl_op handling to get stacked hub config running --- src/hub/trb_net16_cri_hub.vhd | 47 +++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/hub/trb_net16_cri_hub.vhd b/src/hub/trb_net16_cri_hub.vhd index 8f0cfad..8edcbba 100644 --- a/src/hub/trb_net16_cri_hub.vhd +++ b/src/hub/trb_net16_cri_hub.vhd @@ -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; -- 2.43.0