User guide

18-25
DirectC Interface
Example 5
Consider the following C/C++ function declared in the Verilog source
code:
extern void incr (inout bit [] r7);
Here the function named incr, that does not return a value, has an
argument declared as inout. No bit-width is specified for it but the
[] entry for the argument specifies that it is not a scalar bit. The
header of the C/C++ function is as follows:
void incr (U *p);
Open bit-width parameters are always passed to by reference. A
parameter whose corresponding argument is declared to be inout
is passed to and from by reference. So there are two reasons for
parameter p to be a pointer. It is a pointer to type U because its
corresponding argument is a vector bit.
Example 6
Consider the following C/C++ function declared in the Verilog source
code:
extern void passbig1 (input bit [63:0] r8,
output bit [63:0] r9);
Here the function named passbig1, that does not return a value,
has input and output arguments declared as bit and larger than 32
bits. The header of the C/C++ function is as follows:
void passbig (U *in, U *out)