Reuse MATLAB Functions in UVM Environments with Automatic SystemVerilog DPI Component Generation - matlab

I have a problem simulating test benches containing DPI-C imports.
Here is a method for reusing MATLAB functional model of the DUT in a SystemVerilog testbench. I downloaded all the code for this example from this address on Mathworks. Then I successfully ran 'build_dpi.m' in MATLAB 2022a with no warnings/errors. Finally, when I run sim.do in Questasim-64 2021.1, I get the following list of warnings:
# ** Warning: (vsim-3770) Failed to find user specified function 'DPI_fft_checker_initialize' in DPI precompiled library search list ".\codegen/dll/fft_checker/libfft_checker_dpi.dll .\codegen/dll/gen_wave/libgen_wave_dpi.dll C:/questasim64_2021.1/uvm-1.1d\win64\uvm_dpi.dll ".
# ** Warning: (vsim-3770) Failed to find user specified function 'DPI_fft_checker' in DPI precompiled library search list ".\codegen/dll/fft_checker/libfft_checker_dpi.dll .\codegen/dll/gen_wave/libgen_wave_dpi.dll C:/questasim64_2021.1/uvm-1.1d\win64\uvm_dpi.dll ".
# ** Warning: (vsim-3770) Failed to find user specified function 'DPI_gen_wave_initialize' in DPI precompiled library search list ".\codegen/dll/fft_checker/libfft_checker_dpi.dll .\codegen/dll/gen_wave/libgen_wave_dpi.dll C:/questasim64_2021.1/uvm-1.1d\win64\uvm_dpi.dll ".
# ** Warning: (vsim-3770) Failed to find user specified function 'DPI_gen_wave' in DPI precompiled library search list ".\codegen/dll/fft_checker/libfft_checker_dpi.dll .\codegen/dll/gen_wave/libgen_wave_dpi.dll C:/questasim64_2021.1/uvm-1.1d\win64\uvm_dpi.dll ".
Finally, the simulation is aborted with the following error:
** Fatal: (vsim-160) fft_pkg.sv(120): Null foreign function pointer encountered when calling 'DPI_fft_checker_initialize'
I would highly appreciate some guidance on how to solve this problem. I'm working on integration of my MATLAB models into my SV simulations and I'm stuck here with this problem.
Thank you very much

Related

How can I locate all occurrences of model files with the name sfunction_name?

i am using waijung blockset to programm a stmµc. And i wanted to use CAN-Bus blocks but i am facing the following error:
The build process will terminate as a result.
Caused by:
Error, a block diagram was specified in S-function 'stm32f4_can/CAN Setup'. Please make sure your S-function name is not a Simulink model or the name of the current model. You can use the Matlab command 'which -all sfunction_name' to locate all occurrences of model files with the name sfunction_name
hereby i did not insatll MinGW-w64 C/C++ compiler yet. I also tried in comand window >> which -all sfunction_name
'sfunction_name' not found.

"Undefined function or variable" loadAudioPlugin

I am trying to run this simple command on Matlab to load a VST:
hostedPlugin = loadAudioPlugin(pluginpath)
However, I am getting the following error: Undefined function or variable 'loadAudioPlugin'.
What's wrong? I can't seem to figure it out... This is the output I get when I type the "ver" command:
...
Audio System Toolbox Version 1.2 (R2017a)
...
The Audio system toolbox seems to be installed correctly. And the path is set correctly apparently, I can see the "loadAudioPlugin.p" file in the compiled folder.
Any ideas why Matlab says the loadAudioPlugin is not a function??

POSTGRESQL - ERROR: could not load library pgafis.so : undefined symbol: lfsparms_V2

I'm using PGAFIS library for fingerprint matching. For this i have installed postgresql and having some user defined c functions.
PGAFIS contain makefile, .control file, sql and unpacked sql file everything
I have compiled and pgafis.so file for the same and everyfile is on right location.
In my PGAdmin-III when i run CREATE EXTENSION pgafis it gives me following error:
ERROR: could not load library "/usr/lib/postgresql/9.4/lib/pgafis.so": /usr/lib/postgresql/9.4/lib/pgafis.so: undefined symbol: lfsparms_V2
SQL state: XX000
Please help. Thanks in advance
(This is a follow-up from Postgresql user defined c function issues)
I expect you forgot to link to the required library.
Try adding
PG_LIBS = -lmindtct
or whatever. If it's not on the default linker path you'll need to need to add -L/path/to/the/containing/directory to PG_CPPFLAGS too.

CMake add_custom_command inside of a macro

My CMake code looks like the following:
macro(macro_name target_name)
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND MyCommand)
endmacro()
Running this I get the following message:
CMake Warning (dev) at ... (add_custom_command):
Policy CMP0040 is not set: The target in the TARGET signature of
add_custom_command() must exist. Run "cmake --help-policy CMP0040" for
policy details. Use the cmake_policy command to set the policy and
suppress this warning.
The target name "target_name" is unknown in this context.
The same code inside of a function works great but I need macro for other things.
CMake policy (http://www.cmake.org/cmake/help/v3.0/policy/CMP0040.html) suggests just ignoring of this warning (and ignoring of adding of postbuild step at all) or treating it as error depending on the settings.
This: http://www.cmake.org/cmake/help/v3.0/command/macro.html states that parameters behavior in macros is different from one in functions.
How do I properly refer to macro parameters to get this work?
I've managed to figure out the reason: in my case wrong directory was used as ${CMAKE_CURRENT_BINARY_DIR} inside of the macro. Fixing paths allowed to get desirable result

Model Error: It appears that build process was unable to locate some Utility(e.g. make,compiler,linker, etc.)

I am new to S-Functions and Real TIme WorkShop. The S-Function has been created using an Embedded Matlab Function. The S-Function Works fine, but when i try to build the same, i get the following error report:
It appears that the build process was unable to locate some utility (e.g. make, compiler, linker, etc.). Please verify your path and tool environment variables are correct. You should be able to execute the make command: .\Radius_S_func2.bat at an MS DOS Command Prompt in the directory: C:\Users\skaushik\Desktop\Matlab Models\WIP\TESTs\Sfunc_2\Radius_S_func2_Source Currently, this generates the following error:
C:\Users\skaushik\Desktop\Matlab Models\WIP\TESTs\Sfunc_2\Radius_S_func2_Source>set MATLAB=C:\MATLAB\R2010b
C:\Users\skaushik\Desktop\Matlab Models\WIP\TESTs\Sfunc_2\Radius_S_func2_Source>.......\u_Utils\Build\make -f Radius_S_func2.mk GENERATE_REPORT=0 INCLUDE_MDL_TERMINATE_FCN=0 COMBINE_OUTPUT_UPDATE_FCNS=1 MAT_FILE=0 MULTI_INSTANCE_CODE=0 INTEGER_CODE=0 PORTABLE_WORDSIZES=0 GENERATE_ERT_S_FUNCTION=0 GENERATE_ASAP2=0 EXT_MODE=0 EXTMODE_STATIC_ALLOC=0 EXTMODE_STATIC_ALLOC_SIZE=1000000 EXTMODE_TRANSPORT=0 TMW_EXTMODE_TESTING=0 MODELLIB=Radius_S_func2lib.lib RELATIVE_PATH_TO_ANCHOR=.. MODELREF_TARGET_TYPE=NONE OPTS="-DRT -DUSE_RTMODEL -DERT" The system cannot find the path specified.
PLease guide me how to understand the error, so i can take care of it myself.
Thank you!!
Solution: The build target was not specified therefore matlab gave the above mentioned error. To resolve this one should specify the build environment for a specific target.