User guide
18-20
DirectC Interface
Using Direct Access
Direct access was implemented for C/C++ routines whose formal
parameters are of the following types:
Some of these type identifiers are standard C/C++ types; the ones
that aren’t were defined with the following typedef statements:
typedef unsigned int U;
typedef unsigned char UB;
typedef unsigned char scalar;
typedef struct {U c; U d;} vec32;
The type identifier you use depends on the corresponding argument
direction, type, and bit-width that you specified in the declaration of
the function in your Verilog code. The following rules apply:
• Direct access passes all output and inout arguments by reference,
so their corresponding formal parameters in the C/C++ function
must be pointers.
• Direct access passes a Verilog bit by value only if it is 32 bits or
less. If it is larger than 32 bits, direct access passes the bit by
reference so the corresponding formal parameters in the C/C++
function must be pointers if they are larger than 32 bits.
• Direct access passes a scalar reg by value. It passes a vector reg
direct access by reference, so the corresponding formal
parameter in the C/C++ function for a vector reg must be a pointer.
int int* double* void* void**
char* char** scalar scalar*
U* vec32 UB*