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

Subversion Repositories spdif_interface

[/] [spdif_interface/] [trunk/] [rtl/] [vhdl/] [dpram_rtl.vhd] - Blame information for rev 37

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

Line No. Rev Author Line
1 15 gedra
----------------------------------------------------------------------
2
----                                                              ----
3
---- WISHBONE SPDIF IP Core                                       ----
4
----                                                              ----
5
---- This file is part of the SPDIF project                       ----
6
---- http://www.opencores.org/cores/spdif_interface/              ----
7
----                                                              ----
8
---- Description                                                  ----
9
---- Dual port ram. This is a RTL implementation. Some synthesis  ----
10
---- tools like Synplify will automatically instantiate FPGA      ----
11
---- block ram. Substitute with dpram_altera or dpram_xilinx for  ----
12
---- Altera or Xilinx implementations using their free SW.        ----
13
----                                                              ----
14
----                                                              ----
15
---- To Do:                                                       ----
16
---- -                                                            ----
17
----                                                              ----
18
---- Author(s):                                                   ----
19
---- - Geir Drange, gedra@opencores.org                           ----
20
----                                                              ----
21
----------------------------------------------------------------------
22
----                                                              ----
23
---- Copyright (C) 2004 Authors and OPENCORES.ORG                 ----
24
----                                                              ----
25
---- This source file may be used and distributed without         ----
26
---- restriction provided that this copyright statement is not    ----
27
---- removed from the file and that any derivative work contains  ----
28
---- the original copyright notice and the associated disclaimer. ----
29
----                                                              ----
30
---- This source file is free software; you can redistribute it   ----
31
---- and/or modify it under the terms of the GNU Lesser General   ----
32
---- Public License as published by the Free Software Foundation; ----
33
---- either version 2.1 of the License, or (at your option) any   ----
34
---- later version.                                               ----
35
----                                                              ----
36
---- This source is distributed in the hope that it will be       ----
37
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
38
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
39
---- PURPOSE. See the GNU Lesser General Public License for more  ----
40
---- details.                                                     ----
41
----                                                              ----
42
---- You should have received a copy of the GNU Lesser General    ----
43
---- Public License along with this source; if not, download it   ----
44
---- from http://www.opencores.org/lgpl.shtml                     ----
45
----                                                              ----
46
----------------------------------------------------------------------
47
--
48
-- CVS Revision History
49
--
50
-- $Log: not supported by cvs2svn $
51 37 gedra
-- Revision 1.2  2004/06/10 18:57:36  gedra
52
-- Cleaned up lint warnings.
53
--
54 17 gedra
-- Revision 1.1  2004/06/09 19:24:31  gedra
55
-- Generic dual port ram model.
56 15 gedra
--
57 17 gedra
--
58 15 gedra
 
59 17 gedra
library ieee;
60
use ieee.std_logic_1164.all;
61 37 gedra
use ieee.numeric_std.all;
62 15 gedra
 
63
entity dpram is
64
  generic (DATA_WIDTH: positive;
65 17 gedra
           RAM_WIDTH: positive);
66 15 gedra
  port (
67
    clk: in std_logic;
68
    rst: in std_logic; -- reset is optional, not used here
69
    din: in std_logic_vector(DATA_WIDTH - 1 downto 0);
70
    wr_en: in std_logic;
71
    rd_en: in std_logic;
72 17 gedra
    wr_addr: in std_logic_vector(RAM_WIDTH - 1 downto 0);
73
    rd_addr: in std_logic_vector(RAM_WIDTH - 1 downto 0);
74 15 gedra
    dout: out std_logic_vector(DATA_WIDTH - 1 downto 0));
75
end dpram;
76
 
77
--library synplify; -- uncomment this line when using Synplify       
78
architecture rtl of dpram is
79
 
80 17 gedra
  type memory_type is array (2**RAM_WIDTH - 1 downto 0) of
81 15 gedra
    std_logic_vector(DATA_WIDTH - 1 downto 0);
82
  signal memory: memory_type;
83 17 gedra
  signal lrd_addr: std_logic_vector(RAM_WIDTH - 1 downto 0);
84 15 gedra
-- Enable syn_ramstyle attribute when using Xilinx to enable block ram
85
-- otherwise you get embedded CLB ram.
86
-- attribute syn_ramstyle : string;
87
-- attribute syn_ramstyle of memory : signal is "block_ram";
88
 
89
begin
90
  -- Generic ram, good synthesis programs will make block ram out of it...
91
  process(clk)
92
  begin
93
    if rising_edge(clk) then
94
      if wr_en = '1' then
95 37 gedra
        memory(to_integer(unsigned(wr_addr))) <= din;
96 15 gedra
      end if;
97
    end if;
98
  end process;
99
 
100
  process(clk)
101
  begin
102
    if rising_edge(clk) then
103
      if rd_en = '1' then
104 37 gedra
        dout <= memory(to_integer(unsigned(rd_addr)));
105 15 gedra
      end if;
106
    end if;
107
  end process;
108
 
109
end rtl;
110
 

powered by: WebSVN 2.1.0

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