Issue to begin TestBench generation.

28 vues (au cours des 30 derniers jours)
satish morigiri
satish morigiri le 26 Jan 2018
Commenté : satish morigiri le 31 Jan 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?

Réponse acceptée

Kiran Kintali
Kiran Kintali le 26 Jan 2018
What version of MATLAB are you using? I was not able to reproduce the issue. Please see the attached message.
  1 commentaire
satish morigiri
satish morigiri le 31 Jan 2018
I've resolved this case from my mistake. Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Code Generation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by