How to use extended word length and fraction in HDLFFT?
Afficher commentaires plus anciens
Hi
When I extend word and fraction length by using sfi(ddc_out,50,30) from sfi(ddc_out,32,24).
But I've got the below error messages during run the below code
[Yf(loop),validOut(loop)] = HDLFFT8(complex(y_fixed(i)),(loop <= N));
What am I supposed to do to resolve this problem?
close all
N = 8;
y_fixed = sfi(ddc_out,50,30);
Yf = zeros(1,3*N);
validOut = false(1,3*N);
for loop = 1:1:3*N
if (mod(loop, N) == 0)
i = N;
else
i = mod(loop, N);
end
[Yf(loop),validOut(loop)] = HDLFFT8(complex(y_fixed(i)),(loop <= N));
end
%%code
function [yOut,validOut] = HDLFFT8(yIn,validIn)
%HDLFFT8
% Processes one sample of FFT data using the dsp.HDLFFT System object(TM)
% yIn is a fixed-point scalar or column vector.
% validIn is a logical scalar value.
% You can generate HDL code from this function.
persistent fft8;
if isempty(fft8)
fft8 = dsp.HDLFFT('FFTLength',8);
end
[yOut,validOut] = fft8(yIn,validIn);
end
*Error using dsp.HDLFFT/parenReference
Changing the data type on input 1 is not allowed without first calling the release() method.
Error in HDLFFT8 (line 12)
[yOut,validOut] = fft8(yIn,validIn);
Error in AD9467_Cal_171219 (line 151)
[Yf(loop),validOut(loop)] = HDLFFT8(complex(y_fixed(i)),(loop <= N));
>>
Réponses (1)
Bharath Venkataraman
le 7 Fév 2018
Satish,
I am not able to reproduce the error. Here is my code.
close all
N = 8;
ddc_out = randi([0 1],8,1);
y_fixed = sfi(ddc_out,50,30);
Yf = zeros(1,3*N);
validOut = false(1,3*N);
for loop = 1:1:3*N
if (mod(loop, N) == 0)
i = N;
else
i = mod(loop, N);
end
[Yf(loop),validOut(loop)] = HDLFFT8(complex(y_fixed(i)),(loop <= N));
end
disp('Output of FFT: ');
Yf(validOut)
HDLFFT8.m:
function [yOut,validOut] = HDLFFT8(yIn,validIn)
%HDLFFT8
% Processes one sample of FFT data using the dsp.HDLFFT System object(TM)
% yIn is a fixed-point scalar or column vector.
% validIn is a logical scalar value.
% You can generate HDL code from this function.
persistent fft8;
if isempty(fft8)
fft8 = dsp.HDLFFT('FFTLength',8);
end
[yOut,validOut] = fft8(complex(yIn),validIn);
end
Bharath
3 commentaires
satish guruma
le 8 Fév 2018
Modifié(e) : satish guruma
le 8 Fév 2018
Walter Roberson
le 8 Fév 2018
By the way, you can simplify
if (mod(loop, N) == 0)
i = N;
else
i = mod(loop, N);
end
as
i = mod(loop-1, N) + 1;
Bharath Venkataraman
le 8 Fév 2018
Since you are already using fixed-point types, in Step 1 of Fixed point conversion, I suggest that you skip the conversion and use the datatypes as is.
Catégories
En savoir plus sur Transforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
