Saturday 11 January 2014

FFT Calculator

This blog post implements a Fast Fourier Transform (FFT) or an Inverse Fast Fourier Transform (IFFT) on a complex input, dependent on the checkbox setting below.

For discrete time-domain input samples $x[n]$ for $n={0,1,2,..,N-1}$ the FFT (at bin $k$ for $k={0,1,2,..,N-1}$) is defined by equation

$X[k]=\sum_{n=0}^{N-1}x[n]exp(-j2\pi\frac{nk}{N})$

while for discrete frequency-domain input bins $X[k]$ for $k={0,1,2,..,N-1}$ the IFFT (at time index $n$ for $n={0,1,2,..,N-1}$) is defined by equation

$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]exp(+j2\pi\frac{nk}{N})$

where $N=2^g$ for integer $g$.

Please enter the numbers in the text areas below - one number per line, for each of the Real and Imaginary input textareas (the textareas have already been filled in with some numbers for illustration purposes). There must be no new line after the last number.

Note that if the input is real only, the imaginary input textarea can be left empty (rather than having to fill it with the same number of zeros as there are real inputs, which can be a bit more cumbersome). Conversely, if the input is imaginary only, the real input textarea can be left empty (rather than having to fill it with the same number of zeros as there are imaginary inputs).

Alternatively you can choose to load a CSV file, which must be either a single column of numbers (for a real only input) or two comma-separated columns of numbers - the first line can be a comment line, starting with the character #.

To perform the FFT/IFFT, please press the button labelled "Perform FFT/IFFT" below - the results will populate the textareas below labelled "Real Output" and "Imaginary Output", as well as a textarea at the bottom that will contain the real and imaginary output joined using a comma - this is suitable for copying and pasting the results to a CSV file.

If you change inputs to a smaller number of samples, please press the calculate button twice for the results to take effect. Alternatively, you can simply reload the page, then fill in the input textareas.

As the FFT operates on inputs that contain an integer power of two number of samples, the input data length will be augmented by zero padding the real and imaginary data samples to satisfy this condition were this not to hold.

You can find an FFT based Power Spectral Density (PSD) Estimator here.



Real Input
Imaginary Input






Real Output
Imaginary Output


Real and Imaginary output concatenated on each line:-

Wednesday 1 January 2014

VHDL Entity to Component Instantiation Converter

This page implements a web-based VHDL entity to component instantiation tool.

An example input entity listing already occurs in the input textarea. Note that the closing brackets for the generic and port must be on separate lines for the converter to work.



Input Entity Declaration







Output Component Instantiation