首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

不同的AXI总线卷积加速模块4

不同的AXI总线卷积加速模块4

版本三先尝试生成更小的LUT
  • 该模块拥有19个32位寄存器
  • 其中前9个寄存器用来保存需要计算的值
  • 卷积核固定在Verilog中,用来生成更小的LUT
  • 一个计算只需要四个总线周期
性能测试仍然软件消耗33秒,卷积IP核心40秒
基本否决是LUT问题。
下面测试AXI总线问题:
假设所有数据均来自于FPGA,无需从总线写入:
void Conv_HW(int filter[3][3], int arr[100][100], int arrW, int arrH) {    int i, j;    i = 2; j = 2;    for (i = 2; i < arrH; i++) {        for (j = 2; j <  arrW; j++) {            res[j] = Xil_In32(XPAR_CONV_0_S00_AXI_BASEADDR + 72);        }    }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
只需要9.47秒即可完成计算,并传回CPU !!!
总结至此,基本上可以否决利用AXI传数据的可能,所有需要利用AXI总线传输数据的模块均会被总线周期所连累,在优化了传输后,仍然无法解决该问题。确实需要一个更快的方式来传输数据。
在Altera的NIOS2中,直接利用IO口传输数据,无需总线周期,再因为NIOS II内核没有流水线优化,所以硬件确实比较快。
附1:AXI4 总线的 FPGA 接口部分先看总线接口:
        // Users to add ports here        // User ports ends        // Do not modify the ports beyond this line        // Global Clock Signal        // 全局时钟        input wire  S_AXI_ACLK,        // Global Reset Signal. This Signal is Active LOW        // 全局复位信号        input wire  S_AXI_ARESETN,        // Write address (issued by master, acceped by Slave)        // 写地址         input wire [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_AWADDR,        // 写地址的保护模式 包括privilege和security level        // Write channel Protection type. This signal indicates the    // privilege and security level of the transaction, and whether    // the transaction is a data access or an instruction access.        input wire [2 : 0] S_AXI_AWPROT,        // 写地址有效信号。为高指示地址有效。        // Write address valid. This signal indicates that the master signaling    // valid write address and control information.        input wire  S_AXI_AWVALID,        // 写地址准备信号。为高表示从设备空闲,准备接收地址;为低表示从设备忙。        // ********** 注意 这里是地址 下面是数据 ********        // Write address ready. This signal indicates that the slave is ready    // to accept an address and associated control signals.        output wire  S_AXI_AWREADY,        // 写数据,32位到1024位宽        // 从主设备来的数据 从设备接收        // Write data (issued by master, acceped by Slave)         input wire [C_S_AXI_DATA_WIDTH-1 : 0] S_AXI_WDATA,        // 写字节选通,用于表示更新存储器的字节通道,对于数据总线的每8位数据有一位写选通信号。        // Write strobes. This signal indicates which byte lanes hold    // valid data. There is one write strobe bit for each eight    // bits of the write data bus.            input wire [(C_S_AXI_DATA_WIDTH/8)-1 : 0] S_AXI_WSTRB,        // 写有效。为高指示数据有效。        // Write valid. This signal indicates that valid write    // data and strobes are available.        input wire  S_AXI_WVALID,        // 写准备。为高表示从设备空闲,准备接收数据;为低表示从设备忙。        // Write ready. This signal indicates that the slave    // can accept the write data.        output wire  S_AXI_WREADY,        // 写响应。该信号表示写状态,可允许相应的表示为OKAY\EXOKAY\SLVERR\DECERR。        // Write response. This signal indicates the status    // of the write transaction.        output wire [1 : 0] S_AXI_BRESP,
返回列表