Showing posts with label Verilog code for butterfly. Show all posts
Showing posts with label Verilog code for butterfly. Show all posts

Tuesday, 27 August 2013

DSP butterfly Unit

Hello friends. You must be aware of the applications of Verilog coding & its significance in different domain. From the last few months i was working on one such use of Verilog in DSP.  Signals & systems   is my all time favorite subject & its the one with lot of applications & used in many products like mobiles, tv, image processing etc. The list is long though  :) We will talk about one such DSP module today " The FFT Butterfly unit " . Before you read this post i suggest you to go through the FFT algorithm (DIT/DIF) so that it will be easy for you to understand the code.  Fast Fourier transform is used to convert a signal from time domain to frequency & this is needed so that you can view the frequency components present in a signals . If you know the frequency components present in a signals you can play with the signals :) Lets say, u want to design a low pass filter and want to decide on the cut off frequency of the filter . If you have the frequency domain details for a signals u can clearly identify the frequency components which u want to retain & the ones which u want to take out. Well let us not discuss this topic in detail here , but if you are still interested than you can refer to my short notes on FFT here:
 Fourier analysis

The figure below shows the FFT implementation using radix 2 algorithm.





























this is a 8 point FFT implementation using the butterfly unit, The butterfly unit is the heart of FFT algorithm . From the figure u can see that if we are done with the butterfly unit we are 70% done with the FFT coding.
Okie now lets start the coding for butterfly unit . The back box model of the butterfly will have 2 complex inputs & 2 complex outputs
The second input gets multiplied with the twiddle factor i.e (wr + j wi ) first. So before you start coding you must have the code written for complex number multiplication. Once you are done with the multiplication the next step is to do addition . You can do this by simple CLA (carry look ahead adders) . Output Z1 is obtained by adding the result of multiplication i.e(b1+jb2) * (Wr+jWi) to the first number i.e a1+ja2. And output Z2 is obtained by subtracting the multiplied product with the first number . To put it in mathematical form


Z1r+jZ1i= (b1+jb1)*(Wr+jWi) + (a1+ja2)

Z2r+jZ2i= (b1+jb1)*(Wr+jWi) - (a1+ja2)


If the result is analysed proerly u will discover that we need a complex multiplier ( which has 4 normal multipliers ) & 4 CLA units . To put the process in orderly manner we have to proceed in steps like this
1> read 2 complex numbers & the twiddle factor 
2>multiply 2nd number with the twiddle factor
3> add the product to 1st number to get the first o/p
4>Subtract the product to 1st number to get the first o/p

We are done. Here is the code for the Butterfly unit & the results of simulation & the RTL schematic

CODE:

RTL SCHEMATIC FOR THE CODE:






















Link for the coupons : Here

Black Box model:
























Please Note : Our course is now listed for Udemy training by Industry and leading companies use our courses  :
Analog Design- Intuitive Approach
Rc Circuits Analysis With LT Spice
Basics of Mosfet - Simplified View
Please use these links or share with someone who might be interested.
Note : Author discounts are already applied to these links.