namespace hash_group_aggregate

// structs

template <
    int _Width,
    int _ColumnNM
    >
struct COLUMN_DATA

stream_to_buf

#include "hash_max_freq.hpp"
template <
    int _WKey,
    int _KeyNM,
    int _WPay,
    int _PayNM,
    int _WBuffer,
    int _BurstLenW
    >
void stream_to_buf (
    hls::stream <COLUMN_DATA <_WKey, _KeyNM>>& strm_undo_key,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& strm_undo_pld,
    hls::stream <bool>& strm_undo_e,
    ap_uint <_WBuffer>* pong_buf
    )

write data from streams to DDR/HBM

buf_to_stream

#include "hash_max_freq.hpp"
template <
    int _WKey,
    int _KeyNM,
    int _WPay,
    int _PayNM,
    int _WBuffer,
    int _BurstLenR
    >
void buf_to_stream (
    ap_uint <_WBuffer>* in_buf,
    int unhandle_cnt,
    hls::stream <COLUMN_DATA <_WKey, _KeyNM>>& kout_strm,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& pout_strm,
    hls::stream <bool>& eout_strm
    )

read data from overflow-buffer to streams

hash_wrapper

#include "hash_max_freq.hpp"
template <
    int HASH_MODE,
    int KEYW,
    int KeyNM,
    int HASHW
    >
void hash_wrapper (
    hls::stream <COLUMN_DATA <KEYW, KeyNM>>& i_key_strm,
    hls::stream <bool>& i_e_strm,
    ap_uint <32> round,
    hls::stream <ap_uint <HASHW>>& o_hash_strm,
    hls::stream <COLUMN_DATA <KEYW, KeyNM>>& o_key_strm,
    hls::stream <bool>& o_e_strm
    )

Calculate hash value based on key.

merge1_1

#include "hash_max_freq.hpp"
template <
    int KEYW,
    int KeyNM,
    int PW,
    int PayNM,
    int HASHW
    >
void merge1_1 (
    hls::stream <COLUMN_DATA <KEYW, KeyNM>>& i_key_strm,
    hls::stream <COLUMN_DATA <PW, PayNM>>& i_pld_strm,
    hls::stream <ap_uint <HASHW>>& i_hash_strm,
    hls::stream <bool>& i_e_strm,
    hls::stream <COLUMN_DATA <KEYW, KeyNM>>& o_key_strm,
    hls::stream <COLUMN_DATA <PW, PayNM>>& o_pld_strm,
    hls::stream <ap_uint <HASHW>>& o_hash_strm,
    hls::stream <bool>& o_e_strm
    )

Merge stream of multiple channels into one PU, merge 1 to 1.

initial_uram

#include "hash_max_freq.hpp"
template <
    int _WKey,
    int _WPay,
    int _WHash,
    int _Wcnt,
    int PL
    >
void initial_uram (
    ap_uint <4> op,
    ap_uint <_WKey+_Wcnt>* key_uram,
    ap_uint <_WPay>* pld_uram0
    )

initiaalize uram

update_key_uram

#include "hash_max_freq.hpp"
template <
    int _WKey,
    int _KeyNM,
    int _WPay,
    int _PayNM,
    int _WHash,
    int _Wcnt
    >
void update_key_uram (
    hls::stream <ap_uint <_WHash>>& i_hash_strm,
    hls::stream <COLUMN_DATA <_WKey, _KeyNM>>& i_key_strm,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& i_pld_strm,
    hls::stream <bool>& i_e_strm,
    ap_uint <_Wcnt> key_column,
    ap_uint <32>& unhandle_cnt,
    ap_uint <_WKey+_Wcnt>* key_uram,
    hls::stream <COLUMN_DATA <_WKey, _KeyNM>>& undokey_strm,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& undopld_strm,
    hls::stream <bool>& o_e0_strm,
    hls::stream <ap_uint <_WHash>>& o_hash_strm,
    hls::stream <COLUMN_DATA <_WPay, _KeyNM>>& o_key_strm,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& o_pld_strm,
    hls::stream <bool>& o_e1_strm
    )

update key uram for insert new key

update_pld_uram

#include "hash_max_freq.hpp"
template <
    int _WPay,
    int _PayNM,
    int _WHash,
    int _Wcnt
    >
void update_pld_uram (
    hls::stream <ap_uint <_WHash>>& i_hash_strm,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& i_key_strm,
    hls::stream <ap_uint <_WPay>>& strm_rng_in,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& i_pld_strm,
    hls::stream <bool>& i_e_strm,
    unsigned int& max_count,
    unsigned int& max_key,
    unsigned int& max_rng,
    ap_uint <32> op,
    ap_uint <_Wcnt> pld_column,
    hls::stream <ap_uint <_WPay>>& o_max_key_strm,
    hls::stream <bool>& o_max_end_strm,
    ap_uint <_WPay>* pld_uram0
    )

update pld uram to calculate aggregate

update_uram

#include "hash_max_freq.hpp"
template <
    int _HashMode,
    int _WHash,
    int _WKey,
    int _KeyNM,
    int _WPay,
    int _PayNM,
    int _Wcnt,
    int _WBuffer,
    int _BurstLenW
    >
void update_uram (
    hls::stream <ap_uint <_WHash>>& i_hash_strm,
    hls::stream <COLUMN_DATA <_WKey, _KeyNM>>& i_key_strm,
    hls::stream <ap_uint <_WKey>>& strm_rng_in,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& i_pld_strm,
    hls::stream <bool>& i_e_strm,
    unsigned int& max_count,
    unsigned int& max_key,
    unsigned int& max_rng,
    ap_uint <32> op,
    ap_uint <32> key_column,
    ap_uint <32> pld_column,
    ap_uint <32> round,
    ap_uint <32>& unhandle_cnt,
    hls::stream <ap_uint <_WPay>>& o_max_key_strm,
    hls::stream <bool>& o_max_end_strm,
    ap_uint <_WKey+_Wcnt>* key_uram,
    ap_uint <_WPay>* pld_uram0,
    ap_uint <_WBuffer>* out_buf
    )

compute aggregate result and update URAM

hash_aggr_pu_wrapper

#include "hash_max_freq.hpp"
template <
    int _HashMode,
    int _WHash,
    int _WKey,
    int _KeyNM,
    int _WPay,
    int _PayNM,
    int _Wcnt,
    int _WBuffer,
    int _BurstLenW
    >
void hash_aggr_pu_wrapper (
    hls::stream <ap_uint <_WHash>>& i_hash_strm,
    hls::stream <COLUMN_DATA <_WKey, _KeyNM>>& i_key_strm,
    hls::stream <ap_uint <_WKey>>& strm_rng_in,
    hls::stream <COLUMN_DATA <_WPay, _PayNM>>& i_pld_strm,
    hls::stream <bool>& i_e_strm,
    ap_uint <_WBuffer>* out_buf,
    unsigned int& max_count,
    unsigned int& max_key,
    unsigned int& max_rng,
    ap_uint <32> op,
    ap_uint <32> key_column,
    ap_uint <32> pld_column,
    ap_uint <32> round,
    ap_uint <32>& unhandle_cnt,
    hls::stream <ap_uint <_WPay>>& o_max_key_strm,
    hls::stream <bool>& o_max_end_strm
    )

hash aggregate processing unit

hash_aggr_top

#include "hash_max_freq.hpp"
template <
    int _WKey,
    int _KeyNM,
    int _WPay,
    int _PayNM,
    int _HashMode,
    int _WHashHigh,
    int _WHashLow,
    int _CHNM,
    int _Wcnt,
    int _WBuffer,
    int _BurstLenW,
    int _BurstLenR
    >
void hash_aggr_top (
    hls::stream <ap_uint <_WKey>>& strm_key_in,
    hls::stream <ap_uint <_WKey>>& strm_rng_in,
    hls::stream <bool>& strm_e_in,
    unsigned int& max_count,
    unsigned int& max_key,
    unsigned int& max_rng,
    ap_uint <32> op_type [1<< _WHashHigh+1],
    ap_uint <32> key_column,
    ap_uint <32> pld_column,
    ap_uint <32> round,
    ap_uint <32> unhandle_cnt_r [1<< _WHashHigh],
    ap_uint <32> unhandle_cnt_w [1<< _WHashHigh],
    ap_uint <32>& aggregate_num,
    ap_uint <_WBuffer>* in_buf0,
    ap_uint <_WBuffer>* out_buf0,
    hls::stream <ap_uint <_WPay>>& o_max_key_strm,
    hls::stream <bool>& o_max_end_strm
    )

do hash_group_aggregate for once