User guide

18-62
DirectC Interface
The Verilog code displays the following:
mem[0]=1
mem[0]=0
void vc_putMemoryScalar(vc_handle, U indx, scalar)
Passes a value of type scalar to a Verilog memory element. You
specify the memory by vc_handle and the element by the indx
parameter. This routine is used in the previous example.
int vc_getMemoryInteger(vc_handle, U indx)
Returns the integer equivalent of the data bits in a memory element
whose bit-width is 32 bits or less. For example:
extern void mem_elem_halver (inout reg [] array [] memX);
module test;
reg [31:0] mem1 [127:0];
reg [7:0] mem2 [1:0];
initial
begin
mem1 [0] = 999;
mem2 [0] = 8’b1111xxxx;
$display("mem1[0]=%0d",mem1[0]);
$display("mem2[0]=%0d",mem2[0]);
mem_elem_halver(mem1);
mem_elem_halver(mem2);
$display("mem1[0]=%0d",mem1[0]);
$display("mem2[0]=%0d",mem2[0]);
$finish;
end
endmodule