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

Subversion Repositories rtf68ksys

[/] [rtf68ksys/] [trunk/] [rtl/] [verilog/] [rtfSpriteRam.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 robfinch
// ============================================================================
2
//  Sprite RAM
3
//
4
//      (C) 2005,2011  Robert Finch
5
//      robfinch<remove>@opencores.org
6
//
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file is distributed in the hope that it will be useful,      
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//                                                                          
21
// ============================================================================
22
 
23
//`define VENDOR_ANY
24
`define VENDOR_XILINX
25
`define SPARTAN3
26
 
27
module rtfSpriteRam(
28
clka, adra, dia, doa, cea, wea, rsta,
29
clkb, adrb, dib, dob, ceb, web, rstb);
30
parameter pAw = 10;
31
parameter pDw = 16;
32
input clka;
33
input [pAw:1] adra;
34
input [pDw:1] dia;
35
output [pDw:1] doa;
36
input cea;                              // clock enable a
37
input wea;
38
input rsta;
39
input clkb;
40
input [pAw:1] adrb;
41
input [pDw:1] dib;
42
output [pDw:1] dob;
43
input ceb;                              // clock enable b
44
input web;
45
input rstb;
46
 
47
`ifdef VENDOR_XILINX
48
 
49
`ifdef SPARTAN3
50
        // could use an S16_S32
51
        RAMB16_S18_S18 ram0(
52
                .CLKA(clka), .ADDRA(adra), .DIA(dia), .DIPA(2'b11), .DOA(doa), .ENA(cea), .WEA(wea), .SSRA(rsta),
53
                .CLKB(clkb), .ADDRB(adrb), .DIB(dib), .DIPB(2'b11), .DOB(dob), .ENB(ceb), .WEB(web), .SSRB(rstb)  );
54
`else
55
        // could use an S8_S16
56
        RAMB4_S8_S8 ram0(
57
                .CLKA(clka), .ADDRA(adra), .DIA(dia), .DOA(doa), .ENA(cea), .WEA(wea), .RSTA(rsta),
58
                .CLKB(clkb), .ADDRB(adrb), .DIB(dib), .DOB(dob), .ENB(ceb), .WEB(web), .RSTB(rstb)  );
59
`endif
60
`endif
61
 
62
`ifdef VENDOR_ALTERA
63
`endif
64
 
65
`ifdef VENDOR_ANY
66
 
67
reg [15:0] mem [(1<<pAw):1];
68
reg [pAw:1] radra;
69
reg [pAw:1] radrb;
70
 
71
// register read addresses
72
always @(posedge clka)
73
        if (cea)
74
                radra <= adra;
75
 
76
always @(posedge clkb)
77
        if (ceb)
78
                if (web)
79
                        mem[adrb] <= dib;
80
 
81
assign doa = mem[radra];
82
 
83
`endif
84
 
85
endmodule

powered by: WebSVN 2.1.0

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