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

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

Line No. Rev Author Line
1 59 JonasDC
----------------------------------------------------------------------  
2
----  dpram_generic                                               ---- 
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
----    behovorial description of a dual port ram with one 32-bit ----
10
----    write port and one 32-bit read port                       ----            
11
----                                                              ---- 
12
----  Dependencies: none                                          ----
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
 
45
library ieee;
46
use ieee.std_logic_1164.all;
47
use ieee.std_logic_unsigned.all;
48
 
49
library mod_sim_exp;
50
use mod_sim_exp.std_functions.all;
51
 
52
-- altera infers ramblocks from a depth of 9
53
-- xilinx infers ramblocks from a depth of 2
54
entity dpram_generic is
55
  generic (
56
    depth : integer := 2
57
  );
58
  port  (
59
    clk : in std_logic;
60
    -- write port
61
    waddr : in std_logic_vector(log2(depth)-1 downto 0);
62
    we    : in std_logic;
63
    din   : in std_logic_vector(31 downto 0);
64
    -- read port
65
    raddr : in std_logic_vector(log2(depth)-1 downto 0);
66
    dout  : out std_logic_vector(31 downto 0)
67
  );
68
end dpram_generic;
69
 
70
architecture behavorial of dpram_generic is
71
  -- the memory
72
  type ram_type is array (depth-1 downto 0) of std_logic_vector (31 downto 0);
73
  signal ram : ram_type;
74
 
75
  -- xilinx constraint to use blockram resources
76
  attribute ram_style : string;
77
  attribute ram_style of ram:signal is "block";
78
  -- altera constraint
79
  attribute ramstyle : string;
80
  attribute ramstyle of ram : signal is "M9K, no_rw_check";
81
begin
82
  process (clk)
83
  begin
84
    if (clk'event and clk = '1') then
85
      if (we = '1') then
86
        ram(conv_integer(waddr)) <= din;
87
      end if;
88
      dout <= ram(conv_integer(raddr));
89
    end if;
90
  end process;
91
end behavorial;
92
 

powered by: WebSVN 2.1.0

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