]> jspc29.x-matter.uni-frankfurt.de Git - tdc.git/commitdiff
fix reaction to timeout of reference time, remove parallel checks on reference time
authorJan Michel <j.michel@gsi.de>
Thu, 14 Jun 2018 14:53:08 +0000 (16:53 +0200)
committerJan Michel <j.michel@gsi.de>
Thu, 14 Jun 2018 14:53:08 +0000 (16:53 +0200)
releases/tdc_v2.3/Readout_record.vhd
releases/tdc_v2.3/TDC_record.vhd
releases/tdc_v2.3/TriggerHandler.vhd

index a82f1abaef166e743d53c9a57389860a05b07c36..58d3e7792090eec73efcf08066a7e32da03343cc 100644 (file)
@@ -414,7 +414,7 @@ begin  -- behavioral
         rd_fsm_debug_fsm <= x"4";
 
       when WAIT_FOR_LVL1_TRG_A =>       -- wait for trigger data valid
-        if READOUT_RX.data_valid = '1' or READOUT_RX.trg_timeout = '1' then
+        if READOUT_RX.data_valid = '1' then -- or READOUT_RX.trg_timeout = '1'
           if READOUT_RX.trg_type /= x"1" and READOUT_RX.trg_type /= x"D" then
             unknown_trg_fsm <= '1';
           end if;
index 1facb712e1c3ead0dd453ce9f37260fa1053d8fd..f9c98287ae2d19401cd3955cd86dda5d6282abb9 100644 (file)
@@ -150,7 +150,7 @@ architecture TDC_record of TDC_record is
   
   signal hit_in_reg                   : std_logic_vector(CHANNEL_NUMBER-1 downto 1);
   signal ref_in_reg                   : std_logic;
-
+  signal trg_handler_trg_valid        : std_logic;
 
   attribute syn_keep                    : boolean;
   attribute syn_keep of reset_tdc       : signal is true;
@@ -246,7 +246,7 @@ begin
         if FPGA_TYPE = 3 then
           cal_cntr <= "11100";
         elsif FPGA_TYPE = 5 then
-          cal_cntr <= "01000";
+          cal_cntr <= "11000";
         end if;  
       else
         cal_cntr <= std_logic_vector(unsigned(cal_cntr) + to_unsigned(1, 5));
@@ -486,7 +486,7 @@ begin
       RESET_TRG             => reset_rdo,
       RESET_RDO             => reset_rdo,
       RESET_TDC             => reset_tdc,
-      VALID_TIMING_TRG_IN   => busreadout_rx.valid_timing_trg,
+      VALID_TIMING_TRG_IN   => trg_handler_trg_valid,
       VALID_NOTIMING_TRG_IN => busreadout_rx.valid_notiming_trg,
       TRG_TYPE_IN           => busreadout_rx.trg_type,
       TRG_RELEASE_IN        => busreadout_tx.busy_release,
@@ -504,7 +504,8 @@ begin
       DEBUG_OUT             => trg_handler_status_registers
       );
   trg_in <= REFERENCE_TIME;
-
+  trg_handler_trg_valid <= busreadout_rx.valid_timing_trg or busreadout_rx.invalid_trg;
+  
 -------------------------------------------------------------------------------
 -- Readout
 -------------------------------------------------------------------------------
index f0271f5df335dc2f4056f7f1ea9fbe0b4c16700a..4310b366daec8cded367376b2d22f9483be6a453 100644 (file)
@@ -91,30 +91,32 @@ begin  -- architecture behavioral
   trg_in_2r <= trg_in_r  when rising_edge(CLK_TDC);
   trg_in_3r <= trg_in_2r when rising_edge(CLK_TDC);
 
-  GEN_TRIGGER : for i in 0 to TRIGGER_NUM-1 generate
-    Validation : process (CLK_TDC)
-    begin
-      if rising_edge(CLK_TDC) then
-
-        -- calculate trigger length
-        if trg_in_3r(i) = '0' then
-          trg_length(i) <= (others => '0');
-        else
-          trg_length(i) <= trg_length(i) + to_unsigned(1, 5);
-        end if;
-
-        -- accept trigger if it is longer than 100 ns
-        if RESET_TDC = '1' then
-          trg_pulse_tdc(i) <= '0';
-        elsif trg_length(i) = to_unsigned(15, 5) then
-          trg_pulse_tdc(i) <= '1';
-        else
-          trg_pulse_tdc(i) <= '0';
-        end if;
+--   GEN_TRIGGER : for i in 0 to TRIGGER_NUM-1 generate
+--     Validation : process (CLK_TDC)
+--     begin
+--       if rising_edge(CLK_TDC) then
+-- 
+--         -- calculate trigger length
+--         if trg_in_3r(i) = '0' then
+--           trg_length(i) <= (others => '0');
+--         else
+--           trg_length(i) <= trg_length(i) + to_unsigned(1, 5);
+--         end if;
+-- 
+--         -- accept trigger if it is longer than 100 ns
+--         if RESET_TDC = '1' then
+--           trg_pulse_tdc(i) <= '0';
+--         elsif trg_length(i) = to_unsigned(15, 5) then
+--           trg_pulse_tdc(i) <= '1';
+--         else
+--           trg_pulse_tdc(i) <= '0';
+--         end if;
+-- 
+--       end if;
+--     end process Validation;
+--   end generate GEN_TRIGGER;
+trg_pulse_tdc(0) <= valid_timing_200;
 
-      end if;
-    end process Validation;
-  end generate GEN_TRIGGER;
 
   -- sync the strobes to the readout clock domain
   GEN_TDC : for i in 0 to TRIGGER_NUM-1 generate
@@ -206,7 +208,7 @@ begin  -- architecture behavioral
 
     case STATE_TW_CURRENT is
       when IDLE =>
-        if trg_in_3r(0) = '1' then
+        if valid_timing_200 = '1' and trg_in_3r(0) = '1' then
           if TRG_WIN_EN_IN = '1' then
             STATE_TW_NEXT <= COUNT;
           else