1st you need to write your IP so it has AXI-stream interfaces. this is explained and shown in the 2nd video. you will have 1 or 2 axi stream ins and outs? and your ctrl signals.
2nd a normal DMA is easier to use to begin with, the VDMA is a bit weird in its use of control signals of the axi stream interface.
maybe stupidly enough, reproduce the tutorial given in the 2nd video, and implement it first? then you’ll get how axi stream interfaces work on the most basic level and then you can go from there.
below is an exerpt (probably horribly inefficient) of a convert to grayscale HLS core using normal DMA. On the PS, you just open an image, put it in a [n]x[m]x[3] array and stream it to PL.
#include “cvt2gray.h”
void cvtgray(int xres, int yres,axi_stream& img_in, axi_stream& img_out){
#pragma HLS PIPELINE II=2
#pragma HLS INTERFACE s_axilite port=yres
#pragma HLS INTERFACE s_axilite port=xres
#pragma HLS INTERFACE axis port=img_in
#pragma HLS INTERFACE axis port=img_out
#pragma HLS interface s_axilite port=return
axi_pixel pix_in1_r,pix_in1_g,pix_in1_b;
axi_pixel pix_out_r,pix_out_g,pix_out_b;
uint8_t r1,g1,b1,gray1;
for(int i=0;i<yres;i++){
#pragma HLS LOOP_TRIPCOUNT min=1 max=4000
for (int j=0;j<xres;j++){
#pragma HLS LOOP_TRIPCOUNT min=1 max=4000
pix_in1_r=img_in.read(); //you read the 3 color values
pix_in1_g=img_in.read();
pix_in1_b=img_in.read();
**insert mathemagic here**
r1=pix_in1_r.data*0.11;
g1=pix_in1_g.data*0.59;
b1=pix_in1_b.data*0.30;
gray1=r1+g1+b1;
**manually set the control signals**
pix_out_r.data=gray1;
pix_out_r.dest=pix_in1_r.dest;
pix_out_r.id=pix_in1_r.id;
pix_out_r.keep=pix_in1_r.keep;
pix_out_r.last=pix_in1_r.last;
pix_out_r.strb=pix_in1_r.strb;
pix_out_r.user=pix_in1_r.user;
pix_out_g.data=gray1;
pix_out_g.dest=pix_in1_g.dest;
pix_out_g.id=pix_in1_g.id;
pix_out_g.keep=pix_in1_g.keep;
pix_out_g.last=pix_in1_g.last;
pix_out_g.strb=pix_in1_g.strb;
pix_out_g.user=pix_in1_g.user;
pix_out_b.data=gray1;
pix_out_b.dest=pix_in1_b.dest;
pix_out_b.id=pix_in1_b.id;
pix_out_b.keep=pix_in1_b.keep;
pix_out_b.last=pix_in1_b.last;
pix_out_b.strb=pix_in1_b.strb;
pix_out_b.user=pix_in1_b.user;
**write it to the output stream**
img_out.write(pix_out_r);
img_out.write(pix_out_g);
img_out.write(pix_out_b);
}
}
the .h file:
#include <stdio.h>
#include <stdint.h>
#include “hls_stream.h”
#include “hls_video.h”
#include “ap_utils.h”
#include “ap_fixed.h”
#include “ap_int.h”
#define max_width 1920
#define max_height 1200
typedef ap_axiu<8,2,5,6> axi_pixel;
typedef hls::stream<axi_pixel> axi_stream;
void cvtgray(int xres, int yres,axi_stream& img_in, axi_stream& img_out);