How to make system call through systemverilog

hi,
I am using OVM for verification of SoC. I want to make system call through systemverilog.
I intend to call matlab through system call like,
system(“MATLAB…”); .

  1. Can someone suggest me how should I do that??

I thought using Direct Programming Interface (DPI) , I can make system call in C. But I could not compile systemverilog and C code together.

  1. Can someone give an example of DPI with steps to compile both ie. systemverilog and C code together so that they are linked together.

I even donot know if I can make system call using C through DPI.
3. Can someone confirm that?

Thanks in advance.

Why not simply use

$system ("unix_cmd_to_be_invoked??");

On DPI examples - check out your tool install dir, there are usually several examples. If you still have issues, post code here, someone may be able to help.

Regards
Srini

  1. Can someone give an example of DPI with steps to compile both ie. systemverilog and C code together so that they are linked together.

If you are using Questasim use the following commands.
vlog dut.sv (compile your Systemverilog file)
gcc -shared -Bsymbolic -o imports.so imports.c (Compiles C code)
vsim -sv_lib imports top -do <do_file> (Invoke the simulation)

For detailed description go through the help in questasim and refer “questasim_afv_user.pdf” document and Section Appendix D.

  1. Can someone give an example of DPI with steps to compile both ie. systemverilog and C code together so that they are linked together.

There are some good examples how to use DPI inside Systemverilog in the following link. U may find it useful.
http://www.testbench.in/DP_00_INDEX.html

Hi,
I would like to know if there is a way to catch the return value of the system call. (error indication)
Thanks

In reply to Goldy L:

If you are referring to $system, it returns the value of the call to
system()
.