eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
Adder.vhd
Go to the documentation of this file.
1 
6 
7 library IEEE;
8 use IEEE.STD_LOGIC_1164.all;
9 use IEEE.NUMERIC_STD.all;
10 
11 use work.DataTypes.all;
12 
14 entity Adder is
15  port (
16  CLK : in std_logic;
17 
18  IN_Carry : in std_logic_vector(1 downto 0);
19  OUT_Carry : out std_logic;
20 
21  IN_Words : in DataWords(1 downto 0);
22  OUT_Word : out DataWord
23  );
24 end Adder;
25 
27 architecture Behavioral of Adder is
28 
29  signal OutWord : DataWord := (others => '0');
30  signal OutCarry : std_logic := '0';
31 
32 begin
33 
34  process (CLK)
35  variable Sum : std_logic_vector(OUT_Word'high+1 downto 0) := (others => '0');
36  begin
37  if rising_edge(CLK) then
38  Sum := std_logic_vector(unsigned('0'&IN_Words(0)) + unsigned('0'&IN_Words(1)));
39  OutWord <= Sum(OUT_Word'high downto 0);
40  OutCarry <= Sum(OUT_Word'high+1) or IN_Carry(0) or IN_Carry(1);
41  end if;
42  end process;
43 
44  OUT_Word <= OutWord;
45  OUT_Carry <= OutCarry;
46 
47 end Behavioral;
48 
49 
2-word adder
Definition: Adder.vhd:27
2-word adder
Definition: Adder.vhd:14