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/] [modulus_ram.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 JonasDC
----------------------------------------------------------------------  
2
----  modulus_ram                                                 ---- 
3
----                                                              ---- 
4
----  This file is part of the                                    ----
5
----    Modular Simultaneous Exponentiation Core project          ---- 
6
----    http://www.opencores.org/cores/mod_sim_exp/               ---- 
7
----                                                              ---- 
8
----  Description                                                 ---- 
9
----    BRAM memory and logic to store the 1536-bit modulus       ----
10
----                                                              ---- 
11
----  Dependencies:                                               ----
12
----    - operands_sp (coregen)                                   ----
13
----                                                              ----
14
----  Authors:                                                    ----
15
----      - Geoffrey Ottoy, DraMCo research group                 ----
16
----      - Jonas De Craene, JonasDC@opencores.org                ---- 
17
----                                                              ---- 
18
---------------------------------------------------------------------- 
19
----                                                              ---- 
20
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG   ---- 
21
----                                                              ---- 
22
---- This source file may be used and distributed without         ---- 
23
---- restriction provided that this copyright statement is not    ---- 
24
---- removed from the file and that any derivative work contains  ---- 
25
---- the original copyright notice and the associated disclaimer. ---- 
26
----                                                              ---- 
27
---- This source file is free software; you can redistribute it   ---- 
28
---- and/or modify it under the terms of the GNU Lesser General   ---- 
29
---- Public License as published by the Free Software Foundation; ---- 
30
---- either version 2.1 of the License, or (at your option) any   ---- 
31
---- later version.                                               ---- 
32
----                                                              ---- 
33
---- This source is distributed in the hope that it will be       ---- 
34
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ---- 
35
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ---- 
36
---- PURPOSE.  See the GNU Lesser General Public License for more ---- 
37
---- details.                                                     ---- 
38
----                                                              ---- 
39
---- You should have received a copy of the GNU Lesser General    ---- 
40
---- Public License along with this source; if not, download it   ---- 
41
---- from http://www.opencores.org/lgpl.shtml                     ---- 
42
----                                                              ---- 
43
----------------------------------------------------------------------
44 2 JonasDC
 
45 3 JonasDC
library ieee;
46
use ieee.std_logic_1164.all;
47
use ieee.std_logic_arith.all;
48
use ieee.std_logic_unsigned.all;
49 2 JonasDC
 
50 3 JonasDC
library mod_sim_exp;
51
use mod_sim_exp.mod_sim_exp_pkg.all;
52
 
53
 
54 2 JonasDC
entity modulus_ram is
55 3 JonasDC
  port(
56
    clk           : in std_logic;
57
    modulus_addr  : in std_logic_vector(5 downto 0);
58
    write_modulus : in std_logic;
59
    modulus_in    : in std_logic_vector(31 downto 0);
60
    modulus_out   : out std_logic_vector(1535 downto 0)
61
  );
62 2 JonasDC
end modulus_ram;
63
 
64 3 JonasDC
 
65 2 JonasDC
architecture Behavioral of modulus_ram is
66 3 JonasDC
  signal part_enable : std_logic_vector(3 downto 0);
67
  signal wea         : std_logic_vector(3 downto 0);
68
  signal addra       : std_logic_vector(4 downto 0);
69 2 JonasDC
begin
70
 
71
        -- the blockram has a write depth of 2 but we only use the lower half
72
        addra <= '0' & modulus_addr(3 downto 0);
73
 
74
        -- the two highest bits of the address are used to select the bloc
75
        with modulus_addr(5 downto 4) select
76 3 JonasDC
                part_enable <=  "0001" when "00",
77
                                "0010" when "01",
78
                                            "0100" when "10",
79
                                            "1000" when others;
80 2 JonasDC
 
81
        with write_modulus select
82
                wea <= part_enable when '1',
83
                       "0000" when others;
84
 
85
        -- 4 instances of 512 bits blockram
86 3 JonasDC
  modulus_0 : operands_sp
87
  port map (
88
    clka  => clk,
89
    wea   => wea(0 downto 0),
90
    addra => addra,
91
    dina  => modulus_in,
92
    douta => modulus_out(511 downto 0)
93
  );
94 2 JonasDC
 
95 3 JonasDC
  modulus_1 : operands_sp
96
  port map (
97
    clka  => clk,
98
    wea   => wea(1 downto 1),
99
    addra => addra,
100
    dina  => modulus_in,
101
    douta => modulus_out(1023 downto 512)
102
  );
103
 
104
  modulus_2 : operands_sp
105
  port map (
106
    clka  => clk,
107
    wea   => wea(2 downto 2),
108
    addra => addra,
109
    dina  => modulus_in,
110
    douta => modulus_out(1535 downto 1024)
111
  );
112
 
113 2 JonasDC
end Behavioral;

powered by: WebSVN 2.1.0

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