User guide
18-71
DirectC Interface
memcheck_vec(mem);
end
endmodule
The C/C++ function that calls vc_MemoryStringF is as follows:
#include <stdio.h>
#include "DirectC.h"
void memcheck_vec(vc_handle h)
{
printf("C/C++ code says \"mem [0] is %s radix b\"\n",
vc_MemoryStringF(h,0,’b’));
printf("C/C++ code says \"mem [0] is %s radix o\"\n",
vc_MemoryStringF(h,0,’o’));
printf("C/C++ code says \"mem [0] is %s radix d\"\n",
vc_MemoryStringF(h,0,’d’));
printf("C/C++ code says \"mem [0] is %s radix x\"\n",
vc_MemoryStringF(h,0,’x’));
}
The Verilog and C/C++ code display the following:
Verilog code says "mem [0]=111 radix b"
Verilog code says "mem [0]=7 radix o"
Verilog code says "mem [0]=7 radix d"
Verilog code says "mem [0]=7 radix h"
C/C++ code says "mem [0] is 00000111 radix b"
C/C++ code says "mem [0] is 007 radix o"
C/C++ code says "mem [0] is 7 radix d"
C/C++ code says "mem [0] is 07 radix x"