59 #include <nvhls_marshaller.h>
75 template <
unsigned char N>
117 template <
unsigned X>
141 template <
unsigned X>
173 template <
unsigned X>
284 template <
unsigned X>
329 template <
unsigned int N>
331 typedef ac_int<N, true> nvint_t;
332 typedef ac_int<N, false> nvuint_t;
335 template <
unsigned int N,
bool B = (N <= 64)>
338 template <
unsigned int N>
340 typedef sc_int<N> nvint_t;
341 typedef sc_uint<N> nvuint_t;
344 template <
unsigned int N>
346 typedef sc_bigint<N> nvint_t;
347 typedef sc_biguint<N> nvuint_t;
386 template <
typename type1,
typename type2>
387 type1
set_slc(type1 X, type2 Y,
const unsigned int i) {
390 X_temp.set_slc(i, Y);
393 const unsigned int W2 = Wrapped<type2>::width;
394 X_temp.range(i + W2 - 1, i) = Y;
433 template <
unsigned int W,
typename type>
435 sc_biguint<W>
get_slc(type X,
const unsigned int i){
443 Z = X_temp.template slc<W>(i);
446 Z = X_temp.range(i + W - 1, i);
486 template <
typename type>
487 type
get_slc(type X,
const unsigned int i,
const unsigned int j) {
492 const unsigned int W = type::width;
493 Z = (X_temp >> j) & ((((ac_int<W + 1>)1) << (i - j + 1)) - 1);
495 Z = X_temp.range(i, j);
560 template <
unsigned int W1,
typename type1,
typename type2>
563 enum { P2 =
next_pow2<(W1 + 1) / 2>::val };
566 enum { Wu = (W1 > P2) ? (W1 - P2) : 1 };
576 idxu = leading_ones<Wu, typename nvhls_t<Wu>::nvuint_t,
580 idxl = leading_ones<P2, typename nvhls_t<P2>::nvuint_t,
593 1, nvhls_t<1>::nvuint_t, nvhls_t<1>::nvuint_t>(nvhls_t<1>::nvuint_t X) {
626 template <
typename type1>
627 unsigned int lzd(type1 X) {
631 l = X.leading_sign();
633 l = Wrapped<type1>::width -1;
638 HLS_DPOPT_REGION(DPOPT_DEFAULT,
"leading_ones",
"leading_ones");
639 HLS_CONSTRAIN_REGION(0, 1);
641 const unsigned int W1 = Wrapped<type1>::width;
644 const bool is_signed = Wrapped<type1>::is_signed;
645 l = leading_ones<W1, type1, type2>(X);
681 template <
typename type>
683 const unsigned int W = Wrapped<type>::width;
684 const bool is_signed = Wrapped<type>::is_signed;
687 out = (-((((type)(1)) << (W - 1)) - 1));
721 template <
typename type>
726 const unsigned int W = Wrapped<type>::width;
727 const bool is_signed = Wrapped<type>::is_signed;
730 mag = X.range(W - 2, 0);
739 out[W - 1] = X[W - 1];
781 template <
typename type>
786 const unsigned int W = Wrapped<type>::width;
787 const bool is_signed = Wrapped<type>::is_signed;
790 mag = X.range(W - 2, 0);
798 out[W - 1] = X[W - 1];
847 template <
typename type1,
typename type2>
854 const unsigned int W1 = Wrapped<type1>::width;
855 const unsigned int W2 = Wrapped<type2>::width;
856 const bool type2_signed = Wrapped<type2>::is_signed;
862 type2 min_Y = get_min_val<type2>();
879 signed_type2 Y_l = Y - l;
880 if (Y_l < ((signed_type2)min_Y)) {
891 signed_lzd_type Y_l = Y - l;
892 if (Y_l < ((signed_lzd_type)min_Y)) {
type get_min_val()
Minimum Value of a type.
unsigned int lzd(type1 X)
Leading zero detector.
bool normalize(type1 &X, type2 &Y)
Normalize function.
type right_shift(type X, int shift)
Function that performs right shift while preserving sign.
type get_slc(type X, const unsigned int i, const unsigned int j)
Function that returns slice of bits with dynamic range.
type left_shift(type X, int shift)
Function that performs left shift while preserving sign.
type1 set_slc(type1 X, type2 Y, const unsigned int i)
Function that replaces slice of bits.
type2 leading_ones(type1 X)
LeadingOne Detector.
Compute index width of a constant.
Compute Celing of log2 of a constant.
Compute Floor of log2 of a constant.
Compute number of bits to represent a constant.
Compute power of 2 value greater than a given value.
Definition of vendor agnostic integer data types.