当前位置:   article > 正文

基于PYNQ的神经网络硬件加速(一)pool实现_hls硬件加速方案指令

hls硬件加速方案指令

 

pool_core.h

  1. #ifndef __POOL_CORE_H__
  2. #define __POOL_CORE_H__
  3. #include <ap_int.h>
  4. #include <iostream>
  5. typedef float Dtype_f;
  6. void Pool(ap_uint<16> CHin,ap_uint<16> Hin,ap_uint<16> Win,
  7. ap_uint<8> Kx,ap_uint<8> Ky,ap_uint<2> mode,
  8. Dtype_f feature_in[],Dtype_f feature_out[]
  9. );//mode: 0:MEAN, 1:MIN, 2:MAX
  10. #endif

pool_core.cpp

  1. #include "pool_core.h"
  2. #define max(a,b) ((a>b)?a:b)
  3. #define min(a,b) ((a>b)?b:a)
  4. void Pool(ap_uint<16> CHin,ap_uint<16> Hin,ap_uint<16> Win,
  5. ap_uint<8> Kx,ap_uint<8> Ky,ap_uint<2> mode,
  6. Dtype_f feature_in[],Dtype_f feature_out[]
  7. )//mode: 0:MEAN, 1:MIN, 2:MAX
  8. {
  9. #pragma HLS INTERFACE m_axi depth=4294967295 port=feature_out offset=slave
  10. #pragma HLS INTERFACE m_axi depth=4294967295 port=feature_in offset=slave
  11. #pragma HLS INTERFACE s_axilite port
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/425715
推荐阅读
相关标签
  

闽ICP备14008679号