FPGA(HLS)实现神经网络的 Add函数、Maxpool函数、upsample2D函数

#include"addp_upool.h"
#include "string.h"

Dtype_16f maxfour(Dtype_16f a,Dtype_16f b,Dtype_16f c,Dtype_16f d){
	return max(max(a,b),max(c,d));
}
void cpy_poolbuf(Dtype_16f* In_ddr,Dtype_16f pool_bus1[Tww],INT8 Tw,int of){
	memcpy(pool_bus1, (Dtype_16f *)(In_ddr + of), Tw*sizeof(Dtype_16f));
}
void addcpdr2_lin(Dtype_16f* In_ddr,Dtype_16f* In_ddr2,Dtype_16f pool_bus1[Tww],Dtype_16f pool_bus2[Tww],Dtype_11f hz,Dtype_11f wz,Dtype_11f cz,Dtype_11f win,
		Dtype_19f winxhin,Dtype_16f t,Dtype_11f inchan,INT8 Tw,Dtype_16f inxTh){
	if(t>=inxTh)
		return;
	Dtype_11f t1=t%inchan;
	Dtype_11f t2=t/inchan;
	Dtype_11f c=t1+cz;
	Dtype_11f h=t2+hz;
	int of=c*winxhin+h*win+wz;
	cpy_poolbuf(In_ddr, pool_bus1, Tw, of);
	cpy_poolbuf(In_ddr2, pool_bus2, Tw, of);
}
void addcplin2_buf(Dtype_16f pool_in[inchannel][Thh][Tww],Dtype_16f pool_bus1[Tww],Dtype_16f pool_bus2[Tww],
			Dtype_16

你可能感兴趣的:(笔记)