1 |
8 |
unicore |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// rotating unit, stays between 2 stages of FFT pipeline ////
|
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 :
|
41 |
|
|
// File Revision :
|
42 |
|
|
// Last modification : Sun Sep 30 20:11:56 2007
|
43 |
|
|
/////////////////////////////////////////////////////////////////////
|
44 |
|
|
// FUNCTION: complex multiplication to the twiddle factors proper to the 64 point FFT
|
45 |
|
|
// PROPERTIES: 1) Has 64-clock cycle period starting with the START impulse and continuing forever
|
46 |
|
|
// 2) rounding is not used
|
47 |
|
|
/////////////////////////////////////////////////////////////////////
|
48 |
|
|
|
49 |
|
|
`timescale 1ps / 1ps
|
50 |
|
|
`include "FFT64_CONFIG.inc"
|
51 |
|
|
|
52 |
|
|
module ROTATOR64 (CLK ,RST,ED,START, DR,DI, DOR, DOI,RDY );
|
53 |
|
|
`USFFT64paramnb
|
54 |
|
|
`USFFT64paramnw
|
55 |
|
|
|
56 |
|
|
input RST ;
|
57 |
|
|
wire RST ;
|
58 |
|
|
input CLK ;
|
59 |
|
|
wire CLK ;
|
60 |
|
|
input ED ; //operation enable
|
61 |
|
|
input [nb+1:0] DI; //Imaginary part of data
|
62 |
|
|
wire [nb+1:0] DI ;
|
63 |
|
|
input [nb+1:0] DR ; //Real part of data
|
64 |
|
|
input START ; //1-st Data is entered after this impulse
|
65 |
|
|
wire START ;
|
66 |
|
|
|
67 |
|
|
output [nb+1:0] DOI ; //Imaginary part of data
|
68 |
|
|
wire [nb+1:0] DOI ;
|
69 |
|
|
output [nb+1:0] DOR ; //Real part of data
|
70 |
|
|
wire [nb+1:0] DOR ;
|
71 |
|
|
output RDY ; //repeats START impulse following the output data
|
72 |
|
|
reg RDY ;
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
reg [5:0] addrw;
|
76 |
|
|
reg sd1,sd2;
|
77 |
|
|
always @( posedge CLK) //address counter for twiddle factors
|
78 |
|
|
begin
|
79 |
|
|
if (RST) begin
|
80 |
|
|
addrw<=0;
|
81 |
|
|
sd1<=0;
|
82 |
|
|
sd2<=0;
|
83 |
|
|
end
|
84 |
|
|
else if (START && ED) begin
|
85 |
|
|
addrw[5:0]<=0;
|
86 |
|
|
sd1<=START;
|
87 |
|
|
sd2<=0;
|
88 |
|
|
end
|
89 |
|
|
else if (ED) begin
|
90 |
|
|
addrw<=addrw+1;
|
91 |
|
|
sd1<=START;
|
92 |
|
|
sd2<=sd1;
|
93 |
|
|
RDY<=sd2;
|
94 |
|
|
end
|
95 |
|
|
end
|
96 |
|
|
|
97 |
|
|
wire signed [nw-1:0] wr,wi; //twiddle factor coefficients
|
98 |
|
|
//twiddle factor ROM
|
99 |
|
|
WROM64 UROM( .ADDR(addrw), .WR(wr),.WI(wi) );
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
reg signed [nb+1 : 0] drd,did;
|
103 |
|
|
reg signed [nw-1 : 0] wrd,wid;
|
104 |
|
|
wire signed [nw+nb+1 : 0] drri,drii,diri,diii;
|
105 |
|
|
reg signed [nb+2:0] drr,dri,dir,dii,dwr,dwi;
|
106 |
|
|
|
107 |
|
|
assign drri=drd*wrd;
|
108 |
|
|
assign diri=did*wrd;
|
109 |
|
|
assign drii=drd*wid;
|
110 |
|
|
assign diii=did*wid;
|
111 |
|
|
|
112 |
|
|
always @(posedge CLK) //complex multiplier
|
113 |
|
|
begin
|
114 |
|
|
if (ED) begin
|
115 |
|
|
drd<=DR;
|
116 |
|
|
did<=DI;
|
117 |
|
|
wrd<=wr;
|
118 |
|
|
wid<=wi;
|
119 |
|
|
drr<=drri[nw+nb+1 :nw-1]; //msbs of multiplications are stored
|
120 |
|
|
dri<=drii[nw+nb+1 : nw-1];
|
121 |
|
|
dir<=diri[nw+nb+1 : nw-1];
|
122 |
|
|
dii<=diii[nw+nb+1 : nw-1];
|
123 |
|
|
dwr<=drr - dii;
|
124 |
|
|
dwi<=dri + dir;
|
125 |
|
|
end
|
126 |
|
|
end
|
127 |
|
|
assign DOR=dwr[nb+2:1];
|
128 |
|
|
assign DOI=dwi[nb+2 :1];
|
129 |
|
|
|
130 |
|
|
endmodule
|