In reply to chr_sue:
Hello Christoph,
Actually that limitation for me only happens when using Matlab as a predictor. If I use my SV predictor nothing happens and everything runs fine.
I have tried to use the example to incorporate the DPI into my project but it does not work for me.
If the original Makefile is:
####################################################################################
Makefile for MATLAB integration example
Note: QUESTA_SIM needs to be set to the Questa Installation Path
MATLAB needs to be set to MATLAB Installation Path
This is configured for 64bit mode. Change as needed for 32bit mode
VLOG_ARGS :=
VSIM_ARGS = -voptargs=+acc
all: simulate_sv simulate_matlab_dut simulate_matlab_sb simulate_matlab_sb_qmw
clean:
rm -rf work/ transcript *.wlf *.so *.o *.log
compile_sv_tb: create_work
vlog +incdir+sv/txn_pkg sv/txn_pkg/txn_pkg.svh
vlog +incdir+sv/agent_pkg sv/agent_pkg/simple_agent_pkg.svh
vlog +incdir+sv/sequence_pkg sv/sequence_pkg/sequence_pkg.svh
vlog ${VLOG_ARGS} +incdir+sv/environment sv/environment/env_pkg.svh
vlog +incdir+sv/test_pkg sv/test_pkg/test_pkg.svh
compile_dpi:
# Generate DPI header file and compile/link DPI code
vlog MATLAB/matlab_dpi_pkg.sv
gcc -O4 -c -fPIC -Wall -I$(MATLAB)/extern/include -I./MATLAB -I$(QUESTA_HOME)/include -o matlab_dpi.o ./MATLAB/matlab_dpi.c
gcc -shared -Wl,-Bsymbolic -Wl,-export-dynamic -L$(MATLAB)/bin/glnxa64 -leng -lmx -o matlab_dpi.so matlab_dpi.o
create_work:
vlib work
optimize:
simulate_sv: clean compile_sv_tb
@echo “Simulating SV only environment”
vlog sv/testbench.sv
vsim +UVM_TESTNAME=test $(VSIM_ARGS) -suppress 3770 testbench
simulate_matlab_sb: clean compile_sv_tb compile_dpi
@echo “Simulating with MATLAB Scoreboard”
vlog sv/testbench.sv
vsim -64 +UVM_TESTNAME=test_matlab_scoreboard $(VSIM_ARGS) -sv_lib matlab_dpi testbench
compile_qmw:
vlog qmw/qmw_sv/questa/qmw_hdl2matlab.sv
vlog qmw/qmw_sv/questa/qmw_post_sim.sv
$(eval VLOG_ARGS := +define+QMW)
simulate_matlab_sb_qmw: clean compile_qmw compile_sv_tb
@echo “Simulating with MATLAB Scoreboard using qmw”
vlog sv/testbench.sv
matlab -nosplash -r ‘run MATLAB/start.m’ &
sleep 10
vsim -64 +UVM_TESTNAME=test_matlab_scoreboard $(VSIM_ARGS) -sv_lib qmw/qmw_sv/questa/qmw_client_64 testbench -do “qmw_demo.do”
post_sim_sb_qmw:
matlab -nosplash -r ‘run MATLAB/start.m’ &
sleep 10
vsim -voptargs=“+acc” qmw_post_sim -sv_lib qmw/qmw_sv/questa/qmw_client_64 -do “qmw_post_sim.do”
simulate_matlab_dut: clean compile_sv_tb
@echo “Simulating with MATLAB DUT”
vlog +define+MATLAB sv/testbench.sv
matlab -nosplash -desktop -logfile matlab.log -r modelsim_matlab &
# Allow MATLAB to start
sleep 10
vsim -64 +UVM_TESTNAME=test (VSIM_ARGS) -suppress 3770 testbench \
-foreign "matlabclient (MATLAB)/toolbox/edalink/extensions/modelsim/linux64/liblfmhdlc_tmwgcc.so"
-do scripts/matlab.do
.PHONY: all clean
####################################################################################
When I write:
make simulate_matlab_sb, I get the following error:
** Error: sv/environment/env_pkg.svh(36): Could not find the package (matlab_dpi_pkg). Design read will continue, but expect a cascade of errors after this failure. Furthermore if you experience a vopt-7 error immediately before this error then please check the package names or the library search paths on the command line.
make: *** [compile_sv_tb] Error 2
And this has to be because this DPI is imported in the env_pkg, but it is not correctly compiled beforehand.
In the dependencies of the Makefile says:
simulate_matlab_sb: clean compile_sv_tb compile_dpi, therefore the DPI is compile after the SV testbench. If I swap the order (also creating the work directory first (create work):
simulate_matlab_sb: clean create_work compile_dpi compile_sv_tb
I get another error:
gcc -O4 -c -fPIC -Wall -I/extern/include -I./MATLAB -I/include -o matlab_dpi.o ./MATLAB/matlab_dpi.c
./MATLAB/matlab_dpi.c:9:20: error: engine.h: No such file or directory
./MATLAB/matlab_dpi.c:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
./MATLAB/matlab_dpi.c:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
./MATLAB/matlab_dpi.c: In function ‘start_matlab’:
./MATLAB/matlab_dpi.c:18: error: ‘ep’ undeclared (first use in this function)
./MATLAB/matlab_dpi.c:18: error: (Each undeclared identifier is reported only once
./MATLAB/matlab_dpi.c:18: error: for each function it appears in.)
./MATLAB/matlab_dpi.c:18: warning: implicit declaration of function ‘engOpen’
./MATLAB/matlab_dpi.c:22: warning: implicit declaration of function ‘engOutputBuffer’
./MATLAB/matlab_dpi.c: In function ‘send_matlab_cmd’:
./MATLAB/matlab_dpi.c:28: warning: implicit declaration of function ‘engEvalString’
./MATLAB/matlab_dpi.c:28: error: ‘ep’ undeclared (first use in this function)
./MATLAB/matlab_dpi.c: In function ‘stop_matlab’:
./MATLAB/matlab_dpi.c:38: warning: implicit declaration of function ‘engClose’
./MATLAB/matlab_dpi.c:38: error: ‘ep’ undeclared (first use in this function)
make: *** [compile_dpi] Error 1
I do not know if it is just me who has the problems with the makefile in the matlab_uvm_example or the files are just wrong. I got the files from:
https://verificationacademy.com/cookbook/matlab/integration
Thank you,
Antonio