User guide

18-43
DirectC Interface
{
vec32 b,*c;
c=vc_4stVectorRef(h);
b=*c;
printf("\n b is %x[control] %x[data]\n\n",b.c,b.d);
printf("\n b is %s \n\n",vc_toString(h));
}
In this example a vector reg is assigned a value that contains x and
z values as well as 1 and 0 values. In the abstract access C/C++
function there are two ways of displaying the value of the reg:
Recognize that type vec32 is defined as follows in the DirectC.h
file:
typdef struct {U c; U d;} vec32;
In machine memory there are control as well as data bits for
Verilog data to differentiate X from 1 and Z from 0 data, so there
are c (control) and d (data) data variables in the structure and you
must specify which variable when you access the vec32 type.
Use the vc_toString routine to display the value of the reg that
contains X and Z values.
This example displays:
b is cc[control 55[data]
b is zx01zx01
char *vc_toStringF(vc_handle, char)
Returns a string that contains the 1, 0, x, and z characters and allows
you to specify the format or radix for the display. The char parameter
can be
’b’, ’o’, ’d’, or ’x’.