Modeltech的使用方法

来源:百度知道 编辑:UC知道 时间:2024/06/17 15:31:47
就是modelsim

1.hello.c文件内容
#include
#include "veriuser.h"
static PLI_INT32 hello()
{
printf("Hi there\n");
return 0;
}
s_tfcell veriusertfs[] = {
{usertask, 0, 0, 0, hello, 0, "$hello"},
{0} /* last entry must be 0 */
};

2.hello.v文件内容
module hello;
initial
begin
$hello;
end
endmodule

3.在VC(命令提示行下)下编译hello.c
3.1 cl –c –I
hello.c // dir为绝对路径或者进入hello.c所在的目录 用 . 代替
3.2 link –dll –export:veriusertfs hello.obj /out:hello.dll
3.3 将生成的hello.dll文件拷贝到D:\Program Files\Modeltech_5.7e\win32(modelsim的dll文件夹)

4. 在modelsim下命令
4.1 vsim –c –pli hello.dll hello
4.2 run –all // 如果没有显示 再试vsim hello(因为有可能已经print了,但没有显示而已)

说明:可以参考modelsim的帮助里的user’s manual中的pli/vpi一章