AI Engine API User Guide (AIE-API) 2025.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts

Overview

These functions provide an abstraction on top of printf that allow users to display the contents of AIE types in the standard output.

Functions

template<unsigned N>
void aie::print (const aie::mask< N > &m, bool nl=false, const char *prefix=nullptr)
 Displays the contents of a mask.
 
template<typename C>
requires (Vector<C> || Accum<C>)
void aie::print (const C &c, bool nl=false, const char *prefix=nullptr)
 Displays the contents of a vector or an accumulator.
 
template<typename T, unsigned Elems>
requires (!detail::is_floating_point_v<T>)
void aie::print_fixed (const aie::vector< T, Elems > &v, int scale, bool nl=false, const char *prefix=nullptr)
 Displays the contents of a vector integers represented as real numbers in fixed point.
 
template<typename Matrix>
requires (Vector<Matrix> || Accum<Matrix>)
void aie::print_matrix (const Matrix &m, unsigned cols, const char *prefix=nullptr)
 Displays the contents of a vector or accumulator, arranged in a matrix layout.
 

Function Documentation

◆ print() [1/2]

template<unsigned N>
void aie::print ( const aie::mask< N > & m,
bool nl = false,
const char * prefix = nullptr )

Displays the contents of a mask.

Parameters
[in]mThe mask.
[in]nlSet to true in order to add a newline at the end.
[in]prefixOptional text to print before the first element.

◆ print() [2/2]

template<typename C>
requires (Vector<C> || Accum<C>)
void aie::print ( const C & c,
bool nl = false,
const char * prefix = nullptr )

Displays the contents of a vector or an accumulator.

Parameters
[in]cA vector or an accumulator.
[in]nlSet to true to print add newline at the end.
[in]prefixOptional text to print before the first element.

◆ print_fixed()

template<typename T, unsigned Elems>
requires (!detail::is_floating_point_v<T>)
void aie::print_fixed ( const aie::vector< T, Elems > & v,
int scale,
bool nl = false,
const char * prefix = nullptr )

Displays the contents of a vector integers represented as real numbers in fixed point.

Applies a scaling factor to each value before printing, which represents the exponent in a multiplication by a power of two: positive scale values will make the numbers larger while negative values will make the numbers smaller.

Parameters
[in]vThe vector.
[in]scalePower-of-two exponent to apply to each value. Can be positive or negative.
[in]nlSet to true to print a newline after the last element.
[in]prefixOptional text to print before the first element.

◆ print_matrix()

template<typename Matrix>
requires (Vector<Matrix> || Accum<Matrix>)
void aie::print_matrix ( const Matrix & m,
unsigned cols,
const char * prefix = nullptr )

Displays the contents of a vector or accumulator, arranged in a matrix layout.

Parameters
[in]mA vector or an accumulator.
[in]colsThe number of columns in the matrix. Must be an exact divisor of the number of elements in m.
[in]prefixOptional text to print before the first element.