Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Errors when running Modelsim code

Status
Not open for further replies.

tarkyss

Full Member level 6
Joined
Aug 1, 2005
Messages
345
Helped
26
Reputation
52
Reaction score
9
Trophy points
1,298
Location
China
Activity points
4,187
about PLI

I used the example
http://www.asic-world.com/verilog/pli2.html#Modelsim
but when i run
gcc -c -g -I$MODEL/include pli_full_example_modelsim.c
there are a warning
hello_vpi_modelsim.c: In function `registerHelloSystfs':
hello_vpi_modelsim.c:9: warning: assignment from incompatible pointer type
then i run
ld -shared -E -o pli_full_example.sl pli_full_example_modelsim.o
it is said ther are no -shared and -E parameter, I check my ld, my ld has not the two parameters
then i dont user -shared and -E, used ld -o only
but it display
vpi_printf and vpi_register_systf are not defined
even i excute
cat /user/modelsim6.1a/modeltech/include/vpi_user.h >> hello_vpi.c
it still display
vpi_printf and vpi_register_systf are not defined
why
i try my own code, running gcc, there is no warning, but when running ld it cannot work yet,
in my code srand and rand function is used
so it said srand is not defined
 

xworld2008

Full Member level 4
Joined
Dec 13, 2002
Messages
231
Helped
18
Reputation
36
Reaction score
14
Trophy points
1,298
Activity points
1,801
about PLI

I think this isn't a error, it just can't find where is you standard pli.
vpi_register , vpi_register_sysf look like a standard task in VPI.
ld search library from ld_library env, if you VPI library don't in ld_library it can't find. so you need to check you ld_library and set it.
 

tarkyss

Full Member level 6
Joined
Aug 1, 2005
Messages
345
Helped
26
Reputation
52
Reaction score
9
Trophy points
1,298
Location
China
Activity points
4,187
about PLI

vpi_register , vpi_register_sysf are defined in the file that is included in my the pli_full_example_modelsim.c
and the path is correct
 

xworld2008

Full Member level 4
Joined
Dec 13, 2002
Messages
231
Helped
18
Reputation
36
Reaction score
14
Trophy points
1,298
Activity points
1,801
Re: about PLI

s_tfcell veriusertfs[] = {
{usertask, 0, 0, 0, counter_monitor, 0, "$counter_monitor" },
{0} // last entry must be 0
};
Does you c head file have the pli function struct like above ? you should add you function to the head file.
 

tarkyss

Full Member level 6
Joined
Aug 1, 2005
Messages
345
Helped
26
Reputation
52
Reaction score
9
Trophy points
1,298
Location
China
Activity points
4,187
Re: about PLI

no, there are not
but when i use another c program
#include <veriuser.h>
#include <acc_user.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void myrandom() {
time_t *nowtime;
time(nowtime);
srand((*nowtime));
printf("the time is %d\nthe random is %d\n", (*nowtime), rand()%128);
}
it saids printf srand rand time are all not defined?
 

aji_vlsi

Advanced Member level 2
Joined
Sep 10, 2004
Messages
646
Helped
84
Reputation
168
Reaction score
12
Trophy points
1,298
Location
Bangalore, India
Activity points
4,975
Re: about PLI

tarkyss said:
gcc -c -g -I$MODEL/include pli_full_example_modelsim.c
there are a warning
hello_vpi_modelsim.c: In function `registerHelloSystfs':
hello_vpi_modelsim.c:9: warning: assignment from incompatible pointer type
I recommend you fix that, simple google search should help, or use any standard C-book to get rid of this first.

then i run
ld -shared -E -o pli_full_example.sl pli_full_example_modelsim.o
it is said ther are no -shared and -E parameter, I check my ld, my ld has not the two parameters
Looks like this "ld" is the problem, which ld are you using? Is it same/compatible with your gcc version? -shared, -E should be part of "ld" for Modelsim to work well.

Which platform (Windows/Linux)?

Regards
Ajeetha
www.noveldv.com
 

tarkyss

Full Member level 6
Joined
Aug 1, 2005
Messages
345
Helped
26
Reputation
52
Reaction score
9
Trophy points
1,298
Location
China
Activity points
4,187
about PLI

aji_vlsi
my platform is SunOS5.8
gcc version 2.95.3 20010315
ld: Software Generation Utilities - Solaris-ELF(4.0)
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top