Test Bench File:
% FFT length
N = 128;% create input sine wave
Fs = 40;t = (0:N-1)'/Fs;y = sin(t);% convert input signal to fixed point
y_fixed = sfi(y, 32, 24);hfft = dsp.HDLFFT('FFTLength',N,'OverflowAction','Saturate', 'RoundingMethod', 'Nearest', 'BitReversedOutput', false);Yf = zeros(1,4*N);validOut = false(1,4*N);for loop = 1:1:N [Yf(loop),validOut(loop)] = step(hfft, complex(y_fixed(loop)), true);endfor loop = N+1:1:4*N [Yf(loop),validOut(loop)] = step(hfft, complex(0), false);end% strip non-valid output data
Yf = Yf(validOut == 1);[Xout] = IFFT_128( Yf );
Function:
function [ Xout ] = IFFT_128( X )persistent hifft;hifft = dsp.HDLIFFT('FFTLength',128,'OverflowAction','Saturate', 'RoundingMethod', 'Nearest' , 'BitReversedOutput', false);Xt = complex(zeros(1,3*128));validOut = false(1,3*128);for loop = 1:1:128 [Xt(loop),validOut(loop)] = step(hifft, complex(X(loop)),true);endfor loop = 128+1:1:3*128 [Xt(loop),validOut(loop)] = step(hifft, complex(0),false);end% grab only valid data
Xout = Xt(validOut==1);end
The error I encounter is when the Workflow Advisor is on the Fixed-Point Conversion step. The error is:
Wrong class of input #1: expected 'embedded.fi', got 'double'. Code generation requires that all calls to step() on same object have inputs of same type.
Best Answer