Skip to content

sampai97/Modular-FFT-radix-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VHDL modular FFT radix 2

This is a project of a digital Fourier Transform base on the FFT radix 2 Cooley-Tukey algorithm.

Suggested tools

I didn't included any synthesizer instruction or any tools for doing it but for the testing part my project was made using GHDL e GTKwave, feel free to use whatever you want but my files work using them. For generating the sample and all twiddle factor I used MATLAB but any language that can make exponential operation and write on a file is good. Tool used

Instruction

Number representation

This project works for real and complex signal and in order to have a functional representation the input samples must be in a specific order. If x is the vector with all the samples, x(i) is the real part and x(i+1) is the imaginary part. In this way a 8 point FFT need 16 number. In matlab section there is a code to generate an input file respecting this representation.

Changing number of points

To change the number of points you need to change the generic value present into 3 files:

  • FFT2_main.vhd
  • fft_types_pkg.vhd
  • FFT2_main_tb.vhd (only for test bench)

The generic variable is named N and it need to be the double wanted.

Twiddle factor

For the twiddle factor they are saved into twiddle_type_pkg.vhd and they need to be generated as the input. In matlab folder there is a file to generate them too. If modified remember to modify the value N_twiddle. To load these number just copy and paste them, too lazy to read them from file.

Testing

For testing there is a file named FFT2_test.sh that contain some GHDL command to run the test bench as i wrote into FFT2_main_tb.vhd that accept the input file generated by matlab and produce an output file with the results. Remember to change the file path into this script. A matlab script present in the folder matlab can be used to validate the results.

GHDL usage

In the simplest way GHDL works as follow:

GHDL -a "file_name.vhd"

on every file of the project, package and test bench included

GHDL -e "tb_name"

on the file resulting of the -a command on the test bench, this will elaborate the design

GHDL -r "tb_name"

on the file resulting of the previuos command, this will run the simulation

Contact

I made this project entirely on Linux, idk how to do it on other platform. If you want more explanation or something does not work you can write me on matrix: @sampai97:gitter.im