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 73

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 72 gedra
-- Revision 1.3  2004/06/26 14:14:47  gedra
52
-- Converted to numeric_std and fixed a few bugs.
53
--
54 37 gedra
-- Revision 1.2  2004/06/10 18:57:36  gedra
55
-- Cleaned up lint warnings.
56
--
57 17 gedra
-- Revision 1.1  2004/06/09 19:24:31  gedra
58
-- Generic dual port ram model.
59 15 gedra
--
60 17 gedra
--
61 15 gedra
 
62 17 gedra
library ieee;
63 72 gedra
use ieee.std_logic_1164.all;
64 37 gedra
use ieee.numeric_std.all;
65 15 gedra
 
66
entity dpram is
67 72 gedra
   generic (DATA_WIDTH : positive;
68
            RAM_WIDTH  : positive);
69
   port (
70
      clk     : in  std_logic;
71
      rst     : in  std_logic;          -- reset is optional, not used here
72
      din     : in  std_logic_vector(DATA_WIDTH - 1 downto 0);
73
      wr_en   : in  std_logic;
74
      rd_en   : in  std_logic;
75
      wr_addr : in  std_logic_vector(RAM_WIDTH - 1 downto 0);
76
      rd_addr : in  std_logic_vector(RAM_WIDTH - 1 downto 0);
77
      dout    : out std_logic_vector(DATA_WIDTH - 1 downto 0));
78
end dpram;
79 15 gedra
 
80
--library synplify; -- uncomment this line when using Synplify       
81
architecture rtl of dpram is
82
 
83 72 gedra
   type memory_type is array (2**RAM_WIDTH - 1 downto 0) of
84
      std_logic_vector(DATA_WIDTH - 1 downto 0);
85
   signal memory   : memory_type;
86
   signal lrd_addr : std_logic_vector(RAM_WIDTH - 1 downto 0);
87 15 gedra
-- Enable syn_ramstyle attribute when using Xilinx to enable block ram
88
-- otherwise you get embedded CLB ram.
89
-- attribute syn_ramstyle : string;
90
-- attribute syn_ramstyle of memory : signal is "block_ram";
91
 
92
begin
93 72 gedra
   -- Generic ram, good synthesis programs will make block ram out of it...
94
   process(clk)
95
   begin
96
      if rising_edge(clk) then
97
         if wr_en = '1' then
98
            memory(to_integer(unsigned(wr_addr))) <= din;
99
         end if;
100 15 gedra
      end if;
101 72 gedra
   end process;
102
 
103
   process(clk)
104
   begin
105
      if rising_edge(clk) then
106
         if rd_en = '1' then
107
            dout <= memory(to_integer(unsigned(rd_addr)));
108
         end if;
109 15 gedra
      end if;
110 72 gedra
   end process;
111
 
112
end rtl;
113 15 gedra
 

powered by: WebSVN 2.1.0

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