Decompressor/Huffman_Decoder.cpp
//Build length code table. Takes 286 cycles
Build length code table. Takes 286 cycles
Build length code table . Takes 286 cycles
void build_length_table(
		ap_uint<4> length_codelengths[MAX_LEN_CODES],    
		ap_uint<9> length_code_table[MAX_LEN_CODES],     
		ap_uint<9> next_length_address[MAX_LEN_LENGTH+1] 
){
#pragma HLS INLINE off
	ap_uint<4> length_codelength; 
	L_Table_LoopC: for(int i = 0; i < MAX_LEN_CODES; i++){ 
#pragma HLS PIPELINE
		length_codelength = length_codelengths[i]; 
		if(length_codelength != 0){ 
			length_code_table[next_length_address[length_codelength]] = i; 
			next_length_address[length_codelength]++;
		}
	}
}
void build_length_table ( ap_uint < 4 > length_codelengths [ MAX_LEN_CODES ] , ap_uint < 9 > length_code_table [ MAX_LEN_CODES ] , ap_uint < 9 > next_length_address [ MAX_LEN_LENGTH + 1 ] ) { #pragma  HLS INLINE off ap_uint < 4 > length_codelength ; L_Table_LoopC : for ( int i = 0 ; i < MAX_LEN_CODES ; i ++ ) { #pragma  HLS PIPELINE length_codelength = length_codelengths [ i ] ; if ( length_codelength != 0 ) { length_code_table [ next_length_address [ length_codelength ] ] = i ; next_length_address [ length_codelength ] ++ ; } } }
Build length code table.
Build length code table .
//Input //Output //Input //Code length of encoded Length/Literal //Build Length/Literal Table //Read Length/Literal code length //If the length of a code is not 0 //At coded index, write symbol