Issue to begin TestBench generation.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
satish morigiri
il 26 Gen 2018
Commentato: satish morigiri
il 31 Gen 2018
Hi,
I'm trying to generate TestBench from 'Verify with HDL Test Bench' in Workflow Advisor.
the code is like this.
- test.m
clear all
clc
N = 128;
Fs = 40;
t = (0:N-1)'/Fs;
x = sin(2*pi*15*t) + 0.75*cos(2*pi*10*t);
y = x + .25*randn(size(x));
y_fixed = sfi(y,32,24);
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)] = HDLFFT128(complex(y_fixed(i)),(loop <= N));
end
Yf = Yf(validOut == 1);
Yr = bitrevorder(Yf);
plot(Fs/2*linspace(0,1,N/2), 2*abs(Yr(1:N/2)/N))
title('Single-Sided Amplitude Spectrum of Noisy Signal y(t)')
xlabel('Frequency (Hz)')
ylabel('Output of FFT (f)')
The below is HDLFFT128 function.
- HDLFFT128.m
% function [yOut,validOut] = HDLFFT128(yIn,validIn)
% %HDLFFT128
% % 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 fft128;
% if isempty(fft128)
% fft128 = dsp.HDLFFT('FFTLength',128);
% end
% [yOut,validOut] = fft128(yIn,validIn);
% end
function [yOut,validOut] = HDLFFT128(yIn,validIn)
%HDLFFT128
% 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 fft128;
if isempty(fft128)
fft128 = dsp.HDLFFT('FFTLength',128);
end
[yOut,validOut] = fft128(yIn,validIn);
end
The problem is that I come across the below errors when I run the generate testbench.
Would you please how do I resolve this problem?
0 Commenti
Risposta accettata
Kiran Kintali
il 26 Gen 2018
What version of MATLAB are you using? I was not able to reproduce the issue. Please see the attached message.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!