CYNQ  0.3.0
Framework to develop FPGA applications in C++ with the easiness of PYNQ
cynq::DMADataMover Class Reference

DMADataMover class Provides the api from which to interact with the data buffers responsable for memory operations making use of the Xilinx runtime (XRT) the types are the following: BO (Buffer object) DMA (Direct memory allocation) More...

#include <datamover.hpp>

Inheritance diagram for cynq::DMADataMover:
Collaboration diagram for cynq::DMADataMover:

Public Member Functions

 DMADataMover (const uint64_t addr, std::shared_ptr< HardwareParameters > hwparams)
 Construct a new DMADataMover object. More...
 
 DMADataMover ()=delete
 Default constructor. More...
 
virtual ~DMADataMover ()
 ~DMADataMover destructor method Destroy the DMADataMover object.
 
std::shared_ptr< IMemoryGetBuffer (const size_t size, const int memory_bank=0, const MemoryType type=MemoryType::Dual) override
 GetBuffer method This method allocates a memory buffer. Depending on the MemoryType, it allocates memory in a contiguous or memory region (non-pageable) or non contiguous memory region depending on the Memory typed past to the method. The memory can be mirrored with pageable memory for its use in the host (or CPU). More...
 
Status Upload (const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype) override
 Upload method This method moves the data from the host to the device using a DMA engine. This triggers the AXI Memory Map and AXI Stream Transactions under the hood. More...
 
Status Download (const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype) override
 Download method. More...
 
Status Sync (const SyncType type) override
 Sync method Synchronizes data movements in case of asynchronous Upload/Download. More...
 
DeviceStatus GetStatus () override
 GetStatus method Returns the status of the data mover in terms of transactions. More...
 
- Public Member Functions inherited from cynq::IDataMover
virtual ~IDataMover ()=default
 ~IDataMover destructor method Destroy the IDataMover object.
 
virtual Status Upload (std::shared_ptr< IExecutionGraph > graph, const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype)
 Upload method (asynchronous) Please, refer to IDataMover::Upload for reference. This overload performs an asynchronous execution of the function based on a graph of operations. It returns as soon as the operation is scheduled. More...
 
virtual Status Download (std::shared_ptr< IExecutionGraph > graph, const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype)
 Download method (asynchronous) Please, refer to IDataMover::Download for reference. This overload performs an asynchronous execution of the function based on a graph of operations. It returns as soon as the operation is scheduled. More...
 
virtual Status Sync (std::shared_ptr< IExecutionGraph > graph, const SyncType type)
 Sync method (asynchronous) Please, refer to IDataMover::Sync for reference. This overload performs an asynchronous execution of the function based on a graph of operations. It returns as soon as the operation is scheduled. More...
 

Additional Inherited Members

- Public Types inherited from cynq::IDataMover
enum  Type { None = 0 , DMA , XRT }
 Type Type of runtime supported by the IDataMover. More...
 
- Static Public Member Functions inherited from cynq::IDataMover
static std::shared_ptr< IDataMoverCreate (IDataMover::Type impl, const uint64_t addr, std::shared_ptr< HardwareParameters > hwparams)
 Create method Factory method used for creating specific subclasses of IDataMover. More...
 

Detailed Description

DMADataMover class Provides the api from which to interact with the data buffers responsable for memory operations making use of the Xilinx runtime (XRT) the types are the following: BO (Buffer object) DMA (Direct memory allocation)

Constructor & Destructor Documentation

◆ DMADataMover() [1/2]

cynq::DMADataMover::DMADataMover ( const uint64_t  addr,
std::shared_ptr< HardwareParameters hwparams 
)

Construct a new DMADataMover object.

This constructs a data mover that uses DMA to execute the transfers between the host and the device. Moreover, it uses XRT buffer object as memory buffers.

Parameters
addrDMA address in the physical memory map
hwparamsHardware-specific params

◆ DMADataMover() [2/2]

cynq::DMADataMover::DMADataMover ( )
delete

Default constructor.

The default constructor is deleted since the address is mandatory for the DMA transfer.

Member Function Documentation

◆ Download()

Status cynq::DMADataMover::Download ( const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
overridevirtual

Download method.

Parameters
memIMemory instance to download.
sizeSize in bytes of data being downloaded from the memory device by making use of the buffer.
offsetOffset in bytes where the device pointer should start
exetypeThe execution type to use for the download, this is either sync (synchronous) or async (asynchronous) execution.
Returns
Status

Implements cynq::IDataMover.

◆ GetBuffer()

std::shared_ptr< IMemory > cynq::DMADataMover::GetBuffer ( const size_t  size,
const int  memory_bank = 0,
const MemoryType  type = MemoryType::Dual 
)
overridevirtual

GetBuffer method This method allocates a memory buffer. Depending on the MemoryType, it allocates memory in a contiguous or memory region (non-pageable) or non contiguous memory region depending on the Memory typed past to the method. The memory can be mirrored with pageable memory for its use in the host (or CPU).

Parameters
sizeSize in bytes of the buffer.
typeOne of the values in the MemoryType enum class which can be one of the following: Dual (DIMM memory) Cacheable (cache) Host (Memory from the host) Device (Memory from the device to be mapped)
memory_bankCurrently unused
Returns
std::shared_ptr<IMemory>

Implements cynq::IDataMover.

◆ GetStatus()

DeviceStatus cynq::DMADataMover::GetStatus ( )
overridevirtual

GetStatus method Returns the status of the data mover in terms of transactions.

Returns
DeviceStatus

Implements cynq::IDataMover.

◆ Sync()

Status cynq::DMADataMover::Sync ( const SyncType  type)
overridevirtual

Sync method Synchronizes data movements in case of asynchronous Upload/Download.

Parameters
typesync type. Depending on the transaction, it will trigger sync
Returns
Status

Implements cynq::IDataMover.

◆ Upload()

Status cynq::DMADataMover::Upload ( const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
overridevirtual

Upload method This method moves the data from the host to the device using a DMA engine. This triggers the AXI Memory Map and AXI Stream Transactions under the hood.

Parameters
memXRTMemory instance to upload.
sizeSize in bytes of data being uploaded in the memory device by making use of the buffer.
offsetOffset in bytes where the device pointer should start
exetypeThe execution type to use for the upload, this is either sync (synchronous) or async (asynchronous) execution.
Returns
Status

Implements cynq::IDataMover.


The documentation for this class was generated from the following files: