1
votes

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?

1
Is the simulator part of you PATH variable? If not, you may want to add the -I (capital 'i') with a path to your simulator. Some simulators have the file in a lib or bin director.Greg
Also, some simulators come with there own gcc in the installation director, usually in the bin directory. If you compile with this gcc, it should have the path to vpi_user.h already included. If you need more help, you will need to update your question and tell use what simulator and OS you are using and if you are using an IDE.Greg
@Greg : I have updated itbural

1 Answers

2
votes

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