DPI is SystemVerilog's standard mechanism for calling C functions from SV code and calling SV functions back from C, with plain function-call syntax on both sides.
Direction | SV construct | C side |
|---|---|---|
SV calls C |
| Plain C function in a shared object |
C calls SV |
| Exported SV function, called with a valid scope |
Lesson | What it covers |
|---|---|
Import syntax, pure and context qualifiers, type mapping, checksum round trip. | |
Exports, scope handles, and the event callback pattern. | |
Open arrays, packed structs, strings, and ownership rules. | |
Wrapper classes, versioning, build flow, threading, and debug. |
No. The C implementation is the single source of truth. Import it through DPI-C and keep the testbench free of a second copy that can drift.