Xilinx/HLS

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

Opened this issue · 0 comments

ioeddk commented

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++);
	}
}