Fixed-point conversion error of dsphdl.FFT
I am trying to convert the below given matlab scripts to VHDL, but during fixed-point conversion it is showing that dsphdl.FFT is a non-tunable property and hence it cannot be converted as it needs a constant value. Is there any way around it as i need a code whose FFTLength can be changed as per need?
function [yOut, validOut] = HDLFFT(yIn, validIn, FFTLength)
persistent fftObj;
if isempty(fftObj)
fftObj = dsphdl.FFT(‘FFTLength’, FFTLength);
end
[yOut, validOut] = fftObj(yIn, validIn);
end
the above is the main function
N = 1024;
Fs = 800000;
number_of_samples = 0:N-1;
time = (0:N-1)*Fs;
signal = cos(2*pi*200000*time);
sampled_signal = cos(2*pi*200000*number_of_samples/Fs);
signal_fixed = fi(sampled_signal,0,32,24);
signal_zeros = zeros(1, N);
validOut = false(1,N);
for loop = 1:1:3*N
if (mod(loop, N) == 0)
i = N;
else
i = mod(loop, N);
end
[signal_zeros(loop),validOut(loop)] = HDLFFT128_final((signal_fixed(i)),(loop <= N),FFTLength);
end
signal_zeros = signal_zeros(validOut == 1);
fft_reverse = bitrevorder(signal_zeros);
disp(fft_reverse);
figure(1)
stem(0:N-1,fft_reverse)
title(‘FFT’)
the above is the testbenchI am trying to convert the below given matlab scripts to VHDL, but during fixed-point conversion it is showing that dsphdl.FFT is a non-tunable property and hence it cannot be converted as it needs a constant value. Is there any way around it as i need a code whose FFTLength can be changed as per need?
function [yOut, validOut] = HDLFFT(yIn, validIn, FFTLength)
persistent fftObj;
if isempty(fftObj)
fftObj = dsphdl.FFT(‘FFTLength’, FFTLength);
end
[yOut, validOut] = fftObj(yIn, validIn);
end
the above is the main function
N = 1024;
Fs = 800000;
number_of_samples = 0:N-1;
time = (0:N-1)*Fs;
signal = cos(2*pi*200000*time);
sampled_signal = cos(2*pi*200000*number_of_samples/Fs);
signal_fixed = fi(sampled_signal,0,32,24);
signal_zeros = zeros(1, N);
validOut = false(1,N);
for loop = 1:1:3*N
if (mod(loop, N) == 0)
i = N;
else
i = mod(loop, N);
end
[signal_zeros(loop),validOut(loop)] = HDLFFT128_final((signal_fixed(i)),(loop <= N),FFTLength);
end
signal_zeros = signal_zeros(validOut == 1);
fft_reverse = bitrevorder(signal_zeros);
disp(fft_reverse);
figure(1)
stem(0:N-1,fft_reverse)
title(‘FFT’)
the above is the testbench I am trying to convert the below given matlab scripts to VHDL, but during fixed-point conversion it is showing that dsphdl.FFT is a non-tunable property and hence it cannot be converted as it needs a constant value. Is there any way around it as i need a code whose FFTLength can be changed as per need?
function [yOut, validOut] = HDLFFT(yIn, validIn, FFTLength)
persistent fftObj;
if isempty(fftObj)
fftObj = dsphdl.FFT(‘FFTLength’, FFTLength);
end
[yOut, validOut] = fftObj(yIn, validIn);
end
the above is the main function
N = 1024;
Fs = 800000;
number_of_samples = 0:N-1;
time = (0:N-1)*Fs;
signal = cos(2*pi*200000*time);
sampled_signal = cos(2*pi*200000*number_of_samples/Fs);
signal_fixed = fi(sampled_signal,0,32,24);
signal_zeros = zeros(1, N);
validOut = false(1,N);
for loop = 1:1:3*N
if (mod(loop, N) == 0)
i = N;
else
i = mod(loop, N);
end
[signal_zeros(loop),validOut(loop)] = HDLFFT128_final((signal_fixed(i)),(loop <= N),FFTLength);
end
signal_zeros = signal_zeros(validOut == 1);
fft_reverse = bitrevorder(signal_zeros);
disp(fft_reverse);
figure(1)
stem(0:N-1,fft_reverse)
title(‘FFT’)
the above is the testbench fft, dsp, error, matlab, hdl, hdlcoder, dft MATLAB Answers — New Questions