67 UNROLLED_SIZE = 2 * size_ - 1,
73 typedef NVUINTW(UNROLLED_SIZE) UnrolledMask;
80 inline void reset() { next = ~static_cast<Mask>(0); }
86 Mask pick(
const Mask& valid) {
90 UnrolledMask unrolled_valid =
static_cast<UnrolledMask
>(0);
95 UnrolledMask unrolled_next =
static_cast<UnrolledMask
>(0);
100 UnrolledMask priority(unrolled_next & unrolled_valid);
102 NVUINTW(log_unrolled_size) first_one_idx, num_zeros;
103 UnrolledMask unrolled_choice =
static_cast<UnrolledMask
>(0);
105 Mask choice =
static_cast<Mask
>(0);
106 Mask choice_temp =
static_cast<Mask
>(0);
109 NVUINTW(log_unrolled_size)>(priority);
110 unrolled_choice[first_one_idx] = 1;
111 choice_temp[0] = unrolled_choice[size_ - 1];
113 temp2 = (
nvhls::get_slc<UNROLLED_SIZE - size_>(unrolled_choice, size_)) |
117 if (first_one_idx != (size_ - 1)) {
119#pragma hls_unroll yes
120 for (
unsigned i = size_ - 2; i > 0; --i) {
121 next[i] = next[i + 1] | choice[i + 1];
124 next = ~static_cast<Mask>(0);