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

Subversion Repositories spdif_interface

[/] [spdif_interface/] [trunk/] [rtl/] [vhdl/] [dpram_altera.vhd] - Blame information for rev 28

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

Line No. Rev Author Line
1 27 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 version is specific for Altera FPGA's,   ----
10
---- and uses Altera library to instantiate block ram.            ----
11
----                                                              ----
12
----                                                              ----
13
---- To Do:                                                       ----
14
---- -                                                            ----
15
----                                                              ----
16
---- Author(s):                                                   ----
17
---- - Geir Drange, gedra@opencores.org                           ----
18
----                                                              ----
19
----------------------------------------------------------------------
20
----                                                              ----
21
---- Copyright (C) 2004 Authors 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
-- CVS Revision History
47
--
48 28 gedra
-- $Log: not supported by cvs2svn $
49
-- Revision 1.1  2004/06/18 18:40:04  gedra
50
-- Alternate dual port memory implementation for Altera FPGA's.
51
-- 
52 27 gedra
--
53
 
54
library ieee;
55
use ieee.std_logic_1164.all;
56 28 gedra
--use ieee.std_logic_unsigned.all;
57
library lpm;
58
use lpm.lpm_components.all;
59 27 gedra
 
60
entity dpram is
61
  generic (DATA_WIDTH: positive;
62
           RAM_WIDTH: positive);
63
  port (
64
    clk: in std_logic;
65
    rst: in std_logic; -- reset is optional, not used here
66
    din: in std_logic_vector(DATA_WIDTH - 1 downto 0);
67
    wr_en: in std_logic;
68
    rd_en: in std_logic;
69
    wr_addr: in std_logic_vector(RAM_WIDTH - 1 downto 0);
70
    rd_addr: in std_logic_vector(RAM_WIDTH - 1 downto 0);
71
    dout: out std_logic_vector(DATA_WIDTH - 1 downto 0));
72
end dpram;
73
 
74 28 gedra
architecture altera of dpram is
75 27 gedra
 
76
component lpm_ram_dp
77
  generic ( LPM_WIDTH: positive;
78
            LPM_WIDTHAD: positive;
79
            LPM_NUMWORDS: natural := 0;
80
            LPM_INDATA: string := "REGISTERED";
81
            LPM_OUTDATA: string := "REGISTERED";
82
            LPM_RDADDRESS_CONTROL: string := "REGISTERED";
83
            LPM_WRADDRESS_CONTROL: string := "REGISTERED";
84
            LPM_FILE: string := "UNUSED";
85
            LPM_TYPE: string := "LPM_RAM_DP";
86
            LPM_HINT: string := "UNUSED");
87
  port ( data: in std_logic_vector(LPM_WIDTH-1 downto 0);
88
         rdaddress, wraddress: in std_logic_vector(LPM_WIDTHAD-1 downto 0);
89
         rdclock, wrclock: in std_logic := '0';
90
         rden, rdclken, wrclken: in std_logic := '1';
91
         wren: in std_logic;
92
         q: out std_logic_vector(LPM_WIDTH-1 downto 0));
93
end component;
94
 
95
signal one: std_logic;
96
 
97
begin
98
 
99
  one <= '1';
100
 
101 28 gedra
  ram: lpm_ram_dp
102 27 gedra
    generic map(LPM_WIDTH => DATA_WIDTH,
103
                LPM_WIDTHAD => RAM_WIDTH,
104
                LPM_NUMWORDS => 2**(RAM_WIDTH - 1))
105
    port map (data => din,
106
              rdaddress => rd_addr,
107
              wraddress => wr_addr,
108
              rdclock => clk,
109
              wrclock => clk,
110
              rden => rd_en,
111
              rdclken => one,
112
              wrclken => one,
113
              wren => wr_en,
114
              q => dout);
115
 
116 28 gedra
end altera;

powered by: WebSVN 2.1.0

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