Digital Signal Processing Reference
In-Depth Information
class atm extends frame;
frame gateway_frame [10];
Frames of various types can be declared and assigned to the array:
ethernet frame_e = new;
atm frame_a = new;
gateway_frame [0] = frame_e;
gateway_frame [1] = frame_a;
The statement
gateway_frame [1].send();
makes the compiler finds out which frame will be sent.
2.9.12 Direct Programming Interface (DPI)
SV can directly access a function written in C using a DPI. Similarly a function or task written in SV
can be exported to a C program. SVmakes interworking of C and SV code very trivial and there is no
need to use PLI. The C functions in SVare then called using import directive, while functions and
tasks of SV to be used in a C function are accessible by using export DPI declaration. The illustration
here shows DPI use:
// top-level module that instantiates a module that calls a C function
module top_level();
moduleCall_C Call_C (rst, clk, in1, in2, out1, ...;
.
.
.
endmodule
The instantiated module Call_C of type moduleCall_C uses an import directive for
interfacing with a C program:
module moduleCall_C(rst, clk, in1, in2, out1,...);
.
.
import "DPI-C" context task fuctionC (....);
always@(posedge clk)
functionC (rst,in1, in2, out1,....);
export "DPI-C" task CallVeri1;
export "DPI-C" task CallVeri2;
task CallVeri1 (input int addr1, output int data1);
.
.
endtask
Search WWH ::




Custom Search