how to solve coder.internal.Float2FixedConverter.runTestBenchToLogDataNew ?
4 views (last 30 days)
Show older comments
Facundo Picco
on 17 Aug 2021
Answered: Marc Erickson
on 18 Aug 2021
Hello,
I am trying to autogenerate system verilog code out of matlab code using the HDL Verifier and Matlab Coder toolboxes in Matlab 2021a, on a Centos7 machine. I am using the example in https://www.mathworks.com/help/hdlverifier/ug/dpi-component-generation-in-matlab.html without any modification.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%file fun.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y = fun(x)
%#codegen
y = x * 2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%file fun_tb.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function sample=fun_tb
% Testbench should not require input, however you can give an output.
% Define a test vector
tVecIn = [1,2,3,4,5];
% Exercise fun.m and plot results to make sure function is working correctly
tVecOut = arrayfun(@(in) fun(in),tVecIn);
plot(tVecIn,tVecOut);
grid on;
% Get my sample input to use it with function dpigen.
sample = tVecIn(1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%file fun_dpigen.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sample = 1;
dpigen fun -args sample -testbench fun_tb
When I run the script fun_dpigen.m I get the following error:
### Generating DPI-C Wrapper fun_dpi.c
### Generating DPI-C Wrapper header file fun_dpi.h
### Generating SystemVerilog module package fun_dpi_pkg.sv
### Generating SystemVerilog module fun_dpi.sv
### Generating makefiles for: fun_dpi
### Compiling the DPI Component
Code generation successful.
### Generating SystemVerilog test bench fun_tb.sv
Error using dpigenerator_generateTestBench
Unable to generate testbench for SystemVerilog DPI component. Please refer to the examples for guidelines on
how to write the MATLAB testbench.
Error in dpigen
Error in fun_dpigen (line 2)
dpigen fun -args sample -testbench fun_tb
Caused by:
Unable to resolve the name coder.internal.Float2FixedConverter.runTestBenchToLogDataNew.
I add here the compiler information
cc = mex.getCompilerConfigurations
>> cc(1)
ans =
CompilerConfiguration with properties:
Name: 'g++'
Manufacturer: 'GNU'
Language: 'C++'
Version: '4.8.5'
Location: '/usr/bin/g++'
ShortName: 'g++'
Priority: 'A'
Details: [1×1 mex.CompilerConfigurationDetails]
LinkerName: '/usr/bin/g++'
LinkerVersion: ''
MexOpt: '/tools/external/matlab/R2021a/bin/glnxa64/mexopts/g++_glnxa64.xml'
>> cc(2)
ans =
CompilerConfiguration with properties:
Name: 'gcc'
Manufacturer: 'GNU'
Language: 'C'
Version: '4.8.5'
Location: '/usr/bin/gcc'
ShortName: 'gcc'
Priority: 'A'
Details: [1×1 mex.CompilerConfigurationDetails]
LinkerName: ''
LinkerVersion: ''
MexOpt: '/tools/external/matlab/R2021a/bin/glnxa64/mexopts/gcc_glnxa64.xml'
>> cc(3)
ans =
CompilerConfiguration with properties:
Name: 'gfortran6-'
Manufacturer: 'GNU'
Language: 'FORTRAN'
Version: '4.8.5'
Location: '/usr/bin'
ShortName: 'gfortran6-'
Priority: 'B'
Details: [1×1 mex.CompilerConfigurationDetails]
LinkerName: ''
LinkerVersion: ''
MexOpt: '/tools/external/matlab/R2021a/bin/glnxa64/mexopts/gfortran.xml'
Can you advise on what needs to be fixed in my system in order to solve this error?
0 Comments
Accepted Answer
Marc Erickson
on 18 Aug 2021
The cited package, Float2FixedConverter, is available through the Fixed Point Designer or HDL Coder products.
To use the SystemVerilog DPI Test Bench feature you will have to have one of those two products installed.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!