Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 19 Fast Fourier Transform (FFT) (Theory and Implementation)

Similar presentations


Presentation on theme: "Chapter 19 Fast Fourier Transform (FFT) (Theory and Implementation)"— Presentation transcript:

1 Chapter 19 Fast Fourier Transform (FFT) (Theory and Implementation)

2 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 2 Learning Objectives DFT algorithm. DFT algorithm. Conversion of DFT to FFT algorithm. Conversion of DFT to FFT algorithm. Implementation of the FFT algorithm. Implementation of the FFT algorithm.

3 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 3 DFT Algorithm The Fourier transform of an analogue signal x(t) is given by: The Fourier transform of an analogue signal x(t) is given by: The Discrete Fourier Transform (DFT) of a discrete-time signal x(nT) is given by: The Discrete Fourier Transform (DFT) of a discrete-time signal x(nT) is given by: Where: Where:

4 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 4 DFT Algorithm If we let: If we let:then:

5 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 5 DFT Algorithm X(0) = x[0]W N 0 + x[1]W N 0*1 +…+ x[N-1]W N 0*(N-1) X(1) = x[0]W N 0 + x[1]W N 1*1 +…+ x[N-1]W N 1*(N-1) : X(k) = x[0]W N 0 + x[1]W N k*1 +…+ x[N-1]W N k*(N-1) : X(N-1)= x[0]W N 0 + x[1]W N (N-1)*1 +…+ x[N-1]W N (N-1)(N-1) Note: For N samples of x we have N frequencies representing the signal. x[n] = input X[k] = frequency bins W= twiddle factors

6 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 6 Performance of the DFT Algorithm The DFT requires N 2 (NxN) complex multiplications: The DFT requires N 2 (NxN) complex multiplications: Each X(k) requires N complex multiplications. Each X(k) requires N complex multiplications. Therefore to evaluate all the values of the DFT ( X(0) to X(N-1) ) N 2 multiplications are required. Therefore to evaluate all the values of the DFT ( X(0) to X(N-1) ) N 2 multiplications are required. The DFT also requires (N-1)*N complex additions: The DFT also requires (N-1)*N complex additions: Each X(k) requires N-1 additions. Each X(k) requires N-1 additions. Therefore to evaluate all the values of the DFT (N-1)*N additions are required. Therefore to evaluate all the values of the DFT (N-1)*N additions are required.

7 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 7 Performance of the DFT Algorithm Can the number of computations required be reduced? Can the number of computations required be reduced?

8 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 8 DFT FFT A large amount of work has been devoted to reducing the computation time of a DFT. A large amount of work has been devoted to reducing the computation time of a DFT. This has led to efficient algorithms which are known as the Fast Fourier Transform (FFT) algorithms. This has led to efficient algorithms which are known as the Fast Fourier Transform (FFT) algorithms.

9 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 9 DFT FFT x[n] = x[0], x[1], …, x[N-1] [1] Lets divide the sequence x[n] into even and odd sequences: Lets divide the sequence x[n] into even and odd sequences: x[2n] = x[0], x[2], …, x[N-2] x[2n] = x[0], x[2], …, x[N-2] x[2n+1] = x[1], x[3], …, x[N-1] x[2n+1] = x[1], x[3], …, x[N-1]

10 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 10 DFT FFT [2] Equation 1 can be rewritten as: Equation 1 can be rewritten as: Since: Since: Then: Then:

11 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 11 DFT FFT The result is that an N-point DFT can be divided into two N/2 point DFTs: The result is that an N-point DFT can be divided into two N/2 point DFTs: N-point DFT Where Y(k) and Z(k) are the two N/2 point DFTs operating on even and odd samples respectively: Where Y(k) and Z(k) are the two N/2 point DFTs operating on even and odd samples respectively: Two N/2- point DFTs

12 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 12 DFT FFT Periodicity and symmetry of W can be exploited to simplify the DFT further: Periodicity and symmetry of W can be exploited to simplify the DFT further: Or:And: [3] : Symmetry : Periodicity

13 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 13 DFT FFT Symmetry and periodicity: Symmetry and periodicity: W 8 0 = W 8 8 W 8 1 = W 8 9 W82W82W82W82 W84W84W84W84 W83W83W83W83 W86W86W86W86 W87W87W87W87 W85W85W85W85 W N k+N/2 = - W N k W N/2 k+N/2 = W N/2 k W 8 k+4 = - W 8 k W 8 k+8 = W 8 k

14 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 14 DFT FFT Finally by exploiting the symmetry and periodicity, Equation 3 can be written as: Finally by exploiting the symmetry and periodicity, Equation 3 can be written as: [4]

15 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 15 DFT FFT Y(k) and W N k Z(k) only need to be calculated once and used for both equations. Y(k) and W N k Z(k) only need to be calculated once and used for both equations. Note: the calculation is reduced from 0 to N-1 to 0 to (N/2 - 1). Note: the calculation is reduced from 0 to N-1 to 0 to (N/2 - 1).

16 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 16 DFT FFT Y(k) and Z(k) can also be divided into N/4 point DFTs using the same process shown above: Y(k) and Z(k) can also be divided into N/4 point DFTs using the same process shown above: The process continues until we reach 2 point DFTs. The process continues until we reach 2 point DFTs.

17 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 17 DFT FFT Illustration of the first decimation in time FFT. Illustration of the first decimation in time FFT.y[0]y[1] y[2] y[N-2] N/2 point DFT x[0] x[2] x[4] x[N-2] x[1] x[3] x[5] x[N-1]z[0]z[1] z[2] z[N/2-1] X[N/2] = y[0]-W 0 z[0] X[0] = y[0]+W 0 z[0] W0W0W0W0 X[N/2+1] = y[1]-W 1 z[1] X[1] = y[1]+W 1 z[1] W1W1W1W1

18 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 18 FFT Implementation Calculation of the output of a butterfly: Calculation of the output of a butterfly: U=U r +jU i = X(k) L=L r +jL i = X(k+N/2) Y(k) = U r +jU i Y(k) = U r +jU i W N k Z(k) = (L r +jL i )(W r +jW i ) W N k Z(k) = (L r +jL i )(W r +jW i ) Different methods are available for calculating the outputs U and L. Different methods are available for calculating the outputs U and L. The best method is the one with the least number of multiplications and additions. The best method is the one with the least number of multiplications and additions. Key:U = Upperr = real L = Loweri = imaginary

19 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 19 FFT Implementation Calculation of the output of a butterfly: Calculation of the output of a butterfly: U=U r +jU i U=U r +jU i L=L r +jL i L=L r +jL i U r +jU i (L r +jL i )(W r +jW i )

20 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 20 FFT Implementation Calculation of the output of a butterfly: Calculation of the output of a butterfly: To further minimise the number of operations (* and +), the following are calculated only once: To further minimise the number of operations (* and +), the following are calculated only once: temp1 = L r W r temp2 = L i W i temp3 = L r W i temp4 = L i W r temp1_2 = temp1 - temp2 temp3_4 = temp3 + temp4 U r = temp1 - temp2 + U r = temp1_2 + U r U i = temp3 + temp4 + U i = temp3_4 + U i L r = U r - temp1 + temp2 = U r - temp1_2 L i = U i - temp3 - temp4 = U i - temp3_4 U=U r +jU i = (L r W r - L i W i + U r )+j(L r W i + L i W r + U i ) L=L r +jL i = (U r - L r W r + L i W i )+j(U i - L r W i - L i W r ) U r +jU i (L r +jL i )(W r +jW i )

21 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 21 FFT Implementation (Butterfly Calculation) Converting the butterfly calculation into C code: Converting the butterfly calculation into C code: temp1 = (y[lower].real * WR); temp2 = (y[lower].imag * WI); temp3 = (y[lower].real * WI); temp4 = (y[lower].imag * WR); temp1_2 = temp1 - temp2; temp3_4 = temp 3 + temp4; y[upper].real = temp1_2 + y[upper].real; y[upper].imag = temp3_4 + y[upper].imag; y[lower].imag = y[upper].imag - temp3_4; y[lower].real = y[upper].real - temp1_2;

22 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 22 FFT Implementation To efficiently implement the FFT algorithm a few observations are made: To efficiently implement the FFT algorithm a few observations are made: Each stage has the same number of butterflies (number of butterflies = N/2, N is number of points). Each stage has the same number of butterflies (number of butterflies = N/2, N is number of points). The number of DFT groups per stage is equal to (N/2 stage ). The number of DFT groups per stage is equal to (N/2 stage ). The difference between the upper and lower leg is equal to 2 stage-1. The difference between the upper and lower leg is equal to 2 stage-1. The number of butterflies in the group is equal to 2 stage-1. The number of butterflies in the group is equal to 2 stage-1.

23 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 23 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Example: 8 point FFT

24 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 24 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Example: 8 point FFT (1)Number of stages:

25 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 25 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Example: 8 point FFT (1)Number of stages: N stages = 1 N stages = 1 Stage 1

26 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 26 Example: 8 point FFT (1)Number of stages: N stages = 2 N stages = 2 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 1

27 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 27 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1

28 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 28 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: Stage 1: FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1

29 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 29 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 1 Stage 1: N blocks = 1 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1 Block 1

30 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 30 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 2 Stage 1: N blocks = 2 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1 Block 1 Block 2

31 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 31 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 3 Stage 1: N blocks = 3 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1 Block 1 Block 2 Block 3

32 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 32 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1 Block 1 Block 2 Block 3 Block 4

33 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 33 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 1 Stage 2: N blocks = 1 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1 Block 1

34 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 34 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1 Block 1 Block 2

35 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 35 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1 Block 1

36 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 36 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: Stage 1: FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1 Stage 2 Stage 3 Stage 1

37 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 37 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: N btf = 1 Stage 1: N btf = 1 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1

38 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 38 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: N btf = 1 Stage 1: N btf = 1 Stage 2: N btf = 1 Stage 2: N btf = 1 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1

39 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 39 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: N btf = 1 Stage 1: N btf = 1 Stage 2: N btf = 2 Stage 2: N btf = 2 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1

40 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 40 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: N btf = 1 Stage 1: N btf = 1 Stage 2: N btf = 2 Stage 2: N btf = 2 Stage 3: N btf = 1 Stage 3: N btf = 1 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1

41 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 41 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: N btf = 1 Stage 1: N btf = 1 Stage 2: N btf = 2 Stage 2: N btf = 2 Stage 3: N btf = 2 Stage 3: N btf = 2 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1

42 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 42 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: N btf = 1 Stage 1: N btf = 1 Stage 2: N btf = 2 Stage 2: N btf = 2 Stage 3: N btf = 3 Stage 3: N btf = 3 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1

43 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 43 Example: 8 point FFT (1)Number of stages: N stages = 3 N stages = 3 (2)Blocks/stage: Stage 1: N blocks = 4 Stage 1: N blocks = 4 Stage 2: N blocks = 2 Stage 2: N blocks = 2 Stage 3: N blocks = 1 Stage 3: N blocks = 1 (3)Bflies/block: Stage 1: N btf = 1 Stage 1: N btf = 1 Stage 2: N btf = 2 Stage 2: N btf = 2 Stage 3: N btf = 4 Stage 3: N btf = 4 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Decimation in time FFT: Decimation in time FFT: Number of stages = log 2 N Number of stages = log 2 N Number of blocks/stage = N/2 stage Number of blocks/stage = N/2 stage Number of butterflies/block = 2 stage-1 Number of butterflies/block = 2 stage-1

44 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 44 FFT Implementation W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1 Twiddle Factor Index N/2 = 4 Start Index 000 Input Index 124

45 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 45 FFT Implementation Twiddle Factor Index N/2 = 4 4 /2 = 2 Start Index 000 Input Index 124 W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1

46 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 46 FFT Implementation Twiddle Factor Index N/2 = 4 4 /2 = 2 2 /2 = 1 Start Index 000 Input Index 124 W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1

47 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 47 FFT Implementation Start Index 0 Input Index 1 Twiddle Factor Index N/2 = 4 4 /2 = 2 2 /2 = 1 Indicies Used W0W0W0W0 W0W0W2W2W0W0W2W2 W0W0W1W1W2W2W3W3W0W0W1W1W2W2W3W W0W0W0W0 W0W0W0W0 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W0W0W0W0 W2W2W2W2 W0W0W0W0 W1W1W1W1 W0W0W0W0 W3W3W3W3 W2W2W2W2 Stage 2 Stage 3 Stage 1

48 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 48 FFT Implementation The most important aspect of converting the FFT diagram to C code is to calculate the upper and lower indices of each butterfly: The most important aspect of converting the FFT diagram to C code is to calculate the upper and lower indices of each butterfly: GS = N/4; /* Group step initial value */ step = 1;/* Initial value */ NB = N/2;/* NB is a constant */ for (k=N; k>1; k>>1)/* Repeat this loop for each stage */ { for (j=0; j

49 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 49 FFT Implementation How to declare and access twiddle factors: How to declare and access twiddle factors: (1)How to declare the twiddle factors: struct { short real; // * cos (2*pi*n) -> Q15 format short imag; // * sin (2*pi*n) -> Q15 format } w[] = { 32767,0, 32767,-201, 32767,-201,......}; short temp_real, temp_imag; temp_real = w[i].real; temp_imag = w[i].imag; (2)How to access the twiddle factors:

50 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 50 FFT Implementation Links: Project location: Project location: \CD ROM 2004\DSP Code 6711 Update\Chapter 19 - Fast Fourier Transform\FFT DIF _in C_Fixed point\fft_bios.pjt \CD ROM 2004\DSP Code 6711 Update\Chapter 19 - Fast Fourier Transform\FFT DIF _in C_Fixed point\fft_bios.pjt \CD ROM 2004\DSP Code for DSK6416\Chapter 19 - Fast Fourier Transform\FFT DIF _in C_Fixed point\fft_project.pjt \CD ROM 2004\DSP Code for DSK6416\Chapter 19 - Fast Fourier Transform\FFT DIF _in C_Fixed point\fft_project.pjt \CD ROM 2004\DSP Code for DSK6713\Chapter 19 - Fast Fourier Transform\FFT DIF _in C_Fixed point\fft_project.pjt \CD ROM 2004\DSP Code for DSK6713\Chapter 19 - Fast Fourier Transform\FFT DIF _in C_Fixed point\fft_project.pjt Laboratory sheet: FFTLabSheet.pdf Laboratory sheet: FFTLabSheet.pdfFFTLabSheet.pdf

51 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 51 FFT test on the DSK6713

52 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Chapter 19, Slide 52 FFT test on the DSK6416

53 Chapter 19 Fast Fourier Transform (FFT) (Theory and Implementation) - End -


Download ppt "Chapter 19 Fast Fourier Transform (FFT) (Theory and Implementation)"

Similar presentations


Ads by Google