]> jspc29.x-matter.uni-frankfurt.de Git - clocked_tdc.git/commitdiff
add counter for recorded hits and configuration info
authorJan Michel <michel@physik.uni-frankfurt.de>
Tue, 27 Aug 2024 12:47:49 +0000 (14:47 +0200)
committerJan Michel <michel@physik.uni-frankfurt.de>
Tue, 27 Aug 2024 12:47:49 +0000 (14:47 +0200)
code/HitBuffer.vhd
code/TDC_FF.vhd

index 836d7b655b9aa03d33889d3ad0443255c081cf60..6046cfb03797e9c1a00b075ddb797255ca5307cd 100644 (file)
@@ -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;
 
index 681774535b7636cb56f4c6e55f633bdeeb0df981..23fb709d902e02c5559e8403af2981a1266fb06c 100644 (file)
@@ -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