Decompressor/Huffman_Decoder.cpp
//Function for filling accumulator with bits from input stream. Input variable "num" is the number of bits to obtain.
//If accumulator already contains the number of needed bits, no more are read.
Function for filling accumulator with bits from input stream. Input variable "num" is the number of bits to obtain.
If accumulator already contains the number of needed bits, no more are read.
Function for filling accumulator with bits from input stream . Input variable " num " is the number of bits to obtain . If accumulator already contains the number of needed bits no more are read .
void fetch_bits(
		int num,				    
		stream<io_stream> &in_strm, 
		io_stream &in_buff,		    
		ap_uint<8> &bit_count,		    
		ap_uint<64> &acc			    
){
#pragma HLS INLINE
	if((bit_count < num) & !in_buff.last){ 
		in_strm >> in_buff;	
		acc |= (ap_uint<64>)in_buff.data << bit_count;  
		bit_count += 32; 
	}
}
void fetch_bits ( int num , stream < io_stream > & in_strm , io_stream & in_buff , ap_uint < 8 > & bit_count , ap_uint < 64 > & acc ) { #pragma  HLS INLINE if ( ( bit_count < num ) & ! in_buff . last ) { in_strm >> in_buff ; acc |= ( ap_uint < 64 > ) in_buff . data << bit_count ; bit_count += 32 ; } }
Function for filling accumulator with bits from input stream.
Function for filling accumulator with bits from input stream .
//Input //Input //In/Out //In/Out //In/Out //Inlining function automatically optimizes function usage to read one byte or two depending on input num //If bit_count is still less than num and TLAST hasn't been asserted, read another byte //Read 1 byte from input stream into buffer //Append data to the left of current bits in acc. Assuming little endian data //Update number of bits in acc