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

Back to eFEX documentation
MultiAdder.vhd
Go to the documentation of this file.
1 
11 
12 library IEEE;
13 use IEEE.STD_LOGIC_1164.all;
14 use IEEE.NUMERIC_STD.all;
15 
16 library work;
17 use work.DataTypes.all;
18 
20 entity MultiAdder is
21  generic (stage : integer := 4;
22  delay : integer := 0
23  );
24 
25  port (
26  CLK : in std_logic;
27  IN_Words : in DataWords((2**stage)-1 downto 0);
28  OUT_Overflow : out std_logic;
29  OUT_Word : out DataWord
30  );
31 end MultiAdder;
32 
34 architecture Behavioral of MultiAdder is
35  signal connector : DataWords((2**(stage+1))-2 downto 0);
36  signal carry : std_logic_vector((2**(stage+1))-2 downto 0);
37  signal DelayedOut : DataWords(delay downto 0) := (others => (others => '0'));
38  signal DelayedOverflow : std_logic_vector(delay downto 0) := (others => '0');
39 
40 begin
41 
42  stage_gen : for s in 0 to (stage - 1) generate
43  adder_gen : for i in 0 to ((2**s) - 1) generate
44  ADD : entity work.Adder port map (
45  CLK => CLK,
46  IN_Carry => carry(2*(2**s + i) downto 2*(2**s + i) - 1),
47  OUT_Carry => carry((2**s) - 1 + i),
48  IN_Words => connector(2*(2**s + i) downto 2*(2**s + i) - 1),
49  OUT_Word => connector((2**s) - 1 + i)
50  );
51  end generate adder_gen;
52  end generate stage_gen;
53 
54 
55  connector((2**(stage+1) - 2) downto ((2**stage) - 1)) <= IN_Words;
56  carry((2**(stage+1) - 2) downto ((2**stage) - 1)) <= (others => '0');
57 
58  dalay_proc : process (CLK)
59  begin
60  if rising_edge(CLK) then
61  DelayedOut(DelayedOut'high) <= connector(0);
62  DelayedOverflow(DelayedOverflow'high) <= carry(0);
63  DelayedOverflow(DelayedOverflow'high-1 downto 0) <= DelayedOverflow(DelayedOverflow'high downto 1);
64  DelayedOut(DelayedOut'high-1 downto 0) <= DelayedOut(DelayedOut'high downto 1);
65  end if;
66 
67  end process;
68 
69  OUT_Word <= DelayedOut(0);
70  OUT_Overflow <= DelayedOverflow(0);
71 
72 end Behavioral;
2-word adder
Definition: Adder.vhd:14
Multiple Adder: adds many input words in cascade.
Definition: MultiAdder.vhd:34
Multiple Adder: adds many input words in cascade.
Definition: MultiAdder.vhd:20
in CLK std_logic
200 MHz clock
Definition: MultiAdder.vhd:26