HLS icon indicating copy to clipboard operation
HLS copied to clipboard

stream.full() Method Doesn't Work in Software Simulation

Open ioeddk opened this issue 2 years ago • 0 comments

When I use !stream.full() method as the loop execution condition for a while loop filling this stream, the loop runs infinitely. The code is compiled with g++ as a simple software simulation. Also, it won't end in the Vitis HLS software simulation. The simple testbench I use is the follows, which never ends: testbench.cpp:

#include <iostream>
#include "functions.h"

int main(){
    printf("Begin Test Stream Fill");
    hls::stream<int, 16> stm;
    stream_fill(stm);
    printf("Stream Fill Complete\n");

    return 0;
}

functions.h:

#ifndef FUNCTIONS_H
#define FUNCTIONS_H

#include <hls_stream.h>

void stream_fill(hls::stream<int, 16> &stm);

#endif

functions.cpp:

#include "functions.h"

void stream_fill(hls::stream<int, 16>& stm) {
	stm.write(0);
	stm.write(1);

	int i = 2;
	while (!stm.full()) {
		stm.write(i++);
	}
}

ioeddk avatar Jul 25 '23 22:07 ioeddk