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

Subversion Repositories pulse_processing_algorithm

[/] [pulse_processing_algorithm/] [mux_sre.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: mux_sre.vhd
33
-- Description: MUltipleXer/switch with input-Select, Reset & Enable
34
--
35
-----------------------------------------------------------------------------------------------
36
 
37
library IEEE;
38
use IEEE.STD_LOGIC_1164.ALL;
39
 
40
entity mux_sre is
41
   Port (rst                    : in  STD_LOGIC;
42
                        clk                     : in  STD_LOGIC;
43
                        enable          : in  STD_LOGIC;
44
                        selectB         : in  STD_LOGIC;
45
                        a                               : in  STD_LOGIC_VECTOR;
46
                        b                               : in  STD_LOGIC_VECTOR;
47
                        data_valid      : out   STD_LOGIC;
48
                        q                               : out STD_LOGIC_VECTOR
49
                );
50
end mux_sre;
51
 
52
architecture Behavioral of mux_sre is
53
 
54
constant        WIDTH                   : natural := a'length;
55
 
56
signal rst_S                    : std_logic := '1';
57
signal clk_S                    : std_logic;
58
signal enable_S         : std_logic;
59
signal selectB_S                : std_logic     :=      '0';
60
signal data_valid_S     : std_logic := '0';
61
signal a_S                              : STD_LOGIC_VECTOR(a'high downto 0);
62
signal b_S                              : STD_LOGIC_VECTOR(b'high downto 0);
63
signal q_S                              : STD_LOGIC_VECTOR(q'high downto 0) := (others => '0');
64
 
65
begin
66
        rst_S                           <= rst;
67
        clk_S                           <= clk;
68
        enable_S                        <= enable;
69
        selectB_S               <=      selectB;
70
        data_valid              <=      data_valid_S;
71
        a_S                             <= a;
72
        b_S                             <= b;
73
        q                                       <= q_S;
74
 
75
        process(clk_S, rst_S, enable_S, selectB_S)
76
        begin
77
                if rising_edge(clk_S) then
78
                        if rst_S='1' then
79
                                q_S(WIDTH - 1 downto 0) <= (others => '0');
80
                                data_valid_S    <= '0';
81
                        elsif (enable_S = '1') then
82
                                if (selectB_S = '0') then
83
                                        q_S                             <= a_S;
84
                                        data_valid_S    <= '1';
85
                                else
86
                                        q_S                             <= b_S;
87
                                        data_valid_S    <= '1';
88
                                end if;
89
                        else
90
                                data_valid_S    <= '0';
91
                        end if;
92
                end if;
93
        end process;
94
end Behavioral;
95
 

powered by: WebSVN 2.1.0

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