User guide
18-60
DirectC Interface
C/C++ function mem_elem_doer uses the vc_MemoryElemRef
routine to return pointers to addresses 0 and 3 in Verilog memory1
and pass them to UB pointers p1 and p2. The standard memcpy
routine then copies the eight bytes for address 0 to address 3.
The remainder of the function is additional code to show you data
and control bytes. The eight bytes pointed to by p2 are copied to array
t and then the elements of the array are printed.
The combined Verilog and C/C++ code displays the following:
memory1 [0] = z00000000xxxxxxxx11111111
255 from t[0], 255 from t[1]
0 from t[2], 0 from t[3]
0 from t[4], 255 from t[5]
0 from t[6], 1 from t[7]
memory1 [3] = z00000000xxxxxxxx11111111
As you can see function mem_elem_doer passes the contents of the
Verilog memory memory1 element 0 to element 3.
In array t the elements contain the following:
[0] The data bits for the eight 1 values assigned to the element.
[1] The data bits for the eight X values assigned to the element
[2] The data bits for the eight 0 values assigned to the element
[3] The data bit for the Z value assigned to the element
[4] The control bits for the eight 1 values assigned to the element
[5] The control bits for the eight X values assigned to the element
[6] The control bits for the eight 0 values assigned to the element
[7] The control bit for the Z value assigned to the element