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

Subversion Repositories pipelined_fft_64

[/] [pipelined_fft_64/] [trunk/] [RTL/] [ram2x64c_1.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 unicore
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  2-port RAM                                                 ////
4
////                                                             ////
5
////  Authors: Anatoliy Sergienko, Volodya Lepeha                ////
6
////  Company: Unicore Systems http://unicore.co.ua              ////
7
////                                                             ////
8
////  Downloaded from: http://www.opencores.org                  ////
9
////                                                             ////
10
/////////////////////////////////////////////////////////////////////
11
////                                                             ////
12
//// Copyright (C) 2006-2010 Unicore Systems LTD                 ////
13
//// www.unicore.co.ua                                           ////
14
//// o.uzenkov@unicore.co.ua                                     ////
15
////                                                             ////
16
//// This source file may be used and distributed without        ////
17
//// restriction provided that this copyright statement is not   ////
18
//// removed from the file and that any derivative work contains ////
19
//// the original copyright notice and the associated disclaimer.////
20
////                                                             ////
21
//// THIS SOFTWARE IS PROVIDED "AS IS"                           ////
22
//// AND ANY EXPRESSED OR IMPLIED WARRANTIES,                    ////
23
//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED                  ////
24
//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT              ////
25
//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.        ////
26
//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS                ////
27
//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,            ////
28
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL            ////
29
//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT         ////
30
//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,               ////
31
//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                 ////
32
//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,              ////
33
//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT              ////
34
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING                 ////
35
//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,                 ////
36
//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.          ////
37
////                                                             ////
38
/////////////////////////////////////////////////////////////////////
39
// Design_Version       : 1.0
40
// File name            : RAM2x64C_1.v
41
// File Revision        : 
42
// Last modification    : Sun Sep 30 20:11:56 2007
43
/////////////////////////////////////////////////////////////////////
44
// FUNCTION: 2-port RAM with 1 port to write and 1 port to read
45
// FILES: RAM2x64C_1.v - dual ported synchronous RAM, contains:         
46
//          RAM64.v -single ported synchronous RAM
47
// PROPERTIES: 1)Has the volume of 2x64 complex data
48
//               2)Contains 4 single port RAMs for real and 
49
//               imaginary parts of data in the 2-fold volume 
50
//                   Two halves of RAM are switched on and off in the 
51
//               write mode by the signal ODD   
52
//                 3)RAM is synchronous one, the read datum is 
53
//               outputted in 2 cycles after the address setting
54
//                 4)Can be substituted to any 2-port synchronous 
55
//                   RAM for example, to one RAMB16_S36_S36 in XilinxFPGAs      
56
/////////////////////////////////////////////////////////////////////
57
 
58
`timescale 1 ns / 1 ps
59
`include "FFT64_CONFIG.inc"
60
 
61
module RAM2x64C_1 ( CLK ,ED ,WE ,ODD ,ADDRW ,ADDRR ,DR ,DI ,DOR ,DOI );
62
        `USFFT64paramnb
63
 
64
 
65
        output [nb-1:0] DOR ;
66
        wire [nb-1:0] DOR ;
67
        output [nb-1:0] DOI ;
68
        wire [nb-1:0] DOI ;
69
        input CLK ;
70
        wire CLK ;
71
        input ED ;
72
        wire ED ;
73
        input WE ;           //write enable
74
        wire WE ;
75
        input ODD ;       // RAM part switshing
76
        wire ODD ;
77
        input [5:0] ADDRW ;
78
        wire [5:0] ADDRW ;
79
        input [5:0] ADDRR ;
80
        wire [5:0] ADDRR ;
81
        input [nb-1:0] DR ;
82
        wire [nb-1:0] DR ;
83
        input [nb-1:0] DI ;
84
        wire [nb-1:0] DI ;
85
 
86
        reg     oddd,odd2;
87
        always @( posedge CLK) begin //switch which reswiches the RAM parts
88
                        if (ED) begin
89
                                        oddd<=ODD;
90
                                        odd2<=oddd;
91
                                end
92
                end
93
        `ifdef  USFFT64bufferports1
94
        //One-port RAMs are used
95
        wire we0,we1;
96
        wire    [nb-1:0] dor0,dor1,doi0,doi1;
97
        wire    [5:0] addr0,addr1;
98
 
99
 
100
 
101
        assign  addr0 =ODD?  ADDRW: ADDRR;              //MUXA0
102
        assign  addr1 = ~ODD? ADDRW:ADDRR;      // MUXA1
103
        assign  we0   =ODD?  WE: 0;                   // MUXW0: 
104
        assign  we1   =~ODD? WE: 0;                       // MUXW1:
105
 
106
        //1-st half - write when odd=1   read when odd=0
107
        RAM64 #(nb) URAM0(.CLK(CLK),.ED(ED),.WE(we0), .ADDR(addr0),.DI(DR),.DO(dor0)); // 
108
        RAM64 #(nb) URAM1(.CLK(CLK),.ED(ED),.WE(we0), .ADDR(addr0),.DI(DI),.DO(doi0));
109
 
110
        //2-d half
111
        RAM64 #(nb) URAM2(.CLK(CLK),.ED(ED),.WE(we1), .ADDR(addr1),.DI(DR),.DO(dor1));//          
112
        RAM64 #(nb) URAM3(.CLK(CLK),.ED(ED),.WE(we1), .ADDR(addr1),.DI(DI),.DO(doi1));
113
 
114
        assign  DOR=~odd2? dor0 : dor1;          // MUXDR: 
115
        assign  DOI=~odd2? doi0 : doi1; //  MUXDI:
116
 
117
        `else
118
        //Two-port RAM is used
119
        wire [6:0] addrr2 = {ODD,ADDRR};
120
        wire [6:0] addrw2 = {~ODD,ADDRW};
121
        wire [2*nb-1:0] di= {DR,DI} ;
122
        wire [2*nb-1:0] doi;
123
 
124
        reg [2*nb-1:0] ram [127:0];
125
        reg [6:0] read_addra;
126
        always @(posedge CLK) begin
127
                        if (ED)
128
                                begin
129
                                        if (WE)
130
                                                ram[addrw2] <= di;
131
                                        read_addra <= addrr2;
132
                                end
133
                end
134
        assign doi = ram[read_addra];
135
 
136
        assign  DOR=doi[2*nb-1:nb];              // Real read data 
137
        assign  DOI=doi[nb-1:0];          // Imaginary read data
138
 
139
 
140
        `endif
141
endmodule

powered by: WebSVN 2.1.0

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