FPGA Lec07 FFT
FPGA Lec07 FFT
Lecture 7 1
Fourier Transform
Complex number
Lecture 7 2
Discrete Fourier Transform (DFT)
𝑘 = 0,1, … , 𝑁 − 1
𝑛 = 0,1, … , 𝑁 − 1
Lecture 7 3
Properties
Discrete Fourier transform (DFT)
Symmetry:
Periodicity:
Lecture 7 4
Fast Fourier Transform (FFT)
Lecture 7 5
Example of Cooley-Tukey FFT
Lecture 7 6
Cooley-Tukey FFT
N2-point DFT
Lecture 7 7
12-Point FFT 𝑥[𝑛
̅ !, 𝑘"]
12-point FFT
# $
• 12 multiplications of 𝑊"!! " , 8 of which are trivial
• 4*(3-point DFT, 9*, 6+) = 36*, 24+
• 3*(4-point DFT, 16*, 12+) = 48*, 36+
• Total 88 multiplications, 60 additions
Lecture 7 9
Efficient Complex Multiplier
Lecture 7 10
Radix-r Cooley-Tukey Algorithm
Lecture 7 11
Divide-and-Conquer by 2
𝑋 𝑘 = 𝐺 𝑘 + 𝑊%$ 𝐻[𝑘]
Lecture 7 12
!
Reusing point DFT
" & &
! '" ! '"
𝑁 #) #)
For 𝑘 = 0,1, … , −1 𝑋 𝑘 = * 𝑓" [𝑚]𝑊&/! + 𝑊&) * 𝑓! [𝑚]𝑊&/!
2
#$% #$%
𝑋 𝑘 = 𝐺 𝑘 + 𝑊%$ 𝐻[𝑘]
𝑁 𝑁
For 𝑘 = , + 1, … , 𝑁 − 1
2 2
& &
! '" & & & & !
'"
& &
#()' ! + ! ) )' ! + ! #()' ! + ! )
𝑋𝑘 = * 𝑓" [𝑚]𝑊&/! + 𝑊& * 𝑓! [𝑚]𝑊&/!
#$% #$%
& &
! '" & & !
'"
&
#()' ! ) )' ! #()' ! )
= * 𝑓" [𝑚]𝑊&/! − 𝑊& * 𝑓! [𝑚]𝑊&/!
#$% #$%
%
𝑁 $& ! 𝑁
𝑋 𝑘 =𝐺 𝑘− − 𝑊% 𝐻[𝑘 − ]
2 2
Lecture 7 13
nal Processing: A User's Guide
those of the odd-indexed samples as
glas L. Jones
. Because of the periodicity with frequency samples of
th- DFTs, and can be used to compute two of the length- DFT frequencies, namely
nts Search this book
, but with a different twiddle factor. This reuse of these short-length DFT outputs gives the
of-two-FFTs)
Next
-
𝑋 𝑘 = * 𝑓" [𝑚]𝑊.#)
#$%
-
+𝑊/) * 𝑓! [𝑚]𝑊.#)
#$%
𝑋 𝑘 = 𝐺 𝑘 + 𝑊&) 𝐻[𝑘]
𝑘 = 0,1,2,3
𝑋 𝑘 = 𝐺 𝑘 − 4 + 𝑊&) 𝐻 𝑘 − 4
𝑋 𝑘 = 𝐺 𝑘 − 4 − 𝑊&)'. 𝐻 𝑘 − 4
𝑘 = 4,5,6,7
𝑋 0 = 𝑥 0 𝑊 " + 𝑥 2DFT
gure 1. Decimation in time of !
"
𝑊!into 4 𝑊!"DFTs
+two𝑥length-
a length- + 𝑥followed
6 𝑊!by "
+ 𝑊#"(𝑥 stage.
a combining 1 𝑊!" + 𝑥 3 𝑊!" + 𝑥 5 𝑊!" + 𝑥 7 𝑊!")
𝑋 5 = 𝑥 0 𝑊!" + 𝑥 2 𝑊!$ + 𝑥 4 𝑊!%" + 𝑥 6 𝑊!%$ + 𝑊#$(𝑥 1 𝑊!" + 𝑥 3 𝑊!$ + 𝑥 5 𝑊!%" + 𝑥 7 𝑊!%$)
irect computation of all DFT frequencies according to the DFT equation (/contents/a806bd3a-194f-
𝑋 5 = 𝑥 0 𝑊!" + 𝑥 2 𝑊!$ + 𝑥 4 𝑊!%" + 𝑥 6would
[email protected]:01e3cf62-3ba9-4fc9-bbde-d62220112b12@5) 𝑊!%$require
− 𝑊#%(𝑥 1 𝑊!" +
complex 𝑥 3 𝑊!$ + 𝑥 5 𝑊!%" + 𝑥 7 𝑊!%$)
and complex additions (for complex-valued data), by reusing the results of the two short-
s as illustrated in Figure, the computational cost is now
Lecture 7 14
worthwhile to note that, after merging the twiddle factors to a single term on the lower branch, the remaining
Book by: Douglas L. Jones
butterfly is actually a length-2 DFT! The theory of multi-dimensional index maps (/contents/a806bd3a-194f-
[email protected]:170fb301-92e3-4500-86d8-ccab60900f5c@3)
Contents Search this book shows that this must be the
case, and that FFTs of any factorable length may consist of successive stages of shorter-length FFTs with
Simplification
Back (/contents/[email protected]:DAsQCjnU/Power-
twiddle-factor multiplications in between.
of-two-FFTs)
Next
(a) (b)
Figure 2. Radix-2 DIT butterfly simplification: both operations produce the same outputs
2-point
DFT Combine
2-point
2-point DFTs Combine
DFT 4-point
DFTs
2-point
DFT Combine
2-point
2-point DFTs
DFT
Lecture 7 16
8-point Radix-2 FFT
2-point 𝑎 𝐴 = 𝑎 + 𝑊%' 𝑏
butterfly 𝑊%'
𝑏 −1 𝐵 = 𝑎 − 𝑊%' 𝑏
) G0
𝐺 𝑘 = 𝑃 𝑘 + 𝑊&/! 𝑄𝑘 P0
&
. '"
P1 G1
0)
𝑃 𝑘 =* 𝑔" [𝑖]𝑊&/. Q0
0$% G2
& Q1
. '" 0)
G3
𝑄 𝑘 =* 𝑔! [𝑖]𝑊&/.
0$%
𝑃 0 = 𝑥 0 𝑊!% + 𝑥 4 𝑊!%
𝑃 1 = 𝑥 0 𝑊!% + 𝑥 4 𝑊!"
𝑄 0 = 𝑥 2 𝑊!% + 𝑥 6 𝑊!%
𝑄 1 = 𝑥 2 𝑊!% + 𝑥 6 𝑊!"
𝐺 0 = 𝑃 0 + 𝑊.% 𝑄 0
𝐺 1 = 𝑃 1 + 𝑊." 𝑄 1
Decimation in time
Lecture 7 17
8-point Radix-2 FFT
366 6. Fourier Transforms
Decimation in frequency
1. Stage 2. Stage 3. Stage
000 x[0] X[0] 000
001 x[1] −1
X[4] 100
W0
010 x[2] −1
X[2] 010
W2
011 x[3] −1 −1
X[6] 110
W0
100 x[4] −1
X[1] 001
W1
101 x[5] −1 −1
X[5] 101
W2 W0
110 x[6] −1 −1
X[3] 011
W3 W2
111 x[7] −1 −1 −1
X[7] 111
Group Butterfly
Lecture 7 18
Fig. 6.13. Decimation-in-frequency algorithm of length-8 for radix-2.
Discrete Cosine Transform (DCT)
Real number
Popular
Lecture 7 19
DCT by IDFT
Temporarily ignore
constant coefficients
Let 𝑛1 = 𝑁 − 𝑛 − 1 𝐵
&'"
1
𝑘𝜋 1
3
𝐵 = * 𝑦 𝑛 cos (2𝑁 − 2𝑛 − 2 + )
&
𝑁 2
2 $&/!
&'" &'"
1
𝑘𝜋 1
1 1
𝑘𝜋 1
1
𝐵 = * 𝑦 𝑛 cos (−2𝑛 − ) = * 𝑦 𝑛 cos (2𝑛 + )
&
𝑁 2 &
𝑁 2
2 $&/! 2 $&/!
Lecture 7 20
DCT by Shorter IDFT 𝑌[𝑘]
&'" &'"
1 𝜋 4)
3!&
!4)2
3 &
𝑋 𝑘 = * 𝑦 𝑛 cos 𝑘 2𝑛 + = ℜ(𝑒 * 𝑦[𝑛]𝑒 )
2 𝑁
2$% )$ 2$%
(!%
𝐻𝑘 = 𝑒 𝑌[𝑘]
)(%&$) ) )$ conjugate
( !% ( ! &(!%
𝐻 𝑁−𝑘 = 𝑒 𝑌 𝑁−𝑘 = 𝑒 𝑒 𝑌 −𝑘 = 𝑗𝐻 ∗ [𝑘]
If 𝑧 = 𝑎 + 𝑗𝑏, 𝑗𝑧 ∗ = 𝑏 + 𝑗𝑎 𝑋 𝑁−𝑘 =ℜ 𝐻 𝑁−𝑘
= ℜ 𝑗𝐻 ∗ [𝑘]
𝑋 𝑘 = ℜ(𝐻 𝑘 ) 𝑁
= 𝑘 = 0,1, … , = ℑ(𝐻 𝑘 )
𝑋 𝑁 − 𝑘 = ℑ(𝐻 𝑘 ) 2
%
An N-point DCT is computed by +1 -point IDFT
!
Lecture 7 21
Fast 8-point DCT
C. Loeffler, et al., 1989
11 multiplications
29 additions
Lecture 7 22