C-Callable Library Example: HDL IP

You can find an example of a Vivado tools-packaged RTL IP in the samples/rtl_lib/arraycopy/build directory. This example includes two IP cores, each of which copies M elements of an array from its input to its output, where M is a scalar parameter that can vary with each function call.
  • arraycopy_aximm - array transfers using an AXI master interface in the IP.
  • arraycopy_axis - array transfers using AXI4-Stream interfaces.

The register mappings for the IPs are as follows.

// arraycopy_aximm
// 0x00 : Control signals
// bit 0 - ap_start (Read/Write/COH)
// bit 1 - ap_done (Read/COR)
// bit 2 - ap_idle (Read)
// bit 3 - ap_ready (Read)
// bit 7 - auto_restart (Read/Write)
// others - reserved
// 0x10 : Data signal of ap_return
// bit 31~0 - ap_return[31:0] (Read)
// 0x18 : Data signal of a
// bit 31~0 - a[31:0] (Read/Write)
// 0x1c : reserved
// 0x20 : Data signal of b
// bit 31~0 - b[31:0] (Read/Write)
// 0x24 : reserved
// 0x28 : Data signal of M
// bit 31~0 - M[31:0] (Read/Write)
// 0x2c : reserved
// (SC = Self Clear, COR = Clear on Read, TOW = Toggle on Write, COH = Clear on Handshake)

// arraycopy_axis
// 0x00 : Control signals
// bit 0 - ap_start (Read/Write/COH)
// bit 1 - ap_done (Read/COR)
// bit 2 - ap_idle (Read)
// bit 3 - ap_ready (Read)
// bit 7 - auto_restart (Read/Write)
// others - reserved
// 0x10 : Data signal of ap_return
// bit 31~0 - ap_return[31:0] (Read)
// 0x18 : Data signal of M
// bit 31~0 - M[31:0] (Read/Write)
// 0x1c : reserved
// (SC = Self Clear, COR = Clear on Read, TOW = Toggle on Write, COH = Clear on Handshake)
The makefile indicates how to use stdlib to create the library. To build the library, open a terminal shell in the SDSoC IDE, and from within the build directory, run
  • make librtl_arraycopy.a - to build a library for Linux applications
  • make standalone/lib_rtl_arraycopy.a - to build a library for standalone applications

A simple test example that employs both IPs is available in the samples/rtl_lib/arraycopy/use directory. In an SDSoC terminal shell, run make to create a Linux application that exercises both hardware functions.