User guide
18-41
DirectC Interface
int vc_toInteger(vc_handle)
Returns an int value for a vc_handle to a scalar bit or a vector bit of
32 bits or less. For a vector reg or a vector bit with more than 32 bits
this routine returns a 0 value and displays the following warning
message:
DirectC interface warning: 0 returned for 4-state value
(vc_toInteger)
The following is an example of Verilog code that calls a C/C++ function
that uses this routine:
extern void rout1 (input bit onebit, input bit [7:0] mobits);
module top;
reg /*2value*/ onebit;
reg /*2value*/ [7:0] mobits;
initial
begin
rout1(onebit,mobits);
onebit=1;
mobits=128;
rout1(onebit,mobits);
end
endmodule
Notice that the function declaration specifies that the parameters are
of type bit. It includes metacomments for two-state simulation in the
declaration of reg onebit and mobits. There are two calls to the
function rout1, before and after values are assigned in this Verilog
code.