平台专用硬件配置 - 2022.1 简体中文

Vitis 统一软件平台文档 应用加速开发 (UG1393)

Document ID
UG1393
Release Date
2022-05-25
Version
2022.1 简体中文

指南宏 中所述,SYS_PORT 连接可使用 SYS_PORT_PFM 宏根据平台来加以自定义。但如需添加新平台,则需要修改头文件,那么 make 将为现有且已编译的平台重新构建硬件,但这是不可取的。为避免此问题,行之有效的办法是为每个平台创建独立的配置头文件,并使用 -I CFLAG 来为给定平台包含正确的头文件。例如:

ifneq (,$(findstring u50,$(DEVICE)))
  EXTRA_CFLAGS := -I include/u50
else
  EXTRA_CFLAGS := -I include/u200
endif

加速器头文件包含公用文件(例如,config.hpp)这是一个自定义文件,在独立目录中提供,以便于进行平台专用配置,例如,计算单元数量和端口映射,如下示例所示:

表 1. 其它 Makefile 变量
在 ACC 类规范中 include/u50/config.hpp include/u200/config.hpp
#include "config.hpp"
// Accelerator class
class pipelined_cu : public VPP_ACC<pipelined_cu, NCU>
{ ...
    SYS_PORT(A, PORT_MAP_A);
    SYS_PORT(B, PORT_MAP_B);
    SYS_PORT(E, PORT_MAP_E);
#define NCU 2
// global memory connections to Accelerator ports
#define PORT_MAP_A (HBM[0]:HBM[2])
#define PORT_MAP_B (HBM[0]:HBM[2])
#define PORT_MAP_E (HBM[0]:HBM[2])
#define NCU 3
// global memory connections to Accelerator ports
#define PORT_MAP_A (DDR[0]:DDR[1]:DDR[2])
#define PORT_MAP_B (DDR[0]:DDR[1]:DDR[2])
#define PORT_MAP_E (DDR[0]:DDR[1]:DDR[2])