User guide

19-23
Using the VCS / SystemC Cosimulation Interface
Example
Aassume that you want to instatiate the following SystemVerilog
module inside a SystemC module:
module vlog_top;
export "DPI" task task1;
import "DPI" context task task2(input int A);
export "DPI" function function3;
task task1(int n);
...
endtask
function int function3(int m);
...
endfunction // int
endmodule
You must do the folloing steps before you can elaborate the simulation
syscan -export_DPI task1
syscan -export_DPI function3
...
syscsim ...
Note that task2 is not specified because it is an import "DPI" task.
Use a Stubs File
An alternative approach is to use stubs located in a library. For each
export DPI function like my_export_DPI, create a C stub with no
arguments and store it in an archive which is linked by VCS:
file my_DPI_stubs.c :
#include <stdio.h>
#include <stdlib.h>
void my_export_DPI() {