<s>
SystemVerilog	B-Language
DPI	I-Language
(	O
Direct	B-Language
Programming	I-Language
Interface	I-Language
)	O
is	O
an	O
interface	O
which	O
can	O
be	O
used	O
to	O
interface	O
SystemVerilog	B-Language
with	O
foreign	O
languages	O
.	O
</s>
<s>
These	O
foreign	O
languages	O
can	O
be	O
C	B-Language
,	O
C++	B-Language
,	O
SystemC	B-Language
as	O
well	O
as	O
others	O
.	O
</s>
<s>
DPIs	O
consist	O
of	O
two	O
layers	O
:	O
a	O
SystemVerilog	B-Language
layer	O
and	O
a	O
foreign	O
language	O
layer	O
.	O
</s>
<s>
Direct	B-Language
Programming	I-Language
Interface	I-Language
(	O
DPI	O
)	O
allows	O
direct	O
inter	O
language	O
function	O
calls	O
between	O
the	O
SystemVerilog	B-Language
and	O
Foreign	O
language	O
.	O
</s>
<s>
The	O
functions	O
implemented	O
in	O
Foreign	O
language	O
can	O
be	O
called	O
from	O
SystemVerilog	B-Language
and	O
such	O
functions	O
are	O
called	O
Import	O
functions	O
.	O
</s>
<s>
Similarly	O
,	O
functions	O
implemented	O
in	O
SystemVerilog	B-Language
can	O
be	O
called	O
from	O
Foreign	O
language	O
(	O
C/C	O
++	O
or	O
System	O
C	B-Language
)	O
;	O
such	O
functions	O
are	O
called	O
Export	O
functions	O
.	O
</s>
<s>
1	O
)	O
Function	O
Import	O
:	O
-	O
A	O
function	O
implemented	O
in	O
Foreign	O
language	O
can	O
be	O
used	O
in	O
SystemVerilog	B-Language
by	O
importing	O
it	O
.	O
</s>
<s>
A	O
Foreign	O
language	O
function	O
used	O
in	O
SystemVerilog	B-Language
is	O
called	O
Imported	O
function	O
.	O
</s>
<s>
An	O
Imported	O
function	O
shall	O
not	O
free	O
the	O
memory	O
allocated	O
by	O
SystemVerilog	B-Language
code	O
nor	O
expect	O
SystemVerilog	B-Language
code	O
to	O
free	O
memory	O
allocated	O
by	O
Foreign	O
code	O
or	O
(	O
Foreign	O
Compiler	O
)	O
.	O
</s>
<s>
An	O
Imported	O
task	O
or	O
function	O
which	O
calls	O
"	O
Exported	O
"	O
tasks	O
or	O
functions	O
or	O
accesses	O
SystemVerilog	B-Language
data	O
objects	O
other	O
than	O
its	O
actual	O
arguments	O
is	O
called	O
Context	O
task	O
or	O
function	O
.	O
</s>
<s>
1	O
)	O
A	O
Context	O
Imported	O
task	O
or	O
function	O
can	O
access	O
(	O
read	O
or	O
write	O
)	O
any	O
SystemVerilog	B-Language
data	O
object	O
by	O
calling	O
(	O
PLI/VPI	O
)	O
or	O
by	O
calling	O
Export	O
task	O
or	O
function	O
.	O
</s>
<s>
Therefore	O
,	O
a	O
call	O
to	O
Context	O
task	O
or	O
function	O
is	O
a	O
barrier	O
for	O
SystemVerilog	B-Language
compiler	O
optimization	O
.	O
</s>
<s>
SystemVerilog	B-Language
code	O
can	O
call	O
Unix	O
functions	O
directly	O
by	O
importing	O
them	O
,	O
with	O
no	O
need	O
for	O
a	O
wrapper	O
.	O
</s>
