User guide

18-22
DirectC Interface
In direct access the return value of the function is always passed by
value. The data type of the returned value is the same as the input
argument.
Example 1
Consider the following C/C++ function declared in the Verilog source
code:
extern reg return_reg (input reg r1);
Here the function named return_reg returns the value of a scalar
reg. The value of a scalar reg is passed to it. The header of the C/
C++ function is as follows:
extern "C" scalar return_reg(scalar reti);
scalar return_reg(scalar reti);
Table 18-8 For Output and Inout Arguments
argument type C/C++ formal
parameter data type
Passed by
int int* reference
real double* reference
pointer void** reference
string char** reference
bit scalar* reference
reg scalar* reference
bit [] - any vector, including open vector U* reference
reg[] - any vector, including open vector vec32* reference
array[] - any array, 2 state or 4 state, including
open array
UB* reference