Cosimulation wizard gives status : Error: Input #2 expected to be a cell array, was double instead.
5 次查看(过去 30 天)
显示 更早的评论
Hello! I am designing a Low pass FIR filter and generating HDL code in MATLAB. WHen I try to co-simulate with Vivado simulation, I get the following error while on the simulation tab.
Error: Input #2 expected to be a cell array, was double instead.
this is the only code I use :
Fs = 31.25e3; % Sampling Frequency in Hz
Fpass = 2e3; % Passband Frequency in Hz
Fstop = 8.8e3; % Stopband Frequency in Hz
Apass = 1; % Passband Ripple in dB
Astop = 90; % Stopband Attenuation in dB
fdes = fdesign.lowpass('Fp,Fst,Ap,Ast',...
Fpass, Fstop, Apass, Astop, Fs);
lpFilter = design(fdes,'equiripple', 'FilterStructure', 'dfsymfir', ...
'SystemObject', true);
>> nt_in = numerictype(1,12,11);
nt_out = nt_in;
lpFilter.FullPrecisionOverride = false;
lpFilter.CoefficientsDataType = 'Custom';
lpFilter.CustomCoefficientsDataType = numerictype(1,16,16);
lpFilter.OutputDataType = 'Custom';
lpFilter.CustomOutputDataType = nt_out;
% Check the response with fvtool.
fvtool(lpFilter,'Fs',Fs, 'Arithmetic', 'fixed');
>> workingdir = tempname;
% fully parallel (default)
generatehdl(lpFilter, 'Name', 'fullyparallel', ...
'TargetLanguage', 'VHDL', ...
'TargetDirectory', workingdir, ...
'InputDataType', nt_in);
### Starting VHDL code generation process for filter: fullyparallel
### Generating: C:\Users\lolal\AppData\Local\Temp\tp6fb33272_3372_4a5a_be33_ed1c71bdfffa\fullyparallel.vhd
### Starting generation of fullyparallel VHDL entity
### Starting generation of fullyparallel VHDL architecture
### Successful completion of VHDL code generation process for filter: fullyparallel
### HDL latency is 2 samples
symbol = {'1','2','3','4','5','6','7','8','9','*','0','#'};
lfg = [697 770 852 941]; % Low frequency group
hfg = [1209 1336 1477]; % High frequency group
% Generate a matrix containing all possible combinations of high and low
% frequencies, where each column represents one combination.
f = zeros(2,12);
for c=1:4
for r=1:3
f(:,3*(c-1)+r) = [lfg(c); hfg(r)];
end
end
Fs = 2000; % Sampling frequency 8 kHz
N = 800; % Tones of 100 ms
t = (0:N-1)/Fs; % 800 samples at Fs
pit = 2*pi*t;
tones = zeros(N,size(f,2));
for toneChoice=1:12
% Generate tone
tones(:,toneChoice) = sum(sin(f(:,toneChoice)*pit))';
end
% Taking the tone for digit '1' for test stimulus.
userstim = tones(:,1);
generatehdl(lpFilter, 'Name', 'fullyparallel',...
'GenerateHDLTestbench','on', ...
'TestBenchUserStimulus', userstim,...
'TargetLanguage', 'VHDL',...
'TargetDirectory', workingdir, ...
'InputDataType', nt_in);
### Starting VHDL code generation process for filter: fullyparallel
### Generating: C:\Users\lolal\AppData\Local\Temp\tp6fb33272_3372_4a5a_be33_ed1c71bdfffa\fullyparallel.vhd
### Starting generation of fullyparallel VHDL entity
### Starting generation of fullyparallel VHDL architecture
### Successful completion of VHDL code generation process for filter: fullyparallel
### HDL latency is 2 samples
### Starting generation of VHDL Test Bench.
### Generating input stimulus
### Done generating input stimulus; length 800 samples.
### Generating Test bench: C:\Users\lolal\AppData\Local\Temp\tp6fb33272_3372_4a5a_be33_ed1c71bdfffa\fullyparallel_tb.vhd
### Creating stimulus vectors ...
Done generating VHDL Test Bench.
could you help me understand what is the error I am getting and how to fix it ?
2 个评论
Saksham
2023-8-23
Hi,
I am able to run the code shared by you without encountering any error.
Please let me know the exact line and the function name for which you are encountering with the error.
Sincerely,
Saksham
Marc Erickson
2023-8-31
Hello,
I'm not sure I understand the title given the included code. Do you mean that you then took the resulting HDL code and tried to run it through the "cosimWizard" app? If so, can you clarify the inputs you gave for the Wizard steps? When you say "simulation tab" do you mean the "Simulation Options" step?
What version of MATLAB are you using? What version of Vivado Simulator?
Thanks,
Marc
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Code Generation Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!