namespace internal

// unions

union toFloat

mem2NStrmBP

#include "xf_data_analytics/geospatial/block_merge_tree.hpp"
template <
    typename DT,
    int CH,
    int BN,
    int BL = 1024
    >
void mem2NStrmBP (
    int sz,
    DT* i_buf,
    hls::stream <DT> o_strm [CH],
    hls::stream <bool> o_bp_strm [CH],
    hls::stream <bool> o_end_strm [CH]
    )

mem2NStrmBP memory to N stream with back-pressure

Parameters:

DT data type
CH output channel number
BN block length
BL burst length of AXI read

split_csv_stream

#include "xf_data_analytics/geospatial/knn.hpp"
void split_csv_stream (
    hls::stream <xf::data_analytics::dataframe::Object>& obj_strm,
    hls::stream <ap_uint <32>>& idx_strm,
    hls::stream <float>& x_strm,
    hls::stream <float>& y_strm,
    hls::stream <bool>& strm_out_end
    )

split object stream of csv parser into seperate streams for distance computation.

Parameters:

obj_strm stream of csv parser output object
idx_strm stream of point index
x_strm stream of point x coordinate
y_strm stream of point y coordinate
strm_out_end stream end flags

compute_distance

#include "xf_data_analytics/geospatial/knn.hpp"
void compute_distance (
    hls::stream <float>& x_strm,
    hls::stream <float>& y_strm,
    hls::stream <bool>& strm_in_end,
    float base_x,
    float base_y,
    hls::stream <float>& distance_strm,
    hls::stream <bool>& strm_out_end
    )

Compute distance between input point and base point. Euclidean distance is used.

Parameters:

x_strm stream of input point x coordinate
y_strm stream of input point y coordinate
strm_in_end input stream end flag
base_x base point x coordinate
base_y base point y coordinate
distance_strm stream of output distance
strm_out_end output stream end flag

write2mem

#include "xf_data_analytics/geospatial/knn.hpp"
template <int CSV_PU_NUM = 2>
void write2mem (
    ap_uint <32> line_cnt_buf [CSV_PU_NUM/2][2],
    hls::stream <float>& sorted_distance_strm,
    hls::stream <ap_uint <32>>& sorted_index_strm,
    hls::stream <bool>& strm_in_end,
    float* distance,
    uint32_t* index
    )

Postprocess and write result to DDR.

Parameters:

CSV_PU_NUM num of csv parser used to parallel parse csv data
line_cnt_buf num of csv lines that each pu processes
sorted_distance_strm input stream of sorted distance
sorted_index_strm input stream of sorted point index
strm_in_end input stream end flag
distance output sorted top-k distance
index output sorted top-k index