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/] [stepping_logic.vhd] - Diff between revs 2 and 3

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 1... Line 1...
------------------------------------------------------------------------------------ 
----------------------------------------------------------------------  
--                      
----  stepping_logic                                              ---- 
-- Geoffrey Ottoy - DraMCo research group
----                                                              ---- 
--
----  This file is part of the                                    ----
-- Module Name: stepping_logic.vhd / entity stepping_logic
----    Modular Simultaneous Exponentiation Core project          ---- 
-- 
----    http://www.opencores.org/cores/mod_sim_exp/               ---- 
-- Last Modified:       23/01/2012 
----                                                              ---- 
-- 
----  Description                                                 ---- 
-- Description:         stepping logic for the pipelined montgomery multiplier
----    stepping logic for the pipelined montgomery multiplier    ----
--
----                                                              ----
--
----  Dependencies:                                               ----
-- Dependencies:        counter_sync
----    - d_flip_flop                                             ----
--
----    - counter_sync                                            ----
-- Revision:
----                                                              ----
-- Revision 5.01 - defined integer range for t_sel and n_sel resulting in less LUTs
----  Authors:                                                    ----
-- Revision 5.00 - made the reset value changeable in runtime
----      - Geoffrey Ottoy, DraMCo research group                 ----
-- Revision 4.01 - Delayed ready pulse with 1 clk cylce. This delay is necessary
----      - Jonas De Craene, JonasDC@opencores.org                ---- 
--                 for the reduction to complete.
----                                                              ---- 
-- Revision 4.00 - Changed design to fit new pipeline-architecture
---------------------------------------------------------------------- 
--                 (i.e. 1 clock cycle / stage)
----                                                              ---- 
-- Revision 3.00 - Removed second delay on next_x
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG   ---- 
-- Revision 2.00 - Changed operation to give a pulse on stepping_done when pipeline
----                                                              ---- 
--                 operation has finished
---- This source file may be used and distributed without         ---- 
--      Revision 1.00 - Architecture
---- restriction provided that this copyright statement is not    ---- 
--      Revision 0.01 - File Created
---- removed from the file and that any derivative work contains  ---- 
--
---- the original copyright notice and the associated disclaimer. ---- 
--
----                                                              ---- 
------------------------------------------------------------------------------------
---- This source file is free software; you can redistribute it   ---- 
--
---- and/or modify it under the terms of the GNU Lesser General   ---- 
-- NOTICE:
---- Public License as published by the Free Software Foundation; ---- 
--
---- either version 2.1 of the License, or (at your option) any   ---- 
-- Copyright DraMCo research group. 2011. This code may be contain portions patented
---- later version.                                               ---- 
-- by other third parties!
----                                                              ---- 
--
---- This source is distributed in the hope that it will be       ---- 
------------------------------------------------------------------------------------
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ---- 
library IEEE;
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ---- 
use IEEE.STD_LOGIC_1164.ALL;
---- PURPOSE.  See the GNU Lesser General Public License for more ---- 
use IEEE.STD_LOGIC_ARITH.ALL;
---- details.                                                     ---- 
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----                                                              ---- 
 
---- You should have received a copy of the GNU Lesser General    ---- 
---- Uncomment the following library declaration if instantiating
---- Public License along with this source; if not, download it   ---- 
---- any Xilinx primitives in this code.
---- from http://www.opencores.org/lgpl.shtml                     ---- 
--library UNISIM;
----                                                              ---- 
--use UNISIM.VComponents.all;
----------------------------------------------------------------------
 
 
 
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 stepping_logic is
entity stepping_logic is
        generic( n : integer := 1536; -- max nr of steps required to complete a multiplication
  generic(
 
    n : integer := 1536; -- max nr of steps required to complete a multiplication
                                t : integer := 192 -- total nr of steps in the pipeline
                                t : integer := 192 -- total nr of steps in the pipeline
        );
        );
   port(    core_clk : in  STD_LOGIC;
  port(
                              start : in  STD_LOGIC;
    core_clk          : in  std_logic;
                              reset : in  STD_LOGIC;
    start             : in  std_logic;
 
    reset             : in  std_logic;
                                        t_sel : in integer range 0 to t; -- nr of stages in the pipeline piece
                                        t_sel : in integer range 0 to t; -- nr of stages in the pipeline piece
                                        n_sel : in integer range 0 to n; -- nr of steps required for a complete multiplication
                                        n_sel : in integer range 0 to n; -- nr of steps required for a complete multiplication
        start_first_stage : out STD_LOGIC;
    start_first_stage : out std_logic;
       stepping_done : out STD_LOGIC
    stepping_done     : out std_logic
        );
        );
end stepping_logic;
end stepping_logic;
 
 
architecture Behavioral of stepping_logic is
 
        component d_flip_flop
 
   port(core_clk : in  STD_LOGIC;
 
                          reset : in  STD_LOGIC;
 
                            din : in  STD_LOGIC;
 
                      dout : out STD_LOGIC
 
        );
 
        end component;
 
 
 
        component counter_sync
 
        generic(max_value : integer := 16
 
        );
 
   port(reset_value : in integer;
 
             core_clk : in  STD_LOGIC;
 
                             ce : in  STD_LOGIC;
 
                          reset : in  STD_LOGIC;
 
                  overflow : out STD_LOGIC
 
        );
 
        end component;
 
 
 
 
architecture Behavioral of stepping_logic is
        signal laststeps_in_i : std_logic := '0';
        signal laststeps_in_i : std_logic := '0';
        signal laststeps_out_i : std_logic := '0';
        signal laststeps_out_i : std_logic := '0';
        signal start_stop_in_i : std_logic := '0';
        signal start_stop_in_i : std_logic := '0';
        signal start_stop_out_i : std_logic := '0';
        signal start_stop_out_i : std_logic := '0';
        signal steps_in_i : std_logic := '0';
        signal steps_in_i : std_logic := '0';
Line 105... Line 98...
        laststeps_in_i <= done_reg_in_i;
        laststeps_in_i <= done_reg_in_i;
        start_first_stage_i <= start_i or steps_in_i;
        start_first_stage_i <= start_i or steps_in_i;
        --start_first_stage_i <= steps_in_i;
        --start_first_stage_i <= steps_in_i;
 
 
        done_reg: d_flip_flop
        done_reg: d_flip_flop
   port map(core_clk => core_clk,
  port map(
 
    core_clk => core_clk,
                          reset => reset,
                          reset => reset,
                            din => done_reg_in_i,
                            din => done_reg_in_i,
                      dout => done_reg_out_i
                      dout => done_reg_out_i
        );
        );
 
 
        start_stop_reg: d_flip_flop
        start_stop_reg: d_flip_flop
   port map(core_clk => core_clk,
  port map(
 
    core_clk => core_clk,
                          reset => reset,
                          reset => reset,
                            din => start_stop_in_i,
                            din => start_stop_in_i,
                      dout => start_stop_out_i
                      dout => start_stop_out_i
        );
        );
 
 
        -- for counting the last steps
        -- for counting the last steps
        laststeps_counter: counter_sync
        laststeps_counter: counter_sync
        generic map(max_value => t
  generic map(
 
    max_value => t
        )
        )
   port map(reset_value => t_sel,
  port map(
 
    reset_value => t_sel,
                        core_clk => core_clk,
                        core_clk => core_clk,
                             ce => laststeps_in_i,
                             ce => laststeps_in_i,
                          reset => reset,
                          reset => reset,
                  overflow => laststeps_out_i
                  overflow => laststeps_out_i
        );
        );
 
 
        -- counter for keeping track of the steps
        -- counter for keeping track of the steps
        steps_counter: counter_sync
        steps_counter: counter_sync
        generic map(max_value => n
  generic map(
 
    max_value => n
        )
        )
   port map(reset_value => (n_sel),
  port map(
 
    reset_value => (n_sel),
                        core_clk => core_clk,
                        core_clk => core_clk,
                             ce => steps_in_i,
                             ce => steps_in_i,
                          reset => reset,
                          reset => reset,
                  overflow => steps_out_i
                  overflow => steps_out_i
        );
        );
 
 
        -- makes sure we don't start too early with a new step
        -- makes sure we don't start too early with a new step
        substeps_counter: counter_sync
        substeps_counter: counter_sync
        generic map(max_value => 2
  generic map(
 
    max_value => 2
        )
        )
   port map(reset_value => 2,
  port map(
 
    reset_value => 2,
                        core_clk => core_clk,
                        core_clk => core_clk,
                             ce => substeps_in_i,
                             ce => substeps_in_i,
                          reset => reset,
                          reset => reset,
                  overflow => substeps_out_i
                  overflow => substeps_out_i
        );
        );

powered by: WebSVN 2.1.0

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