User guide

18-33
DirectC Interface
Here we declare a routine named scalarfinder and input a scalar
reg, a vector reg and two memories (one with scalar elements).
The declaration contains the "A" specification for abstract access.
You typically include it in the declaration when other functions will
use direct access, that is, you have a mix of functions with direct and
abstract access.
#include <stdio.h>
#include "DirectC.h"
scalarfinder(vc_handle h1, vc_handle h2, vc_handle h3,
vc_handle h4)
{
int i1 = vc_isScalar(h1),
i2 = vc_isScalar(h2),
i3 = vc_isScalar(h3),
i4 = vc_isScalar(h4);
printf("\ni1=%d i2=%d i3=%d i4=%d\n\n",i1,i2,i3,i4);
}
Parameters h1, h2, h3, and h4 are vc_handles to regs r1 and r2
and memories r3 and r4 respectively. The function prints the
following:
i1=1 i2=0 i3=0 i4=0
int vc_isVector(vc_handle)
This routine returns a 1 value if the vc_handle is to a vector reg or
bit. It returns a 0 value for a vector bit or reg or any memory. For
example, using the Verilog code from the previous example, and the
following C/C++ function:
scalarfinder(vc_handle h1, vc_handle h2, vc_handle h3,
vc_handle h4)
{