An SV string
input (to C) is a const char *
. An SV string
output or inout (from C) is a const char **
.
As you might imagine, 4-state types are more complicated:
SV TYPE - C TYPE
logic - svLogic
packed array of logic - svLogicVecVal *
unpacked array - svOpenArrayHandle
svLogic
, svLogicVecVal
and svOpenArrayHandle
are types in svdpi.h
. svLogic
is typedef of an unsigned char
, which can take the values sv_0
, sv_1
, sv_x
, and sv_z
, which are macros defined in svdpi.h
. svLogicVecVal
is a struct
with two fields: aval
and bval
. aval
and bval
are 32-bit int
s (canonical form). (In IUS, aval
and bval
are called a
and b
.)
Passing unpacked arrays using svOpenArrayHandle
is much more complicated.
I don't know how to pass struct
s or union
s or even if it is possible. (Though to pass such a thing to C I guess you could do a bit-stream cast, but that is going to be messy).