User guide
18-75
DirectC Interface
Verilog memories mem, mem2, and mem3 are all arguments to the
function named show. If that function is defined as follows:
#include <stdio.h>
#include "DirectC.h"
void show(vc_handle h)
{
printf("%s\n", vc_argInfo(h)); /* notice \n after the
string */
}
This routine prints the following:
input reg[0:31] array[0:7]
input reg[0:31] array[0:15]
input reg[0:63] array[0:31]
int vc_Index(vc_handle, U, ...)
Internally a multi-dimensional array is always stored as a one
dimensional array and this makes a difference in how it can be
accessed. In order to avoid duplicating many of the previous access
routines for multi-dimensional arrays, the access process is split into
two steps. The first step is to translate the multiple indices into a single
index of a linearized array, This routine does this. The second step
is for another access routine to perform an access operation on the
linearized array.
This routine returns the index of a linearized array or returns -1 if the
U type parameter is not an index of a multi-dimensional array or the
vc_handle parameter is not a handle to a multi-dimensional array of
the reg data type.
/* get the suum of all elements from a 2-dimensional slice
of a 4-dimensional array */
int getSlice(vc_handle vh_array, vc_handle vh_indx1,
vc_handle vh_indx2) {