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 15

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
--
52
 
53
LIBRARY ieee;
54
USE ieee.std_logic_1164.ALL;
55
use ieee.std_logic_unsigned.all;
56
 
57
entity dpram is
58
  generic (DATA_WIDTH: positive;
59
           ADDR_WIDTH: positive);
60
  port (
61
    clk: in std_logic;
62
    rst: in std_logic; -- reset is optional, not used here
63
    din: in std_logic_vector(DATA_WIDTH - 1 downto 0);
64
    wr_en: in std_logic;
65
    rd_en: in std_logic;
66
    wr_addr: in std_logic_vector(ADDR_WIDTH - 1 downto 0);
67
    rd_addr: in std_logic_vector(ADDR_WIDTH - 1 downto 0);
68
    dout: out std_logic_vector(DATA_WIDTH - 1 downto 0));
69
end dpram;
70
 
71
--library synplify; -- uncomment this line when using Synplify       
72
architecture rtl of dpram is
73
 
74
  type memory_type is array (2**ADDR_WIDTH - 1 downto 0) of
75
    std_logic_vector(DATA_WIDTH - 1 downto 0);
76
  signal memory: memory_type;
77
  signal lrd_addr: std_logic_vector(ADDR_WIDTH - 1 downto 0);
78
-- Enable syn_ramstyle attribute when using Xilinx to enable block ram
79
-- otherwise you get embedded CLB ram.
80
-- attribute syn_ramstyle : string;
81
-- attribute syn_ramstyle of memory : signal is "block_ram";
82
 
83
begin
84
  -- Generic ram, good synthesis programs will make block ram out of it...
85
  process(clk)
86
  begin
87
    if rising_edge(clk) then
88
      if wr_en = '1' then
89
        memory(CONV_INTEGER(wr_addr)) <= din;
90
      end if;
91
    end if;
92
  end process;
93
 
94
  process(clk)
95
  begin
96
    if rising_edge(clk) then
97
      if rd_en = '1' then
98
        dout <= memory(CONV_INTEGER(rd_addr));
99
      end if;
100
    end if;
101
  end process;
102
 
103
end rtl;
104
 

powered by: WebSVN 2.1.0

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