From 5716d0b6d6f51bead2abd1b89ad6829b6bf3c319 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Tue, 14 Jan 2025 12:52:46 +0100 Subject: [PATCH] update streaming accelerator to work with Hades CTS --- trb_net16_api_ipu_streaming_accel.vhd | 38 ++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/trb_net16_api_ipu_streaming_accel.vhd b/trb_net16_api_ipu_streaming_accel.vhd index e6a70e2..fb746b2 100644 --- a/trb_net16_api_ipu_streaming_accel.vhd +++ b/trb_net16_api_ipu_streaming_accel.vhd @@ -159,6 +159,7 @@ architecture trb_net16_api_ipu_streaming_arch of trb_net16_api_ipu_streaming_acc type fsm_state_t is (IDLE,SEND_REQUEST_OWN,WAIT_FOR_CTS_REQUEST,CHECK_CTS_INFO,DATA_TRANSFER); signal ipu_fsm_state : fsm_state_t; + signal cnt1,cnt2 : unsigned(7 downto 0); begin @@ -392,7 +393,8 @@ THE_IPU_FSM : process begin fifo_trg_read <= '0'; last_fifo_trg_read <= fifo_trg_read; fifo_trg_valid <= last_fifo_trg_read; - + data_transfer_enabled <= '0'; + case ipu_fsm_state is when IDLE => fsm_ipu_status_bits <= x"0"; @@ -400,22 +402,23 @@ THE_IPU_FSM : process begin fifo_trg_read <= '1'; ipu_fsm_state <= SEND_REQUEST_OWN; fsm_error <= x"00"; - end if; - if buf_CTS_START_READOUT_OUT = '1' then + cnt2 <= cnt2 + 1; + end if; + if buf_CTS_START_READOUT_OUT = '1' and cfg_settings(0) = '0' then apl_fee_send_in <= '1'; apl_fee_error_pattern_in(15 downto 0) <= buf_CTS_NUMBER_OUT; apl_fee_error_pattern_in(23 downto 16) <= buf_CTS_CODE_OUT; apl_fee_error_pattern_in(31 downto 24) <= buf_CTS_INFORMATION_OUT; apl_fee_dtype_in <= buf_CTS_READOUT_TYPE_OUT; ipu_fsm_state <= DATA_TRANSFER; - fsm_error <= x"00"; + fsm_error <= x"00"; + cnt1 <= cnt1 + 1; end if; - + when SEND_REQUEST_OWN => fsm_ipu_status_bits <= x"a"; - data_transfer_enabled <= '0'; if fifo_trg_valid = '1' then apl_fee_send_in <= '1'; apl_fee_error_pattern_in(15 downto 0) <= fifo_trg_number; @@ -450,7 +453,12 @@ THE_IPU_FSM : process begin end if; end case; - + if RESET = '1' then + ipu_fsm_state <= IDLE; + fifo_trg_read <= '0'; + cnt1 <= (others => '0'); + cnt2 <= (others => '0'); + end if; end process; @@ -659,6 +667,21 @@ THE_REGS : process begin elsif BUS_RX.addr = x"0012" then BUS_TX.data(7 downto 0) <= fsm_error; BUS_TX.data(11 downto 8) <= fsm_ipu_status_bits; + elsif BUS_RX.addr = x"0013" then + BUS_TX.data(15 downto 0) <= cts_trg_number; + BUS_TX.data(19 downto 16) <= cts_trg_type; + BUS_TX.data(27 downto 20) <= cts_trg_code; + BUS_TX.data(28) <= cts_trg_received; + BUS_TX.data(31 downto 29) <= (others => '0'); + elsif BUS_RX.addr = x"0014" then + BUS_TX.data(15 downto 0) <= fifo_trg_number; + BUS_TX.data(19 downto 16) <= fifo_trg_type; + BUS_TX.data(27 downto 20) <= fifo_trg_code; + BUS_TX.data(28) <= '0'; + BUS_TX.data(31 downto 29) <= (others => '0'); + elsif BUS_RX.addr = x"0015" then + BUS_TX.data(7 downto 0) <= cnt1; + BUS_TX.data(15 downto 8) <= cnt2; else BUS_TX.ack <= '0'; BUS_TX.unknown <= '1'; @@ -667,4 +690,5 @@ THE_REGS : process begin end process; + end architecture; -- 2.43.0