24.03.2013 Views

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

UM-572 D - Verilog PLI / VPI / DPI<br />

64-bit HP platform<br />

<strong>ModelSim</strong> <strong>SE</strong> User’s <strong>Manual</strong><br />

cc compiler<br />

64-bit HP for IA64 platform<br />

32-bit IBM RS/6000 platform<br />

cc -v +DD64 -O -I/modeltech/include -c app.c<br />

ld -b -o app.sl app.o -lc<br />

cc compiler (/opt/ansic/bin/cc, /usr/ccs/bin/ld)<br />

cc -c +DD64 -I//modeltech/include app.c<br />

ld -b -o app.sl app.o<br />

If your PLI/VPI/DPI application requires a user or vendor-supplied C library, or an<br />

additional system library, you will need to specify that library when you link your PLI/VPI/<br />

DPI application. For example, to use the system math library, specify '-lm' to the 'ld'<br />

comm<strong>and</strong>:<br />

cc -c +DD64 -I//modeltech/include math_app.c<br />

ld -b -o math_app.sl math_app.o -lm<br />

<strong>ModelSim</strong> loads shared libraries on the IBM RS/6000 workstation. The shared library must<br />

import <strong>ModelSim</strong>'s PLI/VPI/DPI symbols, <strong>and</strong> it must export the PLI or VPI application’s<br />

initialization function or table. <strong>ModelSim</strong>'s export file is located in the <strong>ModelSim</strong><br />

installation directory in rs6000/mti_exports.<br />

If your PLI/VPI/DPI application uses anything from a system library, you’ll need to specify<br />

that library when you link your PLI/VPI/DPI application. For example, to use the st<strong>and</strong>ard<br />

C library, specify ‘-lc’ to the ‘ld’ comm<strong>and</strong>. The resulting object must be marked as shared<br />

reentrant using these gcc or cc compiler comm<strong>and</strong>s for AIX 4.x:<br />

gcc compiler<br />

gcc -c -I//modeltech/include app.c<br />

ld -o app.sl app.o -bE:app.exp \<br />

-bI://modeltech/rs6000/mti_exports -bM:SRE -bnoentry -lc<br />

cc compiler<br />

cc -c -I//modeltech/include app.c<br />

ld -o app.sl app.o -bE:app.exp \<br />

-bI://modeltech/rs6000/mti_exports -bM:SRE -bnoentry -lc<br />

The app.exp file must export the PLI/VPI initialization function or table. For the PLI, the<br />

exported symbol should be "init_usertfs". Alternatively, if there is no init_usertfs function,<br />

then the exported symbol should be "veriusertfs". For the VPI, the exported symbol should<br />

be "vlog_startup_routines". These requirements ensure that the appropriate symbol is<br />

exported, <strong>and</strong> thus <strong>ModelSim</strong> can find the symbol when it dynamically loads the shared<br />

object.<br />

When using AIX 4.3 in 32-bit mode, you must add the -DU<strong>SE</strong>_INTTYPES switch to the<br />

compile comm<strong>and</strong> lines. This switch prevents a name conflict that occurs between<br />

inttypes.h <strong>and</strong> mti.h.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!