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

Subversion Repositories mod_sim_exp

[/] [mod_sim_exp/] [trunk/] [rtl/] [vhdl/] [ram/] [dpramblock_asym.vhd] - Blame information for rev 77

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

Line No. Rev Author Line
1 66 JonasDC
----------------------------------------------------------------------  
2
----  dpramblock_asym                                             ---- 
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
----    structural description of an asymmetric dual port ram     ----
10
----    with one 32-bit write port and one (width)-bit read       ----
11
----    port.                                                     ----            
12
----                                                              ---- 
13
----  Dependencies: dpram_asym                                    ----
14
----                                                              ----
15
----  Authors:                                                    ----
16
----      - Geoffrey Ottoy, DraMCo research group                 ----
17
----      - Jonas De Craene, JonasDC@opencores.org                ---- 
18
----                                                              ---- 
19
---------------------------------------------------------------------- 
20
----                                                              ---- 
21
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG   ---- 
22
----                                                              ---- 
23
---- This source file may be used and distributed without         ---- 
24
---- restriction provided that this copyright statement is not    ---- 
25
---- removed from the file and that any derivative work contains  ---- 
26
---- the original copyright notice and the associated disclaimer. ---- 
27
----                                                              ---- 
28
---- This source file is free software; you can redistribute it   ---- 
29
---- and/or modify it under the terms of the GNU Lesser General   ---- 
30
---- Public License as published by the Free Software Foundation; ---- 
31
---- either version 2.1 of the License, or (at your option) any   ---- 
32
---- later version.                                               ---- 
33
----                                                              ---- 
34
---- This source is distributed in the hope that it will be       ---- 
35
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ---- 
36
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ---- 
37
---- PURPOSE.  See the GNU Lesser General Public License for more ---- 
38
---- details.                                                     ---- 
39
----                                                              ---- 
40
---- You should have received a copy of the GNU Lesser General    ---- 
41
---- Public License along with this source; if not, download it   ---- 
42
---- from http://www.opencores.org/lgpl.shtml                     ---- 
43
----                                                              ---- 
44
----------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48
use ieee.std_logic_unsigned.all;
49
use ieee.std_logic_arith.all;
50
 
51
library mod_sim_exp;
52
use mod_sim_exp.std_functions.all;
53
 
54
-- altera infers ramblocks from a depth of 9 (or 2 with any ram size recognition option on) 
55
--              and width 64,128,256,512,1024
56
-- xilinx infers ramblocks from a depth of 2 and width 32,64,128,256,512,1024
57
entity dpramblock_asym is
58
  generic (
59
    width  : integer := 256;  -- read width
60
    depth  : integer := 2;    -- nr of (width)-bit words
61
    device : string  := "xilinx"
62
  );
63
  port (
64
    clk : in std_logic;
65
    -- write port
66
    waddr : in std_logic_vector(log2((width*depth)/32)-1 downto 0);
67
    we    : in std_logic;
68
    din   : in std_logic_vector(31 downto 0);
69
    -- read port
70
    raddr : in std_logic_vector(log2(depth)-1 downto 0);
71
    dout  : out std_logic_vector(width-1 downto 0)
72
  );
73
end dpramblock_asym;
74
 
75
architecture structural of dpramblock_asym is
76
  -- constants
77
  constant nrRAMs       : integer := width/32;
78
  constant RAMwrwidth   : integer := 32/nrRAMs;
79
 
80
  -- interconnection signals
81
  type word_array is array (nrRAMs-1 downto 0) of std_logic_vector(31 downto 0);
82
  signal dout_RAM : word_array;
83
begin
84
  -- generate (width/32) blocks of 32-bit ram with a given depth
85
  -- these rams outputs are concatenated to a width-bit signal
86
  ramblocks : for i in 0 to nrRAMs-1 generate
87
    ramblock: entity mod_sim_exp.dpram_asym
88
    generic map(
89
      rddepth => depth,
90
      wrwidth => RAMwrwidth,
91
      device  => device
92
    )
93
    port map(
94
      clk => clk,
95
      -- write port
96
      waddr => waddr,
97
      we    => we,
98
      din   => din((i+1)*RAMwrwidth-1 downto RAMwrwidth*i),
99
      -- read port
100
      raddr => raddr,
101
      dout  => dout_RAM(i)
102
    );
103
 
104
    map_output : for j in 0 to nrRAMs-1 generate
105
      dout(j*32+(i+1)*RAMwrwidth-1 downto j*32+i*RAMwrwidth)
106
          <= dout_RAM(i)((j+1)*RAMwrwidth-1 downto j*RAMwrwidth);
107
    end generate;
108
  end generate;
109
end structural;

powered by: WebSVN 2.1.0

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