User guide

18-59
DirectC Interface
Here there is a Verilog memory with four addresses, each element
has 25 bits. This means that the Verilog memory needs eight bytes
of machine memory because there is a data byte and a control byte
for every eight bits in an element, with an additional data and control
byte for any remainder bits.
Here in element 0 the 25 bits are assigned, from right to left, eight 1
bits, eight unknown x bits, eight 0 bits, and one high impedance z bit.
#include <stdio.h>
#include "DirectC.h"
void mem_elem_doer(vc_handle h)
{
U indx;
UB *p1, *p2, t [8];
indx = 0;
p1 = vc_MemoryElemRef(h, indx);
indx = 3;
p2 = vc_MemoryElemRef(h, indx);
memcpy(p2,p1,8);
memcpy(t,p2,8);
printf(" %d from t[0], %d from t[1]\n",
(int)t[0], (int) t[1]);
printf(" %d from t[2], %d from t[3]\n",
(int)t[2], (int) t[3]);
printf(" %d from t[4], %d from t[5]\n",
(int)t[4], (int)t[5]);
printf(" %d from t[6], %d from t[7]\n",
(int)t[6], (int)t[7]);
}