----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
---- register_n ----
|
---- register_n ----
|
---- ----
|
---- ----
|
---- This file is part of the ----
|
---- This file is part of the ----
|
---- Modular Simultaneous Exponentiation Core project ----
|
---- Modular Simultaneous Exponentiation Core project ----
|
---- http://www.opencores.org/cores/mod_sim_exp/ ----
|
---- http://www.opencores.org/cores/mod_sim_exp/ ----
|
---- ----
|
---- ----
|
---- Description ----
|
---- Description ----
|
---- n bit register ----
|
---- n bit register with active high asynchronious reset and ce----
|
---- used in montgommery multiplier systolic array stages ----
|
---- used in montgommery multiplier systolic array stages ----
|
---- ----
|
---- ----
|
---- Dependencies: none ----
|
---- Dependencies: none ----
|
---- ----
|
---- ----
|
---- Authors: ----
|
---- Authors: ----
|
---- - Geoffrey Ottoy, DraMCo research group ----
|
---- - Geoffrey Ottoy, DraMCo research group ----
|
---- - Jonas De Craene, JonasDC@opencores.org ----
|
---- - Jonas De Craene, JonasDC@opencores.org ----
|
---- ----
|
---- ----
|
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
---- ----
|
---- ----
|
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG ----
|
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG ----
|
---- ----
|
---- ----
|
---- This source file may be used and distributed without ----
|
---- This source file may be used and distributed without ----
|
---- restriction provided that this copyright statement is not ----
|
---- restriction provided that this copyright statement is not ----
|
---- removed from the file and that any derivative work contains ----
|
---- removed from the file and that any derivative work contains ----
|
---- the original copyright notice and the associated disclaimer. ----
|
---- the original copyright notice and the associated disclaimer. ----
|
---- ----
|
---- ----
|
---- This source file is free software; you can redistribute it ----
|
---- This source file is free software; you can redistribute it ----
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
---- Public License as published by the Free Software Foundation; ----
|
---- Public License as published by the Free Software Foundation; ----
|
---- either version 2.1 of the License, or (at your option) any ----
|
---- either version 2.1 of the License, or (at your option) any ----
|
---- later version. ----
|
---- later version. ----
|
---- ----
|
---- ----
|
---- This source is distributed in the hope that it will be ----
|
---- This source is distributed in the hope that it will be ----
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
---- details. ----
|
---- details. ----
|
---- ----
|
---- ----
|
---- You should have received a copy of the GNU Lesser General ----
|
---- You should have received a copy of the GNU Lesser General ----
|
---- Public License along with this source; if not, download it ----
|
---- Public License along with this source; if not, download it ----
|
---- from http://www.opencores.org/lgpl.shtml ----
|
---- from http://www.opencores.org/lgpl.shtml ----
|
---- ----
|
---- ----
|
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
|
|
-- Xilinx primitives used
|
-- n-bit register with asynchronous reset and clock enable
|
library UNISIM;
|
|
use UNISIM.VComponents.all;
|
|
|
|
|
|
entity register_n is
|
entity register_n is
|
generic(
|
generic(
|
n : integer := 4
|
n : integer := 4
|
);
|
);
|
port(
|
port(
|
core_clk : in std_logic;
|
core_clk : in std_logic; -- clock input
|
ce : in std_logic;
|
ce : in std_logic; -- clock enable (active high)
|
reset : in std_logic;
|
reset : in std_logic; -- reset (active high)
|
din : in std_logic_vector((n-1) downto 0);
|
din : in std_logic_vector((n-1) downto 0); -- data in (n-bit)
|
dout : out std_logic_vector((n-1) downto 0)
|
dout : out std_logic_vector((n-1) downto 0) -- data out (n-bit)
|
);
|
);
|
end register_n;
|
end register_n;
|
|
|
|
|
architecture Structural of register_n is
|
architecture Behavorial of register_n is
|
signal dout_i : std_logic_vector((n-1) downto 0) := (others => '0');
|
|
begin
|
begin
|
|
-- process for n-bit register
|
|
reg_nb : process (reset, ce, core_clk, din)
|
|
begin
|
|
if reset='1' then -- asynchronous active high reset
|
|
dout <= (others=>'0');
|
|
else
|
|
if rising_edge(core_clk) then -- clock in data on rising edge
|
|
if ce='1' then -- active high clock enable to clock in data
|
|
dout <= din;
|
|
end if;
|
|
end if;
|
|
end if;
|
|
end process;
|
|
|
dout <= dout_i;
|
end Behavorial;
|
|
|
N_REGS : for i in 0 to n-1 generate
|
|
FDCE_inst : FDCE
|
|
generic map (
|
|
INIT => '0' -- Initial value of latch ('0' or '1')
|
|
)
|
|
port map (
|
|
Q => dout_i(i), -- Data output
|
|
CLR => reset, -- Asynchronous clear/reset input
|
|
D => din(i), -- Data input
|
|
C => core_clk, -- Gate input
|
|
CE => ce -- Gate enable input
|
|
);
|
|
end generate;
|
|
|
|
end Structural;
|
|
|
|
No newline at end of file
|
No newline at end of file
|