From 7dc61988f83e12b0f2c8f0b48352d3dde89d3535 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Tue, 27 Aug 2024 14:47:49 +0200 Subject: [PATCH] add counter for recorded hits and configuration info --- code/HitBuffer.vhd | 14 +++++++++----- code/TDC_FF.vhd | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/code/HitBuffer.vhd b/code/HitBuffer.vhd index 836d7b6..6046cfb 100644 --- a/code/HitBuffer.vhd +++ b/code/HitBuffer.vhd @@ -138,6 +138,15 @@ PROC_BUILD_HIT : process begin end process; +process begin + wait until rising_edge(CLK_TDC); + if RESET_IN = '1' then + count_edges1 <= (others => '0'); + elsif hit_buffer_write = '1' then + count_edges1 <= count_edges1 + 1; + end if; +end process; + process begin wait until rising_edge(CLK_TDC); if RESET_IN = '1' then @@ -179,10 +188,6 @@ PROC_BUF : process begin hit_buffer_read <= '0'; hit_buffer_reset <= '0'; DATA_EMPTY <= '0'; - --- if hit_buffer_read = '1' then --- count_edges1 <= count_edges1 + 1; --- end if; case buffer_state is when EMPTY => @@ -253,7 +258,6 @@ PROC_BUF : process begin if RESET_IN = '1' then buffer_state <= EMPTY; hit_buffer_reset <= '1'; --- count_edges1 <= (others => '0'); end if; end process; diff --git a/code/TDC_FF.vhd b/code/TDC_FF.vhd index 6817745..23fb709 100644 --- a/code/TDC_FF.vhd +++ b/code/TDC_FF.vhd @@ -235,6 +235,8 @@ begin BUS_TX.data <= status_rdo_handler(31 downto 0); elsif BUS_RX.addr = x"0011" then BUS_TX.data <= status_rdo_handler(63 downto 32); + elsif BUS_RX.addr = x"0020" then + BUS_TX.data <= x"00" & x"01" & x"0a" & std_logic_vector(to_unsigned(NUM_CHANNELS,8)); --1e:hit buffer size 32, 01: data format leading/trailing elsif BUS_RX.addr(15 downto 5) = x"01" & "000" then BUS_TX.data <= hitbuffer_status(addr)(31 downto 0); elsif BUS_RX.addr(15 downto 5) = x"01" & "001" then -- 2.43.0