sdsoc学习笔记-如何创建和使用一个C可调用的RTL库(二)

1.函数定义

函数接口定义了进入library的入口点,里面有一个函数或多个函数,用户可以在应用程序中调用这些函数进入RTL创建的IP。函数定义包含的是空的函数体,因为sdsoc编译器可以用API调用替换他们去执行与IP之间的数据传输。除了空函数体,函数定义还必须包括#include stdlib.h和stdio.h,在替换和编译函数体时要用到他们。下面是xilinx例程里面函数定义的源码:

#include <stdio.h>
#include <stdlib.h>

#include "arraycopy.h"

// Copy M values from array a to array b, or N (max array size) 
// values if M < 0 or M > N.
//
// Array arguments are mapped onto axis interfaces amenable to axi_dma_sg, 
// axi_dma_simple and axi_fifo datamovers, or direct connections.
//
// The transfer size M is passed to the hardware function with the 
// axi_lite datamover.
//
// @return max transferred value 
//
// See arraycopy.fcnmap.xml for the software/hardware interface mapping.
// 
// SDSoC will use this function definition to create a stub function to
// control the IP and transfer data between CPU and hardware function, and
// rewrite any calling code to invoke the generated stub in lieu of this
// function.
//
// For more information on importing HDL IP, refer to 
// UG1027 - Introduction to SDSoC, Chapter 16
// UG1146 - SDSoC Platforms and Libraries, Chapter 2
// 
int arraycopy_axis(int A[N], int B[N], int M) 
{
     // This function body can be non-empty if you want to provide a software
     // implemenation, but currently SDSoC does not support both hardware
     // and software implementations of the same function within the same
     // application.
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值