Decompressor/Huffman_Decoder.cpp
//Build distance code table. Takes 32 cycles
Build distance code table. Takes 32 cycles
Build distance code table . Takes 32 cycles
void build_distance_table(
		ap_uint<4> distance_codelengths[MAX_DIS_CODES],
		ap_uint<8> distance_code_table[MAX_DIS_CODES],
		ap_uint<8> next_distance_address[MAX_DIS_LENGTH+1]
){
#pragma HLS INLINE off
	ap_uint<4> distance_codelength; 
	D_Table_LoopC: for(int i = 0; i < MAX_DIS_CODES; i++){ 
#pragma HLS PIPELINE
		distance_codelength = distance_codelengths[i]; 
		if(distance_codelength != 0){ 
			distance_code_table[next_distance_address[distance_codelength]] = i; 
			next_distance_address[distance_codelength]++;
		}
	}
}
void build_distance_table ( ap_uint < 4 > distance_codelengths [ MAX_DIS_CODES ] , ap_uint < 8 > distance_code_table [ MAX_DIS_CODES ] , ap_uint < 8 > next_distance_address [ MAX_DIS_LENGTH + 1 ] ) { #pragma  HLS INLINE off ap_uint < 4 > distance_codelength ; D_Table_LoopC : for ( int i = 0 ; i < MAX_DIS_CODES ; i ++ ) { #pragma  HLS PIPELINE distance_codelength = distance_codelengths [ i ] ; if ( distance_codelength != 0 ) { distance_code_table [ next_distance_address [ distance_codelength ] ] = i ; next_distance_address [ distance_codelength ] ++ ; } } }
Build distance code table.
Build distance code table .
//Code length of encoded Distance //Build Distance Table //Read Distance code length //If the length of a code is not 0 //At coded index, write symbol