OpenCores
URL https://opencores.org/ocsvn/mod_sim_exp/mod_sim_exp/trunk

Subversion Repositories mod_sim_exp

[/] [mod_sim_exp/] [tags/] [start_version/] [rtl/] [vhdl/] [core/] [operand_mem.vhd] - Blame information for rev 53

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 JonasDC
------------------------------------------------------------------------------------ 
2
--                      
3
-- Geoffrey Ottoy - DraMCo research group
4
--
5
-- Module Name: operand_mem.vhd / entity operand_mem
6
-- 
7
-- Last Modified:       18/06/2012 
8
-- 
9
-- Description:         BRAM memory and logic to the store 4 (1536-bit) operands and the
10
--                modulus for the montgomery multiplier
11
--
12
--
13
-- Dependencies:        modulus_ram, operand_ram
14
--
15
-- Revision:
16
-- Revision 2.00 - Removed y_register -> seperate module
17
-- Revision 1.01 - Added "result_dest_op" input
18
--      Revision 1.00 - Architecture
19
--      Revision 0.01 - File Created
20
--
21
--
22
------------------------------------------------------------------------------------
23
--
24
-- NOTICE:
25
--
26
-- Copyright DraMCo research group. 2011. This code may be contain portions patented
27
-- by other third parties!
28
--
29
------------------------------------------------------------------------------------
30
library IEEE;
31
use IEEE.STD_LOGIC_1164.ALL;
32
use IEEE.STD_LOGIC_ARITH.ALL;
33
use IEEE.STD_LOGIC_UNSIGNED.ALL;
34
 
35
---- Uncomment the following library declaration if instantiating
36
---- any Xilinx primitives in this code.
37
--library UNISIM;
38
--use UNISIM.VComponents.all;
39
 
40
entity operand_mem is
41
        generic(n : integer := 1536
42
        );
43
   port(-- data interface (plb side)
44
                  data_in : in  std_logic_vector(31 downto 0);
45
                  data_out : out  std_logic_vector(31 downto 0);
46
                  rw_address : in  std_logic_vector(8 downto 0);
47
                  -- address structure:
48
                  -- bit:  8   -> '1': modulus
49
                  --              '0': operands
50
                  -- bits: 7-6 -> operand_in_sel in case of bit 8 = '0'
51
                  --              don't care in case of modulus
52
                  -- bits: 5-0 -> modulus_addr / operand_addr resp.
53
 
54
                  -- operand interface (multiplier side)
55
                  op_sel : in  std_logic_vector(1 downto 0);
56
                  xy_out : out  std_logic_vector(1535 downto 0);
57
                  m : out  std_logic_vector(1535 downto 0);
58
                  result_in : in std_logic_vector(1535 downto 0);
59
                  -- control signals
60
                  load_op : in std_logic;
61
                  load_m : in std_logic;
62
                  load_result : in std_logic;
63
                  result_dest_op : in std_logic_vector(1 downto 0);
64
                  collision : out std_logic;
65
                  -- system clock
66
                  clk : in  std_logic
67
        );
68
end operand_mem;
69
 
70
architecture Behavioral of operand_mem is
71
        -- single port (32-bit -> 1536-bit) block ram
72
        component modulus_ram
73
        port(
74
                clk : in std_logic;
75
                modulus_addr : in std_logic_vector(5 downto 0);
76
                write_modulus : in std_logic;
77
                modulus_in : in std_logic_vector(31 downto 0);
78
                modulus_out : out std_logic_vector(1535 downto 0)
79
        );
80
        end component;
81
 
82
        -- dual port block ram
83
        component operand_ram
84
        port(
85
                clk : in std_logic;
86
                operand_addr : in std_logic_vector(5 downto 0);
87
                operand_in : in std_logic_vector(31 downto 0);
88
                operand_in_sel : in std_logic_vector(1 downto 0);
89
                write_operand : in std_logic;
90
                operand_out_sel : in std_logic_vector(1 downto 0);
91
                result_dest_op : in std_logic_vector(1 downto 0);
92
                write_result : in std_logic;
93
                result_in : in std_logic_vector(1535 downto 0);
94
                collision : out std_logic;
95
                result_out : out std_logic_vector(31 downto 0);
96
                operand_out : out std_logic_vector(1535 downto 0)
97
                );
98
        end component;
99
 
100
        signal xy_data_i : std_logic_vector(31 downto 0);
101
        signal xy_addr_i : std_logic_vector(5 downto 0);
102
        signal operand_in_sel_i : std_logic_vector(1 downto 0);
103
        signal collision_i : std_logic;
104
 
105
        signal xy_op_i : std_logic_vector(1535 downto 0);
106
 
107
        signal m_addr_i : std_logic_vector(5 downto 0);
108
        signal write_m_i : std_logic;
109
        signal m_data_i : std_logic_vector(31 downto 0);
110
begin
111
 
112
        -- map outputs
113
        xy_out <= xy_op_i;
114
        collision <= collision_i;
115
 
116
        -- map inputs
117
        xy_addr_i <= rw_address(5 downto 0);
118
        m_addr_i <= rw_address(5 downto 0);
119
        operand_in_sel_i <= rw_address(7 downto 6);
120
        xy_data_i <= data_in;
121
        m_data_i <= data_in;
122
        write_m_i <= load_m;
123
 
124
        -- xy operand storage
125
        xy_ram: operand_ram port map(
126
                clk => clk,
127
                collision => collision_i,
128
                operand_addr => xy_addr_i,
129
                operand_in => xy_data_i,
130
                operand_in_sel => operand_in_sel_i,
131
                result_out => data_out,
132
                write_operand => load_op,
133
                operand_out => xy_op_i,
134
                operand_out_sel => op_sel,
135
                result_dest_op => result_dest_op,
136
                write_result => load_result,
137
                result_in => result_in
138
        );
139
 
140
        -- modulus storage
141
        m_ram : modulus_ram
142
        port map(
143
                clk => clk,
144
                modulus_addr => m_addr_i,
145
                write_modulus => write_m_i,
146
                modulus_in => m_data_i,
147
                modulus_out => m
148
        );
149
 
150
end Behavioral;
151
 

powered by: WebSVN 2.1.0

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