]> jspc29.x-matter.uni-frankfurt.de Git - clocked_tdc.git/commitdiff
fix ToTExceededCounter
authorJan Michel <michel@physik.uni-frankfurt.de>
Thu, 29 Aug 2024 13:26:06 +0000 (15:26 +0200)
committerJan Michel <michel@physik.uni-frankfurt.de>
Thu, 29 Aug 2024 13:26:06 +0000 (15:26 +0200)
code/HitBuffer.vhd

index 505c7d3b46542777ca8ae10a93b0e45bcef0c86d..21baeb9a5ce413e62bce1e3ac2634b42dd0c5862 100644 (file)
@@ -113,7 +113,9 @@ PROC_BUILD_HIT : process begin
     maxtot_timer <= maxtot_timer - 1;
   else   
     edge_rising_valid <= '0';
-    count_edges3 <= count_edges3 + 1;
+    if edge_rising_valid = '1' then
+      count_edges3 <= count_edges3 + 1;
+    end if;
   end if;  
   
   
@@ -145,18 +147,14 @@ 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
+  if 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
-    count_edges2 <= (others => '0');
-  elsif count_spike_en = '1' then
+  if count_spike_en = '1' then
     count_edges2 <= count_edges2 + 1;
   end if;
 end process;
@@ -274,8 +272,8 @@ DATA_OUT <= hit_store(27 downto 0);
 STATUS_OUT(31 downto 0)   <= x"00" & std_logic_vector(count_edges1) when rising_edge(CLK_SYS);
 STATUS_OUT(63 downto 32)  <= x"00" & std_logic_vector(count_edges2) when rising_edge(CLK_SYS);
 STATUS_OUT(71 downto 64)  <= "00" &  hit_buffer_level when rising_edge(CLK_SYS);
-STATUS_OUT(95 downto 72)  <= std_logic_vector(count_edges3) when rising_edge(CLK_SYS);
-STATUS_OUT(127 downto 96) <= std_logic_vector(count_edges4) when rising_edge(CLK_SYS);
+STATUS_OUT(95 downto 72)  <= x"00" & std_logic_vector(count_edges3(15 downto 0)) when rising_edge(CLK_SYS);
+STATUS_OUT(127 downto 96) <= x"0000" & std_logic_vector(count_edges4(15 downto 0)) when rising_edge(CLK_SYS);
 
 
 ----------------------------------------------------------------------