GMIO - 2020.2 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
UG1076
Release Date
2020-11-24
Version
2020.2 English

This class represents the I/O port attribute specification used to connect graph kernels to the external virtual platform ports representing global memory (DDR) connections.

Constructors

GMIO(const std::string& logical_name, int burst_length, int bandwidth);

This GMIO port attribute specification is used to connect AI Engine kernels with the DDR or connect PL blocks with the DDR. The logical_name is the name of the port as presented in the interface data sheet. The burst_length is the length of the DDR burst transaction (can be 64, 128, or 256 bytes), and the bandwidth is the average expected throughput in MB/s.

Member Functions

static void* malloc(size_t size);

The malloc method allocates contiguous physical memory space and returns the corresponding virtual address. It accepts a parameter, size, to specify how many bytes to be allocated. If successful, the pointer to the allocated memory space is returned. nullptr is returned in the event of a failure.

static void free(void* address);

The free method frees memory space allocated by GMIO::malloc.

return_code gm2aie_nb(const void* address, size_t transaction_size);

The gm2aie_nb method initiates a DDR to AI Engine transfer. The memory space for the transaction is specified by the address pointer and the transaction_size parameter (in bytes). The transaction memory space needs to be within the total memory space allocated by the GMIO::malloc method. This method can only be used by platform source GMIO objects. It is a non-blocking function in that it does not wait for the read transaction to complete.

return_code aie2gm_nb(void* address, size_t transaction_size);

The aie2gm_nb method initiates an AI Engine to DDR transfer. The memory space for the transaction is specified by the address pointer and the transaction_size parameter (in bytes). The transaction memory space needs to be within the total memory space allocated by the GMIO::malloc method. This method can only be used by platform sink GMIO objects. It is a non-blocking function in that it does not wait for the write transaction to complete.

return_code wait();

The wait method blocks until all the previously issued transactions are complete. This method is only applicable for GMIO objects connected to AI Engine.

return_code gm2aie(const void* address, size_t transaction_size);

The gm2aie method is a blocking version of gm2aie_nb. It blocks until the AI Engine–DDR read transaction completes.

return_code aie2gm(void* address, size_t transaction_size);

The aie2gm method is a blocking version of aie2gm_nb. It blocks until the AI Engine–DDR write transaction completes.

return_code pl_gm(void* address, size_t total_size);
The pl_gm method sets the PL m_axi port start address in the AXI4-Lite interface. The start address of the vitual memory space for the PL m_axi port is specified by the address parameter. The total size of the memory to be accessed is specified by size parameter.

In Linux, these GMIO member functions must use PS virtual memory addresses through void* pointers returned by GMIO::malloc in the PS program.

For bare metal, the virtual address and physical address are the same. There is no need to call GMIO::malloc and GMIO::free. But you can call it for consistency.