如何编译C代码以与PLI中的ncverilog进行通信

时间:2018-03-20 05:32:24

标签: c linux verilog simulation

我现在正在编译C代码以与ncverilog链接。 但是我在编译期间收到编译警告,我不明白为什么会这样。

的hello.c

 1 #include<stdio.h>
 2 #include"./include/vpi_user.h"
 3 void hello(){
 4 printf("hello world!\n");
 5 }
 6 
 7 
 8 void register_hello(){
 9 
 10    s_vpi_systf_data data;
 11     data.type      = vpiSysTask; //vpiSysFunc;
 12 data.sysfunctype = vpiSysFuncInt; // return type if type is Func
 13 data.tfname    = "$hello";
 14 data.calltf=hello;
 15 data.compiletf = 0;
 16 data.sizetf    = 0;
 17 data.user_data = 0;
 18  vpi_register_systf(&data);
 19 }

vpi.c

23 #include <stdarg.h>
24 #include "vpi_user.h"
25 #include "vpi_user_cds.h"
26 
27 
28 extern void register_hello();
29 
30 void (*vlog_startup_routines[])() =
31 {
32  register_hello,0
33 };
34 
35 /* ---------------------------------------------------------------

36 The following is an example of what should be included in this 
file:
37 
38 extern void setup_my_callbacks(); <-- Add a declaration for your 
routine.
39 
40 void (*vlog_startup_routines[])() = 
41 {
42     $*** add user entries here ***$
43 
44   setup_my_callbacks, <-- Add your routine to the table. 
45         hello_re
46   0 $*** final entry must be 0 ***$
47 
48 };
49 -----------------------------------------------------------------
- */
50 
51 void (*vlog_startup_routines[VPI_MAXARRAY])() =
52 {
53   0 /*** final entry must be 0 ***/
54 };

Commnad

gcc hello.c -fPIC -shared -o hello_vpi.so

错误消息

hello.c:14:12: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]

data.calltf =你好;

0 个答案:

没有答案