1 |
2 |
unicore |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// FFT/IFFT 128 points transform ////
|
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 |
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
40 |
|
|
// DESCRIPTION : Store buffer
|
41 |
|
|
// FUNCTION: FIFO - buffer with direct input order and 8-th inverse output order
|
42 |
|
|
// FILES: BUFRAM128C_1.v - 1-st,2-nd,3-d data buffer, contains:
|
43 |
|
|
// RAM2x128C.v - dual ported synchronous RAM, contains:
|
44 |
|
|
// RAM128.v -single ported synchronous RAM
|
45 |
|
|
// PROPERTIES: 1) Has the volume of 2x128 complex data
|
46 |
|
|
// 2) Contains 2- port RAM and address counter
|
47 |
|
|
// 3)Has 128-clock cycle period starting with the START impulse
|
48 |
|
|
// and continuing forever
|
49 |
|
|
// 4) Signal RDY precedes the 1-st correct datum outputted from the buffer
|
50 |
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
51 |
|
|
`timescale 1 ns / 1 ps
|
52 |
|
|
`include "FFT128_CONFIG.inc"
|
53 |
|
|
|
54 |
|
|
module BUFRAM128C_1 ( CLK ,RST ,ED ,START ,DR ,DI ,RDY ,DOR ,DOI );
|
55 |
|
|
`FFT128paramnb
|
56 |
|
|
output RDY ;
|
57 |
|
|
reg RDY ;
|
58 |
|
|
output [nb-1:0] DOR ;
|
59 |
|
|
wire [nb-1:0] DOR ;
|
60 |
|
|
output [nb-1:0] DOI ;
|
61 |
|
|
wire [nb-1:0] DOI ;
|
62 |
|
|
|
63 |
|
|
input CLK ;
|
64 |
|
|
wire CLK ;
|
65 |
|
|
input RST ;
|
66 |
|
|
wire RST ;
|
67 |
|
|
input ED ;
|
68 |
|
|
wire ED ;
|
69 |
|
|
input START ;
|
70 |
|
|
wire START ;
|
71 |
|
|
input [nb-1:0] DR ;
|
72 |
|
|
wire [nb-1:0] DR ;
|
73 |
|
|
input [nb-1:0] DI ;
|
74 |
|
|
wire [nb-1:0] DI ;
|
75 |
|
|
|
76 |
|
|
wire odd, we;
|
77 |
|
|
wire [6:0] addrw,addrr;
|
78 |
|
|
reg [7:0] addr;
|
79 |
|
|
reg [8:0] ct2; //counter for the RDY signal
|
80 |
|
|
|
81 |
|
|
always @(posedge CLK) // CTADDR
|
82 |
|
|
begin
|
83 |
|
|
if (RST) begin
|
84 |
|
|
addr<=7'b000_0000;
|
85 |
|
|
ct2<= 8'b1000_0001;
|
86 |
|
|
RDY<=1'b0; end
|
87 |
|
|
else if (START) begin
|
88 |
|
|
addr<=7'b000_0000;
|
89 |
|
|
ct2<= 8'b0000_0000;
|
90 |
|
|
RDY<=1'b0;end
|
91 |
|
|
else if (ED) begin
|
92 |
|
|
RDY<=1'b0;
|
93 |
|
|
addr<=addr+1;
|
94 |
|
|
if (ct2!=129)
|
95 |
|
|
ct2<=ct2+1;
|
96 |
|
|
if (ct2==128)
|
97 |
|
|
RDY<=1'b1;
|
98 |
|
|
end
|
99 |
|
|
end
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
assign addrw= addr[6:0];
|
103 |
|
|
assign odd=addr[7]; // signal which switches the 2 parts of the buffer
|
104 |
|
|
assign addrr={addr[2 : 0], addr[6 : 3]}; // 16-th inverse output address
|
105 |
|
|
assign we = ED;
|
106 |
|
|
|
107 |
|
|
RAM2x128C #(nb) URAM(.CLK(CLK),.ED(ED),.WE(we),.ODD(odd),
|
108 |
|
|
.ADDRW(addrw), .ADDRR(addrr),
|
109 |
|
|
.DR(DR),.DI(DI),
|
110 |
|
|
.DOR(DOR), .DOI(DOI));
|
111 |
|
|
|
112 |
|
|
endmodule
|