User guide

E-13
PLI Access Routines
Example D-4 shows the source code for a PLI application that:
1. Reads a data file named initfile to find the memory identifiers
of the memories it writes to, the hexadecimal string to be
converted to its bit representation when written to the memory,
the index of the memory where it writes this value, and the starting
bit for writing the binary value.
2. Displays where in the memory it is writing these values
3. Calls the access routine to write the values in the initfile.
Example D-5 The Data File Read by the Application
testbench.U2.cmd_array 5 0 0
testbench.U2.cmd_array a5 1 4
testbench.U2.cmd_array a5a5 2 8
testbench.U1.slave_addr a073741824 0 4
testbench.U1.slave_addr 16f0612735 1 8
testbench.U1.slave_addr 2b52a90e15 2 12
Each line lists a Verilog memory, followed by a hex string, a memory
index, and a start bit.
Example D-6 PLI Table File
$pli call=pli acc=rw:*
Here the $pli system task is associated with the function with the
pli identifier in the C source code.
Example D-7 Verilog Source Calling the PLI Application
module testbench;
monitor U1 ();
master U2 ();
initial begin
$monitor($stime,,,
"sladd[0]=%h sladd[1]=%h sladd[2]=%h load=%h
cmd[0]=%h cmd[1]=%h cmd[2]=%h",