]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
change asynchronous detection of reference time edges
authorJan Michel <j.michel@gsi.de>
Thu, 14 Jun 2018 14:54:20 +0000 (16:54 +0200)
committerJan Michel <j.michel@gsi.de>
Thu, 14 Jun 2018 14:54:20 +0000 (16:54 +0200)
special/handler_lvl1.vhd

index 5deb004c7dcb52055738bfe7b02266672a5f2392..e4d8bef2bb7d8d677d0ad389542a03b52b51b9ea 100644 (file)
@@ -143,8 +143,9 @@ signal wrong_polarity       : std_logic;
 
 signal tmg_edge_ctr         : unsigned(15 downto 0);
 signal tmg_edge_found_i     : std_logic;
-signal sr0                  : std_logic;
-signal tmg_edge_async       : std_logic;
+-- signal sr0                  : std_logic;
+-- signal tmg_edge_async       : std_logic;
+signal tmg_reg, tmg_stretch,tmg_reg_last : std_logic;
 signal buf_STATUS_OUT       : std_logic_vector(63 downto 0);
 signal waiting_for_first    : std_logic;
 
@@ -273,29 +274,37 @@ end process MULTIPLE_TRG_FND_PROC;
 -- Tmg Trigger spike detect
 -------------------------------------------------------------------------------
 
-  process (tmg_edge_found_i, LVL1_TIMING_TRG_IN)
-    begin
-      if ( tmg_edge_found_i = '1') then 
-        tmg_edge_async <= '0';
-      elsif rising_edge(LVL1_TIMING_TRG_IN) then 
-        tmg_edge_async <= '1'; 
-      end if;
+--   process (tmg_edge_found_i, LVL1_TIMING_TRG_IN)
+--     begin
+--       if ( tmg_edge_found_i = '1') then 
+--         tmg_edge_async <= '0';
+--       elsif rising_edge(LVL1_TIMING_TRG_IN) then 
+--         tmg_edge_async <= '1'; 
+--       end if;
+--   end process;
+--   
+--   -- Asynchrones Merker-FF eintakten
+--   process 
+--     begin
+--       wait until rising_edge(CLOCK);
+--       if(tmg_edge_found_i = '1') then 
+--         sr0 <= '0'; 
+--         tmg_edge_found_i <= '0'; 
+--       else
+--         sr0 <= tmg_edge_async; 
+--         tmg_edge_found_i <= sr0; 
+--       end if;
+--   end process;
+
+  tmg_stretch <= (LVL1_TIMING_TRG_IN or tmg_stretch) and not tmg_reg;
+  process begin
+    wait until rising_edge(CLOCK);
+    tmg_reg      <= LVL1_TIMING_TRG_IN or tmg_stretch;  
+    tmg_reg_last <= tmg_reg;
+    tmg_edge_found_i <= tmg_reg and not tmg_reg_last;
   end process;
   
-  -- Asynchrones Merker-FF eintakten
-  process 
-    begin
-      wait until rising_edge(CLOCK);
-      if(tmg_edge_found_i = '1') then 
-        sr0 <= '0'; 
-        tmg_edge_found_i <= '0'; 
-      else
-        sr0 <= tmg_edge_async; 
-        tmg_edge_found_i <= sr0; 
-      end if;
-  end process;
-
-
+  
 ---------------------------------------------------------------------------
 -- Timeout counter for LVL1
 ---------------------------------------------------------------------------