User guide
18-13
DirectC Interface
You call a non-void (returns a value) C/C++ function in the same
manner as you call a Verilog function call, that is, by entering its name
and arguments, either in an expression on the RHS of a procedural
assignment statement in an always or initial block, or in a Verilog
task or function declaration.
Examples
r2=return_reg(r1);
The value of scalar reg r1 is passed to C/C++ function return_reg.
It returns a value to reg r2.
r4=return_vector_bit(r3);
The value of vector bit r3 is passed to C/C++ function
return_vector_bit. It returns a value to vector bit r4.
r5=return_string();
The address of a character string is passed to reg r5.
receive_string(r5);
The address of a character string in reg r5 is passed to C/C++
function receive_string.
r6=return_pointer();
The address pointed to in a pointer in C/C++ function
return_pointer is passed to reg r6.
get_pointer(r6);
The address in reg r6 is passed to C/C++ function get_pointer.