User guide
E-20
PLI Access Routines
Examples
The following code examples illustrate the use of acc_readmem and
acc_handle_mem_by_fullname.
Example D-8 C Source Code Calling Tacc_readmem and
acc_handle_mem_by_fullname
#include "acc_user.h"
#include "vcs_acc_user.h"
#include "vcsuser.h"
int test_acc_readmem(void)
{
const char *memName = tf_getcstringp(1);
const char *memFile = tf_getcstringp(2);
handle mem = acc_handle_mem_by_fullname(memName);
if (mem) {
io_printf("test_acc_readmem: %s handle found\n",
memName);
acc_readmem(mem, memFile, 'h');
}
else {
io_printf("test_acc_readmem: %s handle NOT found\n",
memName);
}
}
Example D-9 The PLI Table File
$test_acc_readmem call=test_acc_readmem
Example D-10 The Verilog Source Code
module top;
reg [7:0] CORE[7:0];
initial $acc_readmem(CORE, "CORE");
initial $test_acc_readmem("top.CORE", "test_mem_file");
endmodule