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

Subversion Repositories pulse_processing_algorithm

[/] [pulse_processing_algorithm/] [compare_a2b.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  :       compare_a2b
33
-- Description  :       Signed comparator of input A-to-B
34
--      Inputs          :       
35
--      Outputs         :       
36
-----------------------------------------------------------------------------------------------
37
--      Generics                :       
38
--      Parameters      :
39
-----------------------------------------------------------------------------------------------
40
library IEEE;
41
use IEEE.STD_LOGIC_1164.ALL;
42
use IEEE.STD_LOGIC_ARITH.ALL;
43
use IEEE.STD_LOGIC_SIGNED.ALL;
44
 
45
 
46
entity compare_a2b is
47
        Port (  clk     : std_logic;
48
                                a               : in    STD_LOGIC_VECTOR;
49
                                b               : in    STD_LOGIC_VECTOR;
50
                                lt              : out   STD_LOGIC;
51
                                gt              : out   STD_LOGIC
52
                        );
53
end compare_a2b;
54
 
55
architecture Behavioral of compare_a2b is
56
 
57
        constant WIDTH  : natural       := a'length;
58
 
59
        signal clk_S    : std_logic := '0';
60
        signal a_S              : std_logic_vector(WIDTH - 1 downto 0) := (others => '0');
61
        signal b_S              : std_logic_vector(WIDTH - 1 downto 0) := (others => '0');
62
        signal lt_S             : std_logic := '0';
63
        signal gt_S             : std_logic := '0';
64
 
65
 
66
begin
67
        clk_S   <= clk;
68
        a_S     <= a;
69
        b_S     <= b;
70
        lt              <= lt_S;
71
        gt              <= gt_S;
72
 
73
        process( clk_S, a_S, b_S)
74
        begin
75
                if (clk_S'event and clk_S = '1') then
76
                        if (a_S > b_S) then
77
                                gt_S    <=      '1';
78
                                lt_S    <=      '0';
79
                        else
80
                                if (a_S < b_S) then
81
                                        gt_S    <=      '0';
82
                                        lt_S    <=      '1';
83
                                else
84
                                        gt_S    <=      '0';
85
                                        lt_S    <=      '0';
86
                                end if;
87
                        end if;
88
                end if;
89
        end process;
90
end Behavioral;
91
 

powered by: WebSVN 2.1.0

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