User guide
18-10
DirectC Interface
Example 1
extern "A" reg return_reg (input reg r1);
This example declares a C/C++ function named return_reg. This
function returns the value of a scalar reg. When we call this function,
the value of a scalar reg named r1 is passed to the function. This
function uses abstract access.
Example 2
extern "C" bit [7:0] return_vector_bit (bit [7:0] r3);
This example declares a C/C++ function named
return_vector_bit. This function returns an 8-bit vector bit (a reg
in two state simulation). When we call this function, the value of an
8-bit bit (a reg in two state simulation) named r3 is passed to the
function. This function uses direct access.
Table 18-3 C/C++ Function Argument Types
keyword What it specifies
real The C/C++ function reads or writes the address of a Verilog real
data type.
reg The C/C++ function reads or writes the value or address of a
Verilog reg.
bit The C/C++ function reads or writes the value or address of a
Verilog reg in two state simulation.
int The C/C++ function reads or writes the address of a C/C++ int
data type.
pointer The C/C++ function reads or writes the address that a pointer
is pointing to.
string The C/C++ function reads from or writes to the address of a
string.