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

Subversion Repositories pipelined_fft_128

[/] [pipelined_fft_128/] [trunk/] [SRC/] [rotator128_v.v] - Blame information for rev 2

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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