FFT IP Core: User Guide

ID 683374
Date 11/06/2017
Document Table of Contents

2.5.2. Simulating the Variable Streaming FFT IP Core in the MATLAB Software

The FFT IP Core produces a bit-accurate MATLAB model <variation name>_model.m, which you can use to model the behavior of your custom FFT variation in the MATLAB software.

The model takes a complex vector as input and it outputs the transform-domain complex vector. The lengths and direction of the transforms (FFT/IFFT) (specified as one entry per block) are also passed as an input to the model. You must ensure that the length of the input vector is at least as large as the sum of the transform sizes for the model to function correctly. The wizard also creates the MATLAB testbench file <variation name>_tb.m. This file creates the stimuli for the MATLAB model by reading the input complex random data from the generated files.

  1. Run the MATLAB software.
  2. In the MATLAB command window, change to the working directory for your project.
  3. Simulate the design:
    1. Type help <variation name>_model at the command prompt to view the input and output vectors that are required to run the MATLAB model as a standalone M-function. Create your input vector and make a function call to <variation name>_model. For example:
      	inverse = [0,1]; % 0 => FFT 1=> IFFT
      	x = (2^12)*rand(1,sum(nps)) + j*(2^12)*rand(1,sum(nps));
      	[y] = <variation name>_model(x,nps,inverse);
    2. Alternaitvely, run the provided testbench by typing the name of the testbench, <variation name>_tb at the command prompt.
      Note: If you select digit-reversed output order, you can reorder the data with the following MATLAB code:
      y = y(digit_reverse(0:(FFTSIZE-1), log2(FFTSIZE)) + 1);

      where digit_reverse is:

      			function y = digit_reverse(x, n_bits)
      			if mod(n_bits,2)
      				z = dec2bin(x, n_bits);
      				for i=1:2:n_bits-1
      					p(:,i) = z(:,n_bits-i);
      					p(:,i+1) = z(:,n_bits-i+1);
      				p(:,n_bits) = z(:,1);