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/] [operand_ram.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...
------------------------------------------------------------------------------------ 
----------------------------------------------------------------------  
--                      
----  operand_ram                                                 ---- 
-- Geoffrey Ottoy - DraMCo research group
----                                                              ---- 
--
----  This file is part of the                                    ----
-- Module Name: operand_mem.vhd / entity operand_mem
----    Modular Simultaneous Exponentiation Core project          ---- 
-- 
----    http://www.opencores.org/cores/mod_sim_exp/               ---- 
-- Last Modified:       25/04/2012 
----                                                              ---- 
-- 
----  Description                                                 ---- 
-- Description:         BRAM memory and logic to the store 4 (1536-bit) operands and the
----    BRAM memory and logic to the store 4 (1536-bit) operands  ----
--                modulus for the montgomery multiplier
----    for the montgomery multiplier                             ----            
--
----                                                              ---- 
--
----  Dependencies:                                               ----
-- Dependencies: operand_dp (coregen)
----    - operand_dp (coregen)                                    ----
--
----                                                              ----
-- Revision: 
----  Authors:                                                    ----
-- Revision 1.01 - added "result_dest_op" input
----      - Geoffrey Ottoy, DraMCo research group                 ----
-- Revision 1.00 - Architecture
----      - Jonas De Craene, JonasDC@opencores.org                ---- 
-- Revision 0.01 - File Created
----                                                              ---- 
-- Additional Comments: 
---------------------------------------------------------------------- 
--
----                                                              ---- 
--
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG   ---- 
------------------------------------------------------------------------------------
----                                                              ---- 
--
---- This source file may be used and distributed without         ---- 
-- NOTICE:
---- restriction provided that this copyright statement is not    ---- 
--
---- removed from the file and that any derivative work contains  ---- 
-- Copyright DraMCo research group. 2011. This code may be contain portions patented
---- the original copyright notice and the associated disclaimer. ---- 
-- by other third parties!
----                                                              ---- 
--
---- This source file is free software; you can redistribute it   ---- 
------------------------------------------------------------------------------------
---- and/or modify it under the terms of the GNU Lesser General   ---- 
library IEEE;
---- Public License as published by the Free Software Foundation; ---- 
use IEEE.STD_LOGIC_1164.ALL;
---- either version 2.1 of the License, or (at your option) any   ---- 
use IEEE.STD_LOGIC_ARITH.ALL;
---- later version.                                               ---- 
use IEEE.STD_LOGIC_UNSIGNED.ALL;
----                                                              ---- 
 
---- This source is distributed in the hope that it will be       ---- 
---- Uncomment the following library declaration if instantiating
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ---- 
---- any Xilinx primitives in this code.
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ---- 
--library UNISIM;
---- PURPOSE.  See the GNU Lesser General Public License for more ---- 
--use UNISIM.VComponents.all;
---- 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 operand_ram is
entity operand_ram is
        port( -- write_operand_ack voorzien?
        port( -- write_operand_ack voorzien?
                -- global ports
                -- global ports
                clk : in std_logic;
                clk : in std_logic;
Line 46... Line 61...
                operand_addr : in std_logic_vector(5 downto 0);
                operand_addr : in std_logic_vector(5 downto 0);
                operand_in : in std_logic_vector(31 downto 0);
                operand_in : in std_logic_vector(31 downto 0);
                operand_in_sel : in std_logic_vector(1 downto 0);
                operand_in_sel : in std_logic_vector(1 downto 0);
                result_out : out std_logic_vector(31 downto 0);
                result_out : out std_logic_vector(31 downto 0);
                write_operand : in std_logic;
                write_operand : in std_logic;
                -- multiplier side connections (+1024 bit parallel)
    -- multiplier side connections (1536 bit parallel)
                result_dest_op : in std_logic_vector(1 downto 0);
                result_dest_op : in std_logic_vector(1 downto 0);
                operand_out : out std_logic_vector(1535 downto 0);
                operand_out : out std_logic_vector(1535 downto 0);
                operand_out_sel : in std_logic_vector(1 downto 0); -- controlled by bus side :)
    operand_out_sel : in std_logic_vector(1 downto 0); -- controlled by bus side
                write_result : in std_logic;
                write_result : in std_logic;
                result_in : in std_logic_vector(1535 downto 0)
                result_in : in std_logic_vector(1535 downto 0)
        );
        );
end operand_ram;
end operand_ram;
 
 
architecture Behavioral of operand_ram is
 
        -- dual port blockram to store and update operands
 
        component operand_dp
 
                port (
 
                clka: in std_logic;
 
                wea: in std_logic_vector(0 downto 0);
 
                addra: in std_logic_vector(5 downto 0);
 
                dina: in std_logic_vector(31 downto 0);
 
                douta: out std_logic_vector(511 downto 0);
 
                clkb: in std_logic;
 
                web: IN std_logic_VECTOR(0 downto 0);
 
                addrb: IN std_logic_VECTOR(5 downto 0);
 
                dinb: IN std_logic_VECTOR(511 downto 0);
 
                doutb: OUT std_logic_VECTOR(31 downto 0));
 
        end component;
 
 
 
 
architecture Behavioral of operand_ram is
        -- port a signals
        -- port a signals
        signal addra : std_logic_vector(5 downto 0);
        signal addra : std_logic_vector(5 downto 0);
        signal part_enable : std_logic_vector(3 downto 0);
        signal part_enable : std_logic_vector(3 downto 0);
        signal wea : std_logic_vector(3 downto 0);
        signal wea : std_logic_vector(3 downto 0);
        signal write_operand_i : std_logic;
        signal write_operand_i : std_logic;
Line 86... Line 87...
        signal doutb1 : std_logic_vector(31 downto 0);
        signal doutb1 : std_logic_vector(31 downto 0);
        signal doutb2 : std_logic_vector(31 downto 0);
        signal doutb2 : std_logic_vector(31 downto 0);
        signal doutb3 : std_logic_vector(31 downto 0);
        signal doutb3 : std_logic_vector(31 downto 0);
 
 
begin
begin
 
 
        -- WARNING: Very Important!
        -- WARNING: Very Important!
        -- wea & web signals must never be high at the same time !!
        -- wea & web signals must never be high at the same time !!
        -- web has priority 
        -- web has priority 
        write_operand_i <= write_operand and not write_result;
        write_operand_i <= write_operand and not write_result;
        web(0) <= write_result;
        web(0) <= write_result;
Line 113... Line 115...
                       "0000" when others;
                       "0000" when others;
 
 
        -- we can only read back from the result (stored in result_dest_op)
        -- we can only read back from the result (stored in result_dest_op)
        addrb <= result_dest_op & operand_addr(3 downto 0);
        addrb <= result_dest_op & operand_addr(3 downto 0);
 
 
--      register_output_proc: process(clk)
 
--      begin
 
--              if rising_edge(clk) then
 
--                      case operand_addr(5 downto 4) is
 
--                              when "00" =>
 
--                                      result_out <= doutb0;
 
--                              when "01" =>
 
--                                      result_out <= doutb1;
 
--                              when "10" =>
 
--                                      result_out <= doutb2;
 
--                              when others =>
 
--                                      result_out <= doutb3;
 
--                      end case;
 
--              end if;
 
--      end process;
 
        with operand_addr(5 downto 4) select
        with operand_addr(5 downto 4) select
                result_out <= doutb0 when "00",
                result_out <= doutb0 when "00",
                              doutb1 when "01",
                              doutb1 when "01",
                                        doutb2 when "10",
                                        doutb2 when "10",
                                        doutb3 when others;
                                        doutb3 when others;
 
 
        -- 4 instances of a dual port ram to store the parts of the operand
        -- 3 instances of a dual port ram to store the parts of the operand
        op_0 : operand_dp
        op_0 : operand_dp
        port map (
        port map (
                clka => clk,
                clka => clk,
                wea => wea(0 downto 0),
                wea => wea(0 downto 0),
                addra => addra,
                addra => addra,
Line 177... Line 165...
                addrb => addrb,
                addrb => addrb,
                dinb => result_in(1535 downto 1024),
                dinb => result_in(1535 downto 1024),
                doutb => doutb2
                doutb => doutb2
        );
        );
 
 
--      op_3 : operand_dp
 
--      port map (
 
--              clka => clk,
 
--              wea => wea(3 downto 3),
 
--              addra => addra,
 
--              dina => operand_in,
 
--              douta => operand_out(2047 downto 1536),
 
--              clkb => clk,
 
--              web => web,
 
--              addrb => addrb,
 
--              dinb => result_in(2047 downto 1536),
 
--              doutb => doutb3
 
--      );
 
 
 
end Behavioral;
end Behavioral;
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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