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

Subversion Repositories mod_sim_exp

[/] [mod_sim_exp/] [trunk/] [rtl/] [vhdl/] [core/] [adder_block.vhd] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 JonasDC
----------------------------------------------------------------------  
2
----  adder_block                                                 ---- 
3
----                                                              ---- 
4
----  This file is part of the                                    ----
5
----    Modular Simultaneous Exponentiation Core project          ---- 
6
----    http://www.opencores.org/cores/mod_sim_exp/               ---- 
7
----                                                              ---- 
8
----  Description                                                 ---- 
9
----    Adder block with a flipflop for the carry out             ----
10
----    for use in the montgommery multiplier pre and post        ----
11
----    computation adders                                        ----
12
----                                                              ----
13
----  Dependencies:                                               ----
14
----    - cell_1b_adder                                           ----
15
----    - d_flip_flop                                             ----
16
----                                                              ---- 
17
----  Authors:                                                    ----
18
----      - Geoffrey Ottoy, DraMCo research group                 ----
19
----      - Jonas De Craene, JonasDC@opencores.org                ---- 
20
----                                                              ---- 
21
---------------------------------------------------------------------- 
22
----                                                              ---- 
23
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG   ---- 
24
----                                                              ---- 
25
---- This source file may be used and distributed without         ---- 
26
---- restriction provided that this copyright statement is not    ---- 
27
---- removed from the file and that any derivative work contains  ---- 
28
---- the original copyright notice and the associated disclaimer. ---- 
29
----                                                              ---- 
30
---- This source file is free software; you can redistribute it   ---- 
31
---- and/or modify it under the terms of the GNU Lesser General   ---- 
32
---- Public License as published by the Free Software Foundation; ---- 
33
---- either version 2.1 of the License, or (at your option) any   ---- 
34
---- later version.                                               ---- 
35
----                                                              ---- 
36
---- This source is distributed in the hope that it will be       ---- 
37
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ---- 
38
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ---- 
39
---- PURPOSE.  See the GNU Lesser General Public License for more ---- 
40
---- details.                                                     ---- 
41
----                                                              ---- 
42
---- You should have received a copy of the GNU Lesser General    ---- 
43
---- Public License along with this source; if not, download it   ---- 
44
---- from http://www.opencores.org/lgpl.shtml                     ---- 
45
----                                                              ---- 
46
----------------------------------------------------------------------
47 2 JonasDC
 
48 3 JonasDC
library ieee;
49
use ieee.std_logic_1164.all;
50
use ieee.std_logic_arith.all;
51
use ieee.std_logic_unsigned.all;
52 2 JonasDC
 
53 3 JonasDC
library mod_sim_exp;
54
use mod_sim_exp.mod_sim_exp_pkg.all;
55
 
56 2 JonasDC
entity adder_block is
57 3 JonasDC
  generic (
58
    width : integer := 32
59
  );
60
  port (
61
    core_clk : in std_logic;
62
    a        : in  std_logic_vector((width-1) downto 0);
63
    b        : in  std_logic_vector((width-1) downto 0);
64
    cin      : in std_logic;
65
    cout     : out std_logic;
66
    s        : out  std_logic_vector((width-1) downto 0)
67
  );
68 2 JonasDC
end adder_block;
69
 
70 3 JonasDC
 
71 2 JonasDC
architecture Structural of adder_block is
72 3 JonasDC
  signal carry : std_logic_vector(width downto 0);
73 2 JonasDC
begin
74 3 JonasDC
 
75
  carry(0) <= cin;
76
 
77
  adder_chain : for i in 0 to (width-1) generate
78
    adders : cell_1b_adder
79
    port map(
80
      a          => a(i),
81
      mux_result => b(i),
82
      cin        => carry(i),
83
      cout       => carry(i+1),
84
      r          => s(i)
85
    );
86
  end generate;
87
 
88
  delay_1_cycle : d_flip_flop
89
  port map(
90
    core_clk => core_clk,
91
    reset    => '0',
92
    din      => carry(width),
93
    dout     => cout
94
  );
95
 
96
end Structural;

powered by: WebSVN 2.1.0

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