Line 1... |
Line 1... |
------------------------------------------------------------------------------------
|
----------------------------------------------------------------------
|
--
|
---- adder_block ----
|
-- Geoffrey Ottoy - DraMCo research group
|
---- ----
|
--
|
---- This file is part of the ----
|
-- Module Name: adder_block.vhd / entity adder_block
|
---- Modular Simultaneous Exponentiation Core project ----
|
--
|
---- http://www.opencores.org/cores/mod_sim_exp/ ----
|
-- Last Modified: 25/11/2011
|
---- ----
|
--
|
---- Description ----
|
-- Description: adder block for use in the montgommery multiplier pre- and post-
|
---- Adder block with a flipflop for the carry out ----
|
-- computation adders
|
---- for use in the montgommery multiplier pre and post ----
|
--
|
---- computation adders ----
|
--
|
---- ----
|
-- Dependencies: cell_1b_adder,
|
---- Dependencies: ----
|
-- d_flip_flop
|
---- - cell_1b_adder ----
|
--
|
---- - d_flip_flop ----
|
-- Revision:
|
---- ----
|
-- Revision 1.00 - Architecture
|
---- Authors: ----
|
-- Revision 0.01 - File Created
|
---- - Geoffrey Ottoy, DraMCo research group ----
|
--
|
---- - Jonas De Craene, JonasDC@opencores.org ----
|
--
|
---- ----
|
------------------------------------------------------------------------------------
|
----------------------------------------------------------------------
|
--
|
---- ----
|
-- NOTICE:
|
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG ----
|
--
|
---- ----
|
-- Copyright DraMCo research group. 2011. This code may be contain portions patented
|
---- This source file may be used and distributed without ----
|
-- by other third parties!
|
---- restriction provided that this copyright statement is not ----
|
--
|
---- removed from the file and that any derivative work contains ----
|
------------------------------------------------------------------------------------
|
---- the original copyright notice and the associated disclaimer. ----
|
library IEEE;
|
---- ----
|
use IEEE.STD_LOGIC_1164.ALL;
|
---- This source file is free software; you can redistribute it ----
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
---- Public License as published by the Free Software Foundation; ----
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
---- Uncomment the following library declaration if instantiating
|
---- later version. ----
|
---- any Xilinx primitives in this code.
|
---- ----
|
--library UNISIM;
|
---- This source is distributed in the hope that it will be ----
|
--use UNISIM.VComponents.all;
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
|
---- details. ----
|
|
---- ----
|
|
---- You should have received a copy of the GNU Lesser General ----
|
|
---- Public License along with this source; if not, download it ----
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
|
---- ----
|
|
----------------------------------------------------------------------
|
|
|
|
library ieee;
|
|
use ieee.std_logic_1164.all;
|
|
use ieee.std_logic_arith.all;
|
|
use ieee.std_logic_unsigned.all;
|
|
|
|
library mod_sim_exp;
|
|
use mod_sim_exp.mod_sim_exp_pkg.all;
|
|
|
entity adder_block is
|
entity adder_block is
|
generic ( width : integer := 32
|
generic (
|
|
width : integer := 32
|
);
|
);
|
Port ( core_clk : in STD_LOGIC;
|
port (
|
a : in STD_LOGIC_VECTOR((width-1) downto 0);
|
core_clk : in std_logic;
|
b : in STD_LOGIC_VECTOR((width-1) downto 0);
|
a : in std_logic_vector((width-1) downto 0);
|
cin : in STD_LOGIC;
|
b : in std_logic_vector((width-1) downto 0);
|
cout : out STD_LOGIC;
|
cin : in std_logic;
|
s : out STD_LOGIC_VECTOR((width-1) downto 0)
|
cout : out std_logic;
|
|
s : out std_logic_vector((width-1) downto 0)
|
);
|
);
|
end adder_block;
|
end adder_block;
|
|
|
architecture Structural of adder_block is
|
|
component cell_1b_adder
|
|
Port ( a : in STD_LOGIC;
|
|
mux_result : in STD_LOGIC;
|
|
cin : in STD_LOGIC;
|
|
cout : out STD_LOGIC;
|
|
r : out STD_LOGIC);
|
|
end component;
|
|
|
|
component d_flip_flop
|
|
port(core_clk : in STD_LOGIC;
|
|
reset : in STD_LOGIC;
|
|
din : in STD_LOGIC;
|
|
dout : out STD_LOGIC
|
|
);
|
|
end component;
|
|
|
|
|
architecture Structural of adder_block is
|
signal carry : std_logic_vector(width downto 0);
|
signal carry : std_logic_vector(width downto 0);
|
begin
|
begin
|
|
|
carry(0) <= cin;
|
carry(0) <= cin;
|
|
|
adder_chain: for i in 0 to (width-1) generate
|
adder_chain: for i in 0 to (width-1) generate
|
adders: cell_1b_adder
|
adders: cell_1b_adder
|
port map(a => a(i),
|
port map(
|
|
a => a(i),
|
mux_result => b(i),
|
mux_result => b(i),
|
cin => carry(i),
|
cin => carry(i),
|
cout => carry(i+1),
|
cout => carry(i+1),
|
r => s(i)
|
r => s(i)
|
);
|
);
|
end generate;
|
end generate;
|
|
|
delay_1_cycle: d_flip_flop
|
delay_1_cycle: d_flip_flop
|
port map(core_clk => core_clk,
|
port map(
|
|
core_clk => core_clk,
|
reset => '0',
|
reset => '0',
|
din => carry(width),
|
din => carry(width),
|
dout => cout
|
dout => cout
|
);
|
);
|
|
|
end Structural;
|
end Structural;
|
No newline at end of file
|
No newline at end of file
|
|
|
No newline at end of file
|
No newline at end of file
|