| AI Engine API User Guide (AIE-API) 2025.2

Loading...
Searching...
No Matches
Functions
Print functions
Uility functions and classes

## 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] | m | The mask.
  [in] | nl | Set to `true` in order to add a newline at the end.
  [in] | prefix | Optional 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] | c | A vector or an accumulator.
  [in] | nl | Set to `true` to print add newline at the end.
  [in] | prefix | Optional 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] | v | The vector.
  [in] | scale | Power-of-two exponent to apply to each value. Can be positive or negative.
  [in] | nl | Set to `true` to print a newline after the last element.
  [in] | prefix | Optional 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] | m | A vector or an accumulator.
  [in] | cols | The number of columns in the matrix. Must be an exact divisor of the number of elements in `m`.
  [in] | prefix | Optional text to print before the first element.