OpenCores
URL https://opencores.org/ocsvn/pulse_processing_algorithm/pulse_processing_algorithm/trunk

Subversion Repositories pulse_processing_algorithm

[/] [pulse_processing_algorithm/] [event_detector.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 panda_emc
-----------------------------------------------------------------------------------------------
2
--
3
--    Copyright (C) 2011 Peter Lemmens, PANDA collaboration
4
--              p.j.j.lemmens@rug.nl
5
--    http://www-panda.gsi.de
6
--
7
--    As a reference, please use:
8
--    E. Guliyev, M. Kavatsyuk, P.J.J. Lemmens, G. Tambave, H. Loehner,
9
--    "VHDL Implementation of Feature-Extraction Algorithm for the PANDA Electromagnetic Calorimeter"
10
--    Nuclear Inst. and Methods in Physics Research, A ....
11
--
12
--
13
--    This program is free software; you can redistribute it and/or modify
14
--    it under the terms of the GNU Lesser General Public License as published by
15
--    the Free Software Foundation; either version 3 of the License, or
16
--    (at your option) any later version.
17
--
18
--    This program is distributed in the hope that it will be useful,
19
--    but WITHOUT ANY WARRANTY; without even the implied warranty of
20
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
--    GNU Lesser General Public License for more details.
22
--
23
--    You should have received a copy of the GNU General Public License
24
--    along with this program; if not, write to the Free Software
25
--    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
26
--
27
-----------------------------------------------------------------------------------------------
28
-----------------------------------------------------------------------------------------------
29
-- Company              :       KVI (Kernfysisch Versneller Instituut  -- Groningen, The Netherlands    
30
-- Author               :       P.J.J. Lemmens
31
-- Design Name  :       Feature Extraction
32
-- Module Name  :       event_detector.vhd
33
-- Description  :       Module detects events on the following conditions:
34
--                                              - The system is running                                                         (enable = '1')
35
--                                              - eventdetection is not inhibited                               (gate_in = '1')
36
--                                              - a zero-crossing is detected                                           (zeroX_in = '1')
37
--                                              - the signal integral exceeds the threshold     (integral_in > threshold_in)
38
--                                              when these conditions are met, event_detect_out becomes '1' for 1 clk-cycle
39
--                                              
40
-----------------------------------------------------------------------------------------------
41
library IEEE;
42
use IEEE.STD_LOGIC_1164.ALL;
43
use IEEE.STD_LOGIC_ARITH.ALL;
44
use IEEE.STD_LOGIC_SIGNED.ALL;
45
 
46
entity event_detector is
47
        Port (  clk                                     : in STD_LOGIC;
48
                                enable                          : in STD_LOGIC := '1';
49
                                gate_in                         : in STD_LOGIC;
50
                                zeroX_in                                : in STD_LOGIC;
51
                                threshold_in            : in STD_LOGIC_VECTOR;
52
                                integral_in                     : in STD_LOGIC_VECTOR;
53
                                event_detect_out        : out STD_LOGIC
54
                        );
55
end event_detector;
56
 
57
architecture Behavioral of event_detector is
58
 
59
        constant        WIDTH                   : natural := integral_in'length;
60
 
61
        signal clk_S                                    : std_logic := '0';
62
        signal enable_S                         : std_logic := '0';
63
        signal zeroX_S                                  : STD_LOGIC := '0';
64
        signal gate_S                                   : STD_LOGIC := '0';
65
        signal event_detect_S           : STD_LOGIC := '0';
66
        signal threshold_S                      : STD_LOGIC_VECTOR (WIDTH - 1 downto 0) := (others       => '0');
67
        signal integral_S                               : STD_LOGIC_VECTOR (WIDTH - 1 downto 0) := (others       => '0');
68
 
69
begin
70
 
71
        clk_S                                   <=      clk;
72
        enable_S                                <=      enable;
73
        gate_S                          <=      gate_in;
74
        zeroX_S                         <=      zeroX_in;
75
        threshold_S                     <=      threshold_in;
76
        integral_S                      <=      integral_in;
77
        event_detect_out        <=      event_detect_S;
78
 
79
        eventdetect : process(clk_S)    -- introduced to compensate for synchronous resets (1 clock cycle delay)
80
        begin
81
                if (clk_S'event and clk_S = '1') then
82
                        if (enable_S = '1') then
83
                                if ((zeroX_S = '1') and (integral_S > threshold_S) and (gate_S = '1') and (event_detect_S = '0')) then
84
                                        event_detect_S <= '1';
85
                                else
86
                                        event_detect_S <= '0';
87
                                end if;
88
                        end if;
89
                end if;
90
        end process;
91
 
92
end Behavioral;
93
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.