User guide
18-35
DirectC Interface
int vc_is4state(vc_handle)
This routine returns a 1 value if the vc_handle is to a reg or memory
that simulates with four states. It returns a 0 value for a bit or a memory
that simulates with two states. For example, the following Verilog
code uses metacomments to specify four and two-state simulation:
extern void statefinder (input reg r1,
input reg [1:0] r2,
input reg [1:0] array [1:0] r3,
input reg array [1:0] r4,
input bit r5,
input bit [1:0] r6,
input bit [1:0] array [1:0] r7,
input bit array [1:0] r8);
module top;
reg /*4value*/ r1;
reg /*4value*/ [1:0] r2;
reg /*4value*/ [1:0] r3 [1:0];
reg /*4value*/ r4 [1:0];
reg /*2value*/ r5;
reg /*2value*/ [1:0] r6;
reg /*2value*/ [1:0] r7 [1:0];
reg /*2value*/ r8 [1:0];
initial
statefinder(r1,r2,r3,r4,r5,r6,r7,r8);
endmodule
The C/C++ function that calls the vc_is4state routine is as follows:
#include <stdio.h>
#include "DirectC.h"
statefinder(vc_handle h1, vc_handle h2, vc_handle h3,
vc_handle h4,vc_handle h5, vc_handle h6,
vc_handle h7, vc_handle h8)
{
printf("\nThe vc_handles to 4state are:");
printf("\nh1=%d h2=%d h3=%d h4=%d\n\n",
vc_is4state(h1),vc_is4state(h2),