Paul's Free PLIs

$print_hierarchy

Here's a simple PLI I wrote to print out the hierarchy of a design, it's GPLed feel free to use it - if you don't understand the ramifications of the license on a GPLed piece of software please check out www.gnu.org. Any questions (or to pass back bug fixes) please contact me at paul@verifarm.com - Paul Campbell.


	$print_hierarchy;	// prints the entire instanced module/primitive hierarchy
	$print_hierarchy_all;	//  includes tasks, functions and intra module hierarchy
	$print_hierarchy(a, b.c, d.f.g); // only prints the selected hierachies etc

The C source is phier.c. There's a VCS® PLI table file here - XL users will have to make a PLI interface file from the information in the PLI table file.

For Verifarm's Vcomp compiler or VCS® using this is easy:


	Compile it:

		gcc -c phier.c -o phier.o

	(you may actually have to say something like)

		$VCS_CC -I $VCS_HOME/ieee_headers -c  phier.c -o phier.o

	Include on the vcs command line:

		phier.o -P phier.tab 	(add '+acc' if it isn't there already)

C-like string functions

Here's a set of C-like string manipulation functions written as PLIs, the source is str.c and a PLI tab file for vcomp or VCS® is here - see above for compilation intructions.

Verilog is a little different from C - in particular it doesn't have pointers, so with these routines everywhere you'd normally expect a source pointer (ie 'A' in $strcpy(B, A);) you can use a register value with a Verilog-style string in it or a string constant, and everywhere you'd have a destination string (ie 'B' in $strcpy(B, A);) you can use a Verilog register. Routines that in C would return a string pointer in these routines return a character index (0 for the first character, 1 for the second etc) or '-1' for an error - remember if you want to test for -1 you had better put the result into an integer variable (or 'signed' if you have a v2k compiler) before testing it.

Since there's no easy way to index a Verilog string we also provide $strfetch.

Remember that because of the way strings are stored a Verilog "a" is exactly the same as a C 'a' when you need to pass a character to a routine.

Finally, because Verilog registers have known sizes, there's no need for strNcpy() and equivalent routines, this is taken care of in the PLI support code.

The routines supported in this package are: