DP-HLS
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
dp_hls_common.h
Go to the documentation of this file.
1 
6 #ifndef DP_HLS_DP_HLS_COMMON_H
7 #define DP_HLS_DP_HLS_COMMON_H
8 
9 #define RECTANGULAR 0
10 #define FIXED 1
11 
12 #include "params.h"
13 
18 const int PRAGMA_PE_NUM = PE_NUM;
19 
24 const int PRAGMA_N_BLOCKS = N_BLOCKS;
25 
31 typedef hls::vector<type_t, N_LAYERS> score_vec_t;
32 
46 struct ScorePack{
47  type_t score;
48  idx_t ck;
49  idx_t p_col;
50 };
51 
52 static_assert(MAX_QUERY_LENGTH % PE_NUM == 0, "MAX_QUERY_LENGTH must divide PE_NUM, compilation terminated!");
53 
58 #define CK_NUM (MAX_QUERY_LENGTH / PE_NUM)
59 
60 // Determine the memory size for different banding strategy.
61 #if defined(BANDING)
62 #if BANDING == 0
63 #define BANDING_NAMESPACE Rectangular
64 #define TBMEM_SIZE (CK_NUM * (MAX_REFERENCE_LENGTH + PE_NUM - 1))
65 #define TB_CHUNK_WIDTH (MAX_REFERENCE_LENGTH + PE_NUM - 1)
66 #define BANDWIDTH 0 // Just put here to make the fixed banded kernel compilable in rectangular mode.
67 #elif BANDING == 1
68 #ifndef BANDWIDTH
69 #error "BANDWIDTH must be defined in fixed banding kernel, please define BANDWIDTH."
70 #endif
71 #define BANDING_NAMESPACE Fixed
72 #define TBMEM_SIZE (CK_NUM * (2 * BANDWIDTH + PE_NUM - 1 + PE_NUM - 1))
73 #define TB_CHUNK_WIDTH (2 * BANDWIDTH + PE_NUM - 1 + PE_NUM - 1)
74 #else
75 #error "This Banding Strategy is not Supported. "
76 #endif
77 #else
78 #error "Banding Strategy is not Defined, Please define a banding strategy."
79 #endif
80 
81 
82 //typedef hls::vector<type_t, N_LAYERS> score_vec_t;
83 typedef score_vec_t init_col_score_block_t[MAX_QUERY_LENGTH];
84 typedef score_vec_t init_row_score_block_t[MAX_REFERENCE_LENGTH];
86 typedef score_vec_t wavefront_scores_inf_t[PE_NUM+1]; // chunk column scores inflated
87 typedef score_vec_t dp_mem_block_t[PE_NUM+1][2];
88 typedef score_vec_t chunk_col_scores_inf_t[PE_NUM+1]; // chunk column scores inflated
89 typedef hls::vector<idx_t, PE_NUM> idx_vec_t;
90 typedef tbp_t tbp_vec_t[PE_NUM];
91 typedef char_t input_char_block_t[PE_NUM];
92 
93 // Define Traceback Navigation Values
94 typedef ap_uint<3> tbr_t; // Traecback Result Type
95 #define AL_END (tbr_t) 0b000 // 0 stopping condition
96 #define AL_INS (tbr_t) 0b001 // 1 Align Insertion
97 #define AL_MMI (tbr_t) 0b010 // 2 Align Match/Mismatch
98 #define AL_DEL (tbr_t) 0b011 // 3 Align Deletion
99 #define AL_NULL (tbr_t) 0b100 // 4 Do not change coordinate
100 
101 typedef tbr_t traceback_buf_t[MAX_QUERY_LENGTH + MAX_REFERENCE_LENGTH];
102 
103 #endif //DP_HLS_DP_HLS_COMMON_H
hls::vector< type_t, N_LAYERS > score_vec_t
Vector of scores, used to store the scores of each layer in the same coordiante in the DP matrix...
Definition: dp_hls_common.h:31
A structure to hold score and index information.
Definition: dp_hls_common.h:46
score_vec_t chunk_col_scores_inf_t[PE_NUM+1]
Definition: dp_hls_common.h:88
score_vec_t wavefront_scores_t[PE_NUM]
Definition: dp_hls_common.h:85
idx_t ck
Definition: dp_hls_common.h:48
score_vec_t wavefront_scores_inf_t[PE_NUM+1]
Definition: dp_hls_common.h:86
type_t score
Definition: dp_hls_common.h:47
char_t input_char_block_t[PE_NUM]
Definition: dp_hls_common.h:91
const int PRAGMA_N_BLOCKS
Number of blocks, defined for use in pragma derivatives.
Definition: dp_hls_common.h:24
tbr_t traceback_buf_t[MAX_QUERY_LENGTH+MAX_REFERENCE_LENGTH]
Definition: dp_hls_common.h:101
score_vec_t init_row_score_block_t[MAX_REFERENCE_LENGTH]
Definition: dp_hls_common.h:84
const int PRAGMA_PE_NUM
Number of processing elements, defined for use in pragma derivatives.
Definition: dp_hls_common.h:18
score_vec_t dp_mem_block_t[PE_NUM+1][2]
Definition: dp_hls_common.h:87
score_vec_t init_col_score_block_t[MAX_QUERY_LENGTH]
Definition: dp_hls_common.h:83
tbp_t tbp_vec_t[PE_NUM]
Definition: dp_hls_common.h:90
ap_uint< 3 > tbr_t
Definition: dp_hls_common.h:94
idx_t p_col
Definition: dp_hls_common.h:49
hls::vector< idx_t, PE_NUM > idx_vec_t
Definition: dp_hls_common.h:89