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

Subversion Repositories pipelined_fft_256

[/] [pipelined_fft_256/] [trunk/] [SRC/] [rotator256_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 256 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:                               ROTATOR256_v.v - this file,   
44
//                                               WROM256.v - ROM of twiddle factors.       
45
//  PROPERTIES: 1) Has 256-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 "FFT256_CONFIG.inc"
53
 
54
module ROTATOR64 (CLK ,RST,ED,START, DR,DI, DOR, DOI,RDY  );
55
        `FFT256paramnb
56
        `FFT256paramnw
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 [7: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[7: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 signed [nw-1:0] wr,wi; //twiddle factor coefficients
100
        //twiddle factor ROM
101
        WROM256 UROM( .ADDR(addrw),     .WR(wr),.WI(wi) );
102
 
103
 
104
        reg signed [nb-1 : 0] drd,did;
105
        reg signed [nw-1 : 0] wrd,wid;
106
        wire signed [nw+nb-1 : 0] drri,drii,diri,diii;
107
        reg signed [nb:0] drr,dri,dir,dii,dwr,dwi;
108
 
109
        assign          drri=drd*wrd;
110
        assign  diri=did*wrd;
111
        assign  drii=drd*wid;
112
        assign  diii=did*wid;
113
 
114
        always @(posedge CLK)    //complex multiplier    
115
                begin
116
                        if (ED) begin
117
                                        drd<=DR;
118
                                        did<=DI;
119
                                        wrd<=wr;
120
                                        wid<=wi;
121
                                        drr<=drri[nw+nb-1 :nw-1]; //msbs of multiplications are stored
122
                                        dri<=drii[nw+nb-1 : nw-1];
123
                                        dir<=diri[nw+nb-1 : nw-1];
124
                                        dii<=diii[nw+nb-1 : nw-1];
125
                                        dwr<=drr - dii;
126
                                        dwi<=dri + dir;
127
                                end
128
                end
129
        assign DOR=dwr[nb:1];
130
        assign DOI=dwi[nb:1];
131
 
132
endmodule

powered by: WebSVN 2.1.0

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