Accessing External I/O via Direct Hardware Connections
Whereas the previous example demonstrated how applications can access system I/O through memory buffers, a platform can also provide direct hardware connectivity to hardware accelerators within an application generated in the SDSoC Environment. The following figure shows how a functions2mm_data_copy
communicates to the platform via an AXI4-Stream channel, and writes to DDR memory using the zero_copy datamover (implemented as an AXI4 master interface). This design template is calledUnpacketized AXI4-Stream to DDR
design example in thesamples/platforms/zc702_axis_io
platform (a similar design for the Zybo board is insamples/xc7z010/zybo_axis_io
).
In this example, thezc702_axis_io
platform proxies actual I/O by providing a free-running binary counter (labeled Platform IP in the diagram) running at 50 MHz, connected to an AXI4-Stream Data FIFO IP block that exports an AXI4-Stream master interface to the platform clocked at the data motion clock (which might differ from the 50 MHz input clock).
The direct I/O software interface can be found in thezc702_axis_io.hheader file located in the SDSoC install directory undersamples/platforms/zc702/aarch32-linux/include.
#pragma SDS data access_pattern(rbuf:SEQUENTIAL) void pf_read_stream(unsigned *rbuf);
In the code snippet below, the application defines a direct signal path from the platform input to a hardware function before transferring the output to memory.
// This function's data flow defines the accelerator network void s2mm_data_copy_wrapper(unsigned *buf) { unsigned rbuf0[1]; pf_read_stream(rbuf0); s2mm_data_copy(rbuf0,buf); }
The platform library provides thepf_read_stream
function that the sds++ linker maps onto the hardware stream port. Because the only use of therbuf0
output is the input to thes2mm_data_copy
function, the linker creates a direct hardware connection over an AXI4-Stream channel. Because thes2mm_data_copy
function transfersbuf
using the zero_copy data mover, the buffer must be allocated in physically contiguous memory usingsds_alloc
, and released usingsds_free
.
int main() { unsigned *bufs[NUM_BUFFERS]; for(int i=0; i
A tutorial of how to use this example design is provided inSDSoC Environment Tutorial: Introduction(UG1028).
A detailed tutorial on creating a platform using AXI4-Stream to write memory directly can be found inIntroduction.