Issue to begin TestBench generation.

2 次查看(过去 30 天)
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?

采纳的回答

Kiran Kintali
Kiran Kintali 2018-1-26
What version of MATLAB are you using? I was not able to reproduce the issue. Please see the attached message.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by