| 1 |
30 |
JonasDC |
----------------------------------------------------------------------
|
| 2 |
|
|
---- sys_last_cell_logic ----
|
| 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 |
|
|
---- last cell logic for use int the montogommery mulitplier ----
|
| 10 |
|
|
---- pipelined systolic array ----
|
| 11 |
|
|
---- ----
|
| 12 |
|
|
---- Dependencies: ----
|
| 13 |
|
|
---- - register_n ----
|
| 14 |
|
|
---- - cell_1b_adder ----
|
| 15 |
|
|
---- ----
|
| 16 |
|
|
---- Authors: ----
|
| 17 |
|
|
---- - Geoffrey Ottoy, DraMCo research group ----
|
| 18 |
|
|
---- - Jonas De Craene, JonasDC@opencores.org ----
|
| 19 |
|
|
---- ----
|
| 20 |
|
|
----------------------------------------------------------------------
|
| 21 |
|
|
---- ----
|
| 22 |
|
|
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG ----
|
| 23 |
|
|
---- ----
|
| 24 |
|
|
---- This source file may be used and distributed without ----
|
| 25 |
|
|
---- restriction provided that this copyright statement is not ----
|
| 26 |
|
|
---- removed from the file and that any derivative work contains ----
|
| 27 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
| 28 |
|
|
---- ----
|
| 29 |
|
|
---- This source file is free software; you can redistribute it ----
|
| 30 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
| 31 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
| 32 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
| 33 |
|
|
---- later version. ----
|
| 34 |
|
|
---- ----
|
| 35 |
|
|
---- This source is distributed in the hope that it will be ----
|
| 36 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
| 37 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
| 38 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
| 39 |
|
|
---- details. ----
|
| 40 |
|
|
---- ----
|
| 41 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
| 42 |
|
|
---- Public License along with this source; if not, download it ----
|
| 43 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
| 44 |
|
|
---- ----
|
| 45 |
|
|
----------------------------------------------------------------------
|
| 46 |
|
|
|
| 47 |
|
|
library ieee;
|
| 48 |
|
|
use ieee.std_logic_1164.all;
|
| 49 |
|
|
use ieee.std_logic_unsigned.all;
|
| 50 |
|
|
|
| 51 |
|
|
library mod_sim_exp;
|
| 52 |
|
|
use mod_sim_exp.mod_sim_exp_pkg.all;
|
| 53 |
|
|
|
| 54 |
|
|
-- logic needed as the last piece in the systolic array pipeline
|
| 55 |
|
|
-- calculates the last 2 bits of the cell_result and finishes the reduction
|
| 56 |
|
|
-- also generates the result selection signal
|
| 57 |
|
|
entity sys_last_cell_logic is
|
| 58 |
|
|
port (
|
| 59 |
|
|
core_clk : in std_logic; -- clock input
|
| 60 |
|
|
reset : in std_logic;
|
| 61 |
|
|
a_0 : out std_logic; -- a_msb for last stage
|
| 62 |
|
|
cin : in std_logic; -- cout from last stage
|
| 63 |
|
|
red_cin : in std_logic; -- red_cout from last stage
|
| 64 |
|
|
r_sel : out std_logic; -- result selection bit
|
| 65 |
|
|
start : in std_logic -- done signal from last stage
|
| 66 |
|
|
);
|
| 67 |
|
|
end sys_last_cell_logic;
|
| 68 |
|
|
|
| 69 |
|
|
|
| 70 |
|
|
architecture Behavorial of sys_last_cell_logic is
|
| 71 |
39 |
JonasDC |
signal cin_reg : std_logic;
|
| 72 |
30 |
JonasDC |
begin
|
| 73 |
|
|
|
| 74 |
39 |
JonasDC |
a_0 <= cin_reg;
|
| 75 |
30 |
JonasDC |
|
| 76 |
39 |
JonasDC |
last_reg : register_1b
|
| 77 |
30 |
JonasDC |
port map(
|
| 78 |
|
|
core_clk => core_clk,
|
| 79 |
|
|
ce => start,
|
| 80 |
|
|
reset => reset,
|
| 81 |
39 |
JonasDC |
din => cin,
|
| 82 |
|
|
dout => cin_reg
|
| 83 |
30 |
JonasDC |
);
|
| 84 |
|
|
|
| 85 |
39 |
JonasDC |
-- reduction, finishing last bit
|
| 86 |
|
|
reduction_adder : cell_1b_adder
|
| 87 |
30 |
JonasDC |
port map(
|
| 88 |
|
|
a => '1', -- for 2s complement of m
|
| 89 |
39 |
JonasDC |
b => cin_reg,
|
| 90 |
30 |
JonasDC |
cin => red_cin,
|
| 91 |
39 |
JonasDC |
cout => r_sel
|
| 92 |
30 |
JonasDC |
);
|
| 93 |
|
|
|
| 94 |
|
|
end Behavorial;
|