Varray library uses the varray class to
handle data to and from simulation objects. The varray
class represents data as an array and support data types that are compatible with AI Engine and HLS kernels.
To form a subsystem, two or more simulation objects can be chained
together using intermediate varray to pass data from
one to another.
| AIE data type | Supported in AIE | Supported in AIE-ML | Supported in AIE_MLv2 | MATLAB | Python Numpy | varray type |
|---|---|---|---|---|---|---|
| int8 | Yes | Yes | Yes | int8 | numpy.int8 | varray.int8 |
| uint8 | Yes | Yes | Yes | uint8 | numpy.uint8 | varray.uint8 |
| int16 | Yes | Yes | Yes | int16 | numpy.int16 | varray.int16 |
| uint16 | Yes | Yes | Yes | uint16 | numpy.uint16 | varray.uint16 |
| cint16 | Yes | Yes | Yes | complex int16 | N/A | varray.cint16 |
| int32 | Yes | Yes | Yes | int32 | numpy.int32 | varray.int32 |
| uint32 | Yes | Yes | Yes | uint32 | numpy.uint32 | varray.uint32 |
| cint32 | Yes | Yes | Yes | complex int32 | N/A | varray.cint32 |
| float16 | No | No | Yes | N/A | numpy.float16 | varray.float16 |
| float | Yes | Yes | Yes | single | numpy.float32 | varray.float |
| cfloat | Yes | Yes | No | complex single | numpy.float64 | varray.cfloat |
| bfloat16 | No | Yes | Yes | N/A | N/A | varray.bfloat16 |
| cbfloat16 | No | Yes | No | N/A | N/A | varray.cbfloat16 |
| mx9 | No | No | Yes | N/A | N/A | varray.mx9 |
Note: The data types support differ per device
family. For details on the bfloat and mx format support refer to
Data Types
in the
AI
Engine-ML Kernel and Graph Programming Guide (UG1603)
.
| HLS data type | MATLAB | Python Numpy | varray type |
|---|---|---|---|
| int4 | N/A | N/A | varray.int4 |
| uint4 | N/A | N/A | varray.uint4 |
| char | int8 | numpy.int8 | varray.int8 |
| unsigned char | uint8 | numpy.uint8 | varray.uint8 |
| std::complex<char> | complex int8 | N/A | varray.cint8 |
| short | int16 | numpy.int16 | varray.int16 |
| unsigned short | uint16 | numpy.uint16 | varray.uint16 |
| std::complex<short> | complex int16 | N/A | varray.cint16 |
| int | int32 | numpy.int32 | varray.int32 |
| unsigned int | uint32 | numpy.uint32 | varray.uint32 |
| std::complex<int> | complex int32 | N/A | varray.cint32 |
| long long | int64 | numpy.int64 | varray.int64 |
| unsigned long long | uint64 | numpy.uint64 | varray.uint64 |
| float16 | N/A | numpy.float16 | varray.float16 |
| float | single | numpy.float32 | varray.float |
| std::complex<float> | complex single | numpy.complex64 | varray.cfloat |
| double | double | numpy.double | varray.double |
| std::complex<double> | complex double | numpy.complex128 | varray.cdouble |
| ap_fixed<W,I,Q,O,N> | N/A | N/A | varray.fi(1, W, W-I) |
| ap_ufixed<W,I,Q,O,N> | N/A | N/A | varray.fi(0, W, W-I) |
| ap_int<W> | N/A | N/A | varray.fi(1, W, 0) |
| ap_uint<W> | N/A | N/A | varray.fi(0, W, 0) |
Note: The ap_fixed arguments are Word length, number
of Integer bits, Quantization mode, Overflow mode, and Number of saturation bits, see
Arbitrary
Precision Fixed-Point Data Types in the Vitis High-Level Synthesis User
Guide (UG1399) for
details.
Note: The
varray.fi
types use rounding mode Nearest and overflow mode
Saturate.