11-25-2020 04:42 AM
Heya, I'm trying to write to a stream as defined in hls_stream.h
I'm just confused about how to use the write operator. Write seems to be defined as:
void operator << (const __STREAM_T__& wdata) {
write(wdata);
}
I tried this, but technically there's two operands here, right? strm_in and bla.
stream<in_strm> strm_in;
stream<out_strm> strm_out;
int input_size = 5;
int bla = 123;
strm_in << bla;
So I end up with this error:
../../../test_src.cpp: In function 'int main()':
../../../test_src.cpp:25:10: error: no match for 'operator<<' (operand types are 'hls::stream<in_strm>' and 'int')
strm_in << bla;
~~~~~~~~^~~~~~
In file included from ../../../Compressor/Huffman_Encoder.h:4:0,
from ../../../test_src.cpp:3:
E:/Xilinx/Vivado/2020.1/include/hls_stream.h:157:10: note: candidate: void hls::stream<__STREAM_T__, 0>::operator<<(const __STREAM_T__&) [with __STREAM_T__ = in_strm]
void operator << (const __STREAM_T__& wdata) {
The candidate it suggests is actually the one I wanna use. How can I actually use this?
11-25-2020 05:43 AM
@Huichelaar The types are different that you have for stream and what you are writing.
Take a look at this simple usage
include "hls_stream.h"
typedef hls::stream<int> in_t;
void top(in_t &out)
{
int a = 4;
out << a;
}
11-25-2020 05:43 AM
@Huichelaar The types are different that you have for stream and what you are writing.
Take a look at this simple usage
include "hls_stream.h"
typedef hls::stream<int> in_t;
void top(in_t &out)
{
int a = 4;
out << a;
}