Technical data
VSIM function descriptions
ModelSim EE/PLUS Reference Manual VHDL Foreign Language Interface and Verilog PLI
-
481
Mappin
g
to VHDL data types
Many FLI functions have parameters and return values that represent VHDL
object values. This section describes how the object values are mapped to the
various VHDL data types.
VHDL data types are identified in the C interface by a typeID handle. A typeID
handle can be obtained for a signal by calling mti_GetSignalType and for a
variable by calling mti_GetVarType.
Alternatively, the mti_CreateScalarType, mti_CreateRealType,
mti_CreateEnumType, and mti_CreateArrayType functions return typeID
handles for the data types that they create.
Given a typeID handle, the mti_GetTypeKind function returns a C enumeration of
type_kind that describes the data type. The mapping between type_kind values
and VHDL data types is as follows:
Object values for access, file, and record types are not supported by the C
interface. Effectively, this leaves scalar types and arrays of scalar types as valid
types for C interface object values. In addition, multidimensional arrays are
allowed.
Scalar types consume 4 bytes of memory, enumerations use either 1 or 4 bytes,
and TIME and REAL take 8 bytes. The C type “long” is used for scalar object
values. An enumeration consumes either 1 byte or 4 bytes, depending on how
many values are in the enumeration. If it has 256 or less values then it consumes
1 byte, otherwise it consumes 4 bytes. In any case, all scalar types are cast to
t
y
pe_kind value VHDL data t
y
pe
MTI_TYPE_ACCESS Access type (pointer)
MTI_TYPE_ARRAY Array composite type
MTI_TYPE_ENUM Enumeration scalar type
MTI_TYPE_FILE File type
MTI_TYPE_REAL Floating point scalar type
MTI_TYPE_RECORD Record composite type
MTI_TYPE_SCALAR Integer and physical scalar types
MTI_TYPE_TIME Time type