Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to use verilog PLI communicate with c by ncverilog compiler

Status
Not open for further replies.

u24c02

Advanced Member level 1
Joined
May 8, 2012
Messages
404
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
4,101
I would like to communicate c with verilog. I find the Verilog PLI can solve my problem. I read this website to learn

https://www.asic-world.com/verilog/pli1.html#How_it_Works*

But I still can't work even a printf function. I use ncverilog for verilog compiler. What I done is below. I can't have a successful compile for this. It says that it can't find the function. Can anyone tell me how to solve my problem. thanks =)


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
C code: hello.c
 
#include<stdio.h> void hello(){ printf("HELLO"); }
 
make library:
 
gcc hello.c -fPIC -shared -o hello.so
 
verilog code: test.v
 
module test(); initial begin $hello; $10 $finish; end endmodule
 
verilog command:
 
ncverilog test.v +access+r -v hello.so





Update

I've got an error.
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?
 
Last edited by a moderator:

It is a standard file included in ncverilog installation. Please include that path with -I option and it'll take care of this error.

bests.
Has
https://amzn.to/2tP6lBi
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top