How to use extended word length and fraction in HDLFFT?
古いコメントを表示
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));
>>
回答 (1 件)
Bharath Venkataraman
2018 年 2 月 7 日
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 件のコメント
satish guruma
2018 年 2 月 8 日
編集済み: satish guruma
2018 年 2 月 8 日
Walter Roberson
2018 年 2 月 8 日
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
2018 年 2 月 8 日
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.
カテゴリ
ヘルプ センター および File Exchange で Transforms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
