2011年5月14日 星期六

DPI再了解(十三)

Cadence 使用export 在CPP的模式

參考例如下
#include "svdpi.h"
#include "veriuser.h"

extern "C" {

extern void ex_task();

void import_task() {
io_printf("C: Before calling export function\n");
ex_task();
io_printf("C: After calling export function\n");
}
}


`timescale 1ns/100ps
module main();
export "DPI-C" ex_task = function export_task;
import "DPI-C" context function void import_task();

function export_task();
$display("SV: Entered the export function, wait for some time: %0d", $time);
endfunction

initial begin
$display("SV: Before calling import function %0d", $time);
#1;
import_task();
#1;
$display("SV:After calling function %0d", $time);
end

endmodule

沒有留言: