bural
bural

Reputation: 61

how to make a VPI in verilog?

When I run across on web, I found this question how to use verilog PLI communicate with c by ncverilog compiler

And I followed the last answer but It does not work. One of the error is hello_vpi.c : "vpi_user.h No such file or directory" hello_vpi.c 12 : error 's_vpi_systf_data'undeclared(first use in this function) ....

What should I for solving?

update

@Greg :: My simulator is Incisive15.10.002 and Linux6.0.

I have got a problems which is when I ran like this gcc hello_vpi.c -fPIC -shared -o hello_vpi.so -I /cadence/Incisive/Incisive15.10.002/tools.lnx86/include then I have got some message as following.

hello_vpi.c : Infunction 'register_hello' :
hello_vpi.c :16: warning: assignment from incompatible pointer type.

And I have got some error messages as following when I run this command ncverilog test.v +access+r -v hello_vpi.so

...
*W.LIBNOU : Library "hello_vpi.so given but not used.
...
$hello;
unrecognized system task or function
...
libvpi.so cannot open shaed object file: No such file directory or file is not valid ELFCLASS64 library
...
*E, MSSYSTF : user defined system task or function( $hello) registered during elaboration and used with in the simulation has not been registered during simulation.

I have no idea what am I suppose to do?

Upvotes: 1

Views: 3241

Answers (1)

Greg
Greg

Reputation: 19114

Remove the spaces after -I

gcc hello_vpi.c -fPIC -shared -o hello_vpi.so -I/cadence/Incisive/Incisive15.10.002/tools.lnx86/include

You can also try: (note: I'm guessing the path the the gcc that comes with Incisive)

/cadence/Incisive/Incisive15.10.002/tools.lnx86/bin/gcc hello_vpi.c -fPIC -shared -o hello_vpi.so

If ncverilog test.v +access+r -v hello_vpi.so doesn't work, try:

ncverilog test.v +access+r -loadvpi ./hello_vpi.so:register_hello

Upvotes: 2

Related Questions