User guide

E-9
PLI Access Routines
The function with the clear_mem identifier likewise calls the
acc_fetch_tfarg_int routine to get a handle and then calls
acc_clear_mem_int with that handle.
Example D-2 PLI Table File
$set_mem call=set_mem acc+=rw:*
$get_mem call=get_mem acc+=r:*
$clear_mem call=clear_mem acc+=rw:*
Here the $set_mem user-defined system task is associated with the
set_mem function in the C code, as are the $get_mem and
$clear_mem with their corresponding get_mem and clear_mem
function identifiers.
Example D-3 Verilog Source Code Using These System Tasks
module top;
// read and print out data of memory
parameter start = 0;
parameter finish =9 ;
parameter bstart =1 ;
parameter bfinish =8 ;
parameter size = finish - start + 1;
reg [bfinish:bstart] mymem[start:finish];
integer i;
integer len;
integer value;
initial
begin
// $set_mem(mem_name, value, row, start_bit, len)
$clear_mem(mymem);
// set values
#1 $set_mem(mymem, 8, 2, 1, 5);
#1 $set_mem(mymem, 32, 3, 1, 6);
#1 $set_mem(mymem, 144, 4, 1, 8);
#1 $set_mem(mymem,29,5,1,8);