User guide

E-7
PLI Access Routines
Example D-3 shows the Verilog source code containing these
system tasks.
Example D-1 C Source Code for Functions Calling acc_getmem_int,
acc_setmem_int, and acc_clearmem_int
#include <stdio.h>
#include "acc_user.h"
#include "vcs_acc_user.h"
void error_handle(char *msg)
{
printf("%s",msg);
fflush(stdout);
exit(1);
}
void set_mem()
{
handle memhand = NULL;
int value = -1;
int row = -1;
int start_bit = -1;
int len = -1;
memhand = acc_handle_tfarg(1);
if(!memhand) error_handle("NULL MEM HANDLE\n");
value = acc_fetch_tfarg_int(2);
row = acc_fetch_tfarg_int(3);
start_bit = acc_fetch_tfarg_int(4);
len = acc_fetch_tfarg_int(5);
acc_setmem_int(memhand, value, row, start_bit, len);
}
void get_mem()
{
handle memhand = NULL;
int row = -1;
int start_bit = -1;
int len = -1;
int value = -1;