Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


PLI example

The following example is a trivial, but complete PLI application.

hello.c: 
	#include "veriuser.h"
	static hello()
	{
		io_printf("Hi there\n");
	}
	s_tfcell veriusertfs[] = {
		{usertask, 0, 0, 0, hello, 0, "$hello"},
		{0}  /* last entry must be 0 */
	}; 
hello.v: 
	module hello;
		initial $hello;
	endmodule 
Compile the PLI code for the Solaris operating system: 
	% cc -c -I<install_dir>/modeltech/include hello.c
	% ld -G -o hello.sl hello.o 
Compile the Verilog code: 
	% vlib work
	% vlog hello.v 
Simulate the design: 
	% vsim -c -pli hello.sl hello
	# Loading work.hello
	# Loading ./hello.sl
	VSIM 1> run -all
	# Hi there
	VSIM 2> quit 

Model Technology Inc.
Model Technology Incorporated
Voice: (503) 641-1340
Fax: (503)526-5410
www.model.com
sales@model.com
Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase