Bits - 2023.2 English

AI Engine API User Guide (AIE) (UG1529)

Document ID
UG1529
Release Date
2023-11-16
Version
2023.2 English
AI Engine API User Guide: Bits
AI Engine API User Guide (AIE) 2023.2
Loading...
Searching...
No Matches
Bits

Bitwise logical operations. More...

Overview

Bitwise logical operations.

Functions

template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2> && (!detail::is_complex_v<typename Vec1::value_type>) && (!detail::is_floating_point_v<typename Vec1::value_type>))
auto aie::bit_and (const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
 Returns a vector with the bit-wise AND of the elements of the two input vectors.
 
template<Elem E, Vector Vec>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && (!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_and (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
 Returns a vector with the bit-wise AND of a value and all the elements of the input vector.
 
template<Vector Vec>
requires ((!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_not (const Vec &v) -> aie_dm_resource_remove_t< Vec >
 Returns a vector with the bit-wise NEG of the elements of the input vector.
 
template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2> && (!detail::is_complex_v<typename Vec1::value_type>) && (!detail::is_floating_point_v<typename Vec1::value_type>))
auto aie::bit_or (const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
 Returns a vector with the bit-wise OR of the elements of the two input vectors.
 
template<Elem E, Vector Vec>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && (!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_or (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
 Returns a vector with the bit-wise OR of a value and all the elements of the input vector.
 
template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2> && (!detail::is_complex_v<typename Vec1::value_type>) && (!detail::is_floating_point_v<typename Vec1::value_type>))
auto aie::bit_xor (const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
 Returns a vector with the bit-wise XOR of the elements of the two input vectors.
 
template<Elem E, Vector Vec>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && (!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_xor (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
 Returns a vector with the bit-wise XOR of a value and all the elements of the input vector.
 
template<Vector Vec>
constexpr auto aie::downshift (const Vec &v, unsigned shift) -> aie_dm_resource_remove_t< Vec >
 Returns a vector with all values arithmetically downshifted by specified number of bits.
 
template<Vector Vec>
constexpr auto aie::logical_downshift (const Vec &v, unsigned shift) -> aie_dm_resource_remove_t< Vec >
 Returns a vector with all values logically downshifted by specified number of bits.
 
template<Vector Vec>
constexpr auto aie::upshift (const Vec &v, unsigned shift) -> aie_dm_resource_remove_t< Vec >
 Returns a vector with all values upshifted by specified number of bits.
 

Function Documentation

◆ bit_and() [1/2]

template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2> && (!detail::is_complex_v<typename Vec1::value_type>) && (!detail::is_floating_point_v<typename Vec1::value_type>))
auto aie::bit_and ( const Vec1 &  v1,
const Vec2 &  v2 
) -> aie_dm_resource_remove_t<Vec1>

Returns a vector with the bit-wise AND of the elements of the two input vectors.

The vectors must have the same type and size.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v1[i] & v2[i];
Note
This is a scalar operation on AIE
Parameters
v1First input vector. The type must meet Vector.
v2Second input vector. The type must meet Vector.

◆ bit_and() [2/2]

template<Elem E, Vector Vec>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && (!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_and ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the bit-wise AND of a value and all the elements of the input vector.

The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a & v[i];
Note
This is a scalar operation on AIE
Parameters
aValue. The type must meet Elem.
vInput vector. The type must meet Vector.

◆ bit_not()

template<Vector Vec>
requires ((!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_not ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the bit-wise NEG of the elements of the input vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = ~v[i];
Note
This is a scalar operation on AIE
Parameters
vInput vector. The type must meet Vector.

◆ bit_or() [1/2]

template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2> && (!detail::is_complex_v<typename Vec1::value_type>) && (!detail::is_floating_point_v<typename Vec1::value_type>))
auto aie::bit_or ( const Vec1 &  v1,
const Vec2 &  v2 
) -> aie_dm_resource_remove_t<Vec1>

Returns a vector with the bit-wise OR of the elements of the two input vectors.

The vectors must have the same type and size.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v1[i] | v2[i];
Note
This is a scalar operation on AIE
Parameters
v1First input vector. The type must meet Vector.
v2Second input vector. The type must meet Vector.

◆ bit_or() [2/2]

template<Elem E, Vector Vec>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && (!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_or ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the bit-wise OR of a value and all the elements of the input vector.

The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a | v[i];
Note
This is a scalar operation on AIE
Parameters
aValue. The type must meet Elem.
vInput vector. The type must meet Vector.

◆ bit_xor() [1/2]

template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2> && (!detail::is_complex_v<typename Vec1::value_type>) && (!detail::is_floating_point_v<typename Vec1::value_type>))
auto aie::bit_xor ( const Vec1 &  v1,
const Vec2 &  v2 
) -> aie_dm_resource_remove_t<Vec1>

Returns a vector with the bit-wise XOR of the elements of the two input vectors.

The vectors must have the same type and size.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v1[i] ^ v2[i];
Note
This is a scalar operation on AIE
Parameters
v1First input vector. The type must meet Vector.
v2Second input vector. The type must meet Vector.

◆ bit_xor() [2/2]

template<Elem E, Vector Vec>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && (!detail::is_complex_v<typename Vec::value_type>) && (!detail::is_floating_point_v<typename Vec::value_type>))
auto aie::bit_xor ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the bit-wise XOR of a value and all the elements of the input vector.

The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a ^ v[i];
Note
This is a scalar operation on AIE
Parameters
aValue. The type must meet Elem.
vInput vector. The type must meet Vector.

◆ downshift()

template<Vector Vec>
constexpr auto aie::downshift ( const Vec &  v,
unsigned  shift 
) -> aie_dm_resource_remove_t<Vec>
constexpr

Returns a vector with all values arithmetically downshifted by specified number of bits.

Parameters
vInput vector
shiftNumber of bits to downshift by

◆ logical_downshift()

template<Vector Vec>
constexpr auto aie::logical_downshift ( const Vec &  v,
unsigned  shift 
) -> aie_dm_resource_remove_t<Vec>
constexpr

Returns a vector with all values logically downshifted by specified number of bits.

Parameters
vInput vector
shiftNumber of bits to downshift by

◆ upshift()

template<Vector Vec>
constexpr auto aie::upshift ( const Vec &  v,
unsigned  shift 
) -> aie_dm_resource_remove_t<Vec>
constexpr

Returns a vector with all values upshifted by specified number of bits.

Parameters
vInput vector
shiftNumber of bits to upshift by