Line 57... |
Line 57... |
|
|
-- toplevel of the modular simultaneous exponentiation core
|
-- toplevel of the modular simultaneous exponentiation core
|
-- contains an operand and modulus ram, multiplier, an exponent fifo
|
-- contains an operand and modulus ram, multiplier, an exponent fifo
|
-- and control logic
|
-- and control logic
|
entity mod_sim_exp_core is
|
entity mod_sim_exp_core is
|
|
generic(
|
|
C_NR_BITS_TOTAL : integer := 1536;
|
|
C_NR_STAGES_TOTAL : integer := 96;
|
|
C_NR_STAGES_LOW : integer := 32;
|
|
C_SPLIT_PIPELINE : boolean := true
|
|
);
|
port(
|
port(
|
clk : in std_logic;
|
clk : in std_logic;
|
reset : in std_logic;
|
reset : in std_logic;
|
-- operand memory interface (plb shared memory)
|
-- operand memory interface (plb shared memory)
|
write_enable : in std_logic; -- write data to operand ram
|
write_enable : in std_logic; -- write data to operand ram
|
Line 86... |
Line 92... |
end mod_sim_exp_core;
|
end mod_sim_exp_core;
|
|
|
|
|
architecture Structural of mod_sim_exp_core is
|
architecture Structural of mod_sim_exp_core is
|
-- data busses
|
-- data busses
|
signal xy : std_logic_vector(nr_bits_total-1 downto 0); -- x and y operand data bus RAM -> multiplier
|
signal xy : std_logic_vector(C_NR_BITS_TOTAL-1 downto 0); -- x and y operand data bus RAM -> multiplier
|
signal m : std_logic_vector(nr_bits_total-1 downto 0); -- modulus data bus RAM -> multiplier
|
signal m : std_logic_vector(C_NR_BITS_TOTAL-1 downto 0); -- modulus data bus RAM -> multiplier
|
signal r : std_logic_vector(nr_bits_total-1 downto 0); -- result data bus RAM <- multiplier
|
signal r : std_logic_vector(C_NR_BITS_TOTAL-1 downto 0); -- result data bus RAM <- multiplier
|
|
|
-- control signals
|
-- control signals
|
signal op_sel : std_logic_vector(1 downto 0); -- operand selection
|
signal op_sel : std_logic_vector(1 downto 0); -- operand selection
|
signal result_dest_op : std_logic_vector(1 downto 0); -- result destination operand
|
signal result_dest_op : std_logic_vector(1 downto 0); -- result destination operand
|
signal mult_ready : std_logic;
|
signal mult_ready : std_logic;
|
Line 108... |
Line 114... |
begin
|
begin
|
|
|
-- The actual multiplier
|
-- The actual multiplier
|
the_multiplier : mont_multiplier
|
the_multiplier : mont_multiplier
|
generic map(
|
generic map(
|
n => nr_bits_total,
|
n => C_NR_BITS_TOTAL,
|
t => nr_stages_total,
|
t => C_NR_STAGES_TOTAL,
|
tl => nr_stages_low,
|
tl => C_NR_STAGES_LOW,
|
split => split_pipeline
|
split => C_SPLIT_PIPELINE
|
)
|
)
|
port map(
|
port map(
|
core_clk => clk,
|
core_clk => clk,
|
xy => xy,
|
xy => xy,
|
m => m,
|
m => m,
|
Line 128... |
Line 134... |
);
|
);
|
|
|
-- Block ram memory for storing the operands and the modulus
|
-- Block ram memory for storing the operands and the modulus
|
the_memory : operand_mem
|
the_memory : operand_mem
|
generic map(
|
generic map(
|
n => nr_bits_total
|
n => C_NR_BITS_TOTAL
|
)
|
)
|
port map(
|
port map(
|
data_in => data_in,
|
data_in => data_in,
|
data_out => data_out,
|
data_out => data_out,
|
rw_address => rw_address,
|
rw_address => rw_address,
|