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

Subversion Repositories pulse_processing_algorithm

[/] [pulse_processing_algorithm/] [dff_re.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  :       dff_re.vhd
33
-- Description  :       D-FlipFlop with Reset & Enable; variable width
34
--                                              
35
-----------------------------------------------------------------------------------------------
36
 
37
library IEEE;
38
use IEEE.STD_LOGIC_1164.ALL;
39
 
40
entity dff_re is
41
   Port (       rst                     : in  STD_LOGIC;
42
                                clk                     : in  STD_LOGIC;
43
                                enable          : in  STD_LOGIC;
44
                                data_valid      : out   STD_LOGIC;
45
                                d                               : in  STD_LOGIC_VECTOR;
46
                                q                               : out STD_LOGIC_VECTOR
47
                                );
48
end dff_re;
49
 
50
architecture Behavioral of dff_re is
51
        constant        WIDTH           : natural := d'length;
52
   signal rst_S                 : std_logic := '1';
53
        signal clk_S                    : std_logic;
54
        signal enable_S         : std_logic;
55
        signal data_valid_S     : std_logic := '0';
56
        signal d_S                              : STD_LOGIC_VECTOR(d'high downto 0);
57
        signal q_S                              : STD_LOGIC_VECTOR(q'high downto 0) := (others => '0');
58
 
59
begin
60
        rst_S                           <= rst;
61
        clk_S                           <= clk;
62
        enable_S                        <= enable;
63
        data_valid              <=      data_valid_S;
64
        d_S                             <= d;
65
        q                                       <= q_S;
66
 
67
        process(clk_S, rst_S, enable_S)
68
        begin
69
                if rising_edge(clk_S) then
70
                        if rst_S='1' then
71
                                q_S(WIDTH - 1 downto 0) <= (others => '0');
72
                                data_valid_S    <= '0';
73
                        elsif (enable_S = '1') then
74
                                q_S                             <= d_S;
75
                                data_valid_S    <= '1';
76
                        else
77
                                data_valid_S    <= '0';
78
                        end if;
79
                end if;
80
        end process;
81
end Behavioral;
82
 

powered by: WebSVN 2.1.0

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