The MM2S code (mm2s.cpp) is simple and as follows:
void mm2s(ap_int<32>* mem, hls::stream<ap_axis<32, 0, 0, 0> > &s, int size) {
for(int i = 0; i < size; i++) {
ap_axis<32, 0, 0, 0> x;
x.data = mem[i];
s.write(x);
The “mem” is the AXI-MM input to HLS kernel and “s” is the AXI-Stream output from the kernel. “for” loop input the data AXI-MM data and generates AXI-Stream data.
To compile the above code, we will use v++ -c –mode hls command:
v++ -c --mode hls --platform $(PLATFORM) --config mm2s.cfg
The above command will generate a HLS kernel mm2s.xo.