c_src/read_source/core1/Overlays/stream.cc
//
// reads one transaction from the buffer
//
reads one transaction from the buffer
reads one transaction from the buffer
void pr_flow::stream::read( wide_t* data )
{
	uint64x2_t v_data;
	uint8_t debug_counter=0;
	while(1)
	{
		if( (this->tail == this->head) )
		{
			 not allowed to read when the pointers are equal and the full bit is zero
			 can read when pointers are equal and fullness is set this means writer is much faster
			this->head = this->buff[HEAD_POINTER].lower_32;
#ifdef DEBUG_STREAMS
			debug_counter++;
			if(debug_counter == 128)
			{
				debug_counter =0;
				this->bsp_table->debug(this->axi_config,this->stream_id);
			}
#endif
        }
		else
		{
			 issue a 128 bit vector load and store in local return
			v_data = vld1q_u64((const uint64_t*)&this->buff[this->tail] );
			vst1q_u64((uint64_t*)&data->lower_32,v_data);
            this->tail++;
            this->tail = this->tail & this->buff_size;
#ifdef DEBUG_STREAMS_PRINT
            printf("head: %d tail: %d \n",this->head,this->tail);
#endif
             write our new updated position
            this->buff[TAIL_POINTER].lower_32 = this->tail;
#ifdef DEBUG_STREAMS_COUNT
            this->bytes_read++;
#endif
            return;
		}
	}
}
void pr_flow :: stream :: read ( wide_t * data ) { uint64x2_t v_data ; uint8_t debug_counter = 0 ; while ( 1 ) { if ( ( this -> tail == this -> head ) ) { this -> head = this -> buff [ HEAD_POINTER ] . lower_32 ; #ifdef DEBUG_STREAMS debug_counter ++ ; if ( debug_counter == 128 ) { debug_counter = 0 ; this -> bsp_table -> debug ( this -> axi_config , this -> stream_id ) ; } #endif } else { v_data = vld1q_u64 ( ( const uint64_t * ) & this -> buff [ this -> tail ] ) ; vst1q_u64 ( ( uint64_t * ) & data -> lower_32 , v_data ) ; this -> tail ++ ; this -> tail = this -> tail & this -> buff_size ; #ifdef DEBUG_STREAMS_PRINT printf ( " \n " , this -> head , this -> tail ) ; #endif this -> buff [ TAIL_POINTER ] . lower_32 = this -> tail ; #ifdef DEBUG_STREAMS_COUNT this -> bytes_read ++ ; #endif return ; } } }
reads one transaction from the buffer
reads one transaction from the buffer
// // not allowed to read when the pointers are equal and the full bit is zero // can read when pointers are equal and fullness is set this means writer is much faster // // issue a 128 bit vector load and store in local return // write our new updated position