-m32
flag is not allowed
and will cause an error.The data types used in a C/C++ function compiled into an executable impact the accuracy of the result and the memory requirements, and can impact the performance. A 32-bit integer int data type can hold more data and therefore provide more precision than an 8-bit char type, but it requires more storage. Similarly, when the C/C++ function is to be synthesized to an RTL implementation, the types impact the precision, the area, and the performance of the RTL design. The data types used for variables determine the size of the operators required and therefore the area and performance of the RTL.
Vitis HLS supports the synthesis of all standard C/C++ types, including exact-width integer types.
-
(unsigned) char
,(unsigned) short
,(unsigned) int
-
(unsigned) long
,(unsigned) long long
-
(unsigned) intN_t
(whereN
is 8, 16, 32, and 64, as defined in stdint.h) -
float
,double
Exact-width integers types are useful for ensuring designs are portable across all types of system.
The C/C++ standard dictates that type (unsigned)long
is implemented as 64 bits on 64-bit operating systems.
Synthesis matches this behavior and produces different sized operators, and therefore
different RTL designs, depending on the type of operating system on which Vitis HLS is run. On Windows OS, Microsoft defines type
long as 32-bit, regardless of the OS.
- Use data type
(unsigned)int
or(unsigned)int32_t
instead of type(unsigned)long
for 32-bit. - Use data type
(unsigned)long long
or(unsigned)int64_t
instead of type(unsigned)long
for 64-bit.
AMD highly recommends defining the data types for all variables in a common header file, which can be included in all source files.
- During the course of a typical Vitis HLS project, some of the data types might be refined, for example to reduce their size and allow a more efficient hardware implementation.
- One of the benefits of working at a higher level of abstraction is the ability to quickly create new design implementations. The same files typically are used in later projects but might use different (smaller or larger or more accurate) data types.
Both of these tasks are more easily achieved when the data types can be changed in a single location: the alternative is to edit multiple files.
_TYPES_H
is defined in your header file, it is likely that
such a common name might be defined in other system files, and it might enable or
disable some other code causing unforeseen side effects.std::complex<long double>
data type is not supported
in Vitis HLS and should not be used.