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

Interface for standardising the API of DataMover for a specific device: XRTDataMover. More...

#include <datamover.hpp>

Inheritance diagram for cynq::IDataMover:

Public Types

enum  Type { None = 0 , DMA , XRT }
 Type Type of runtime supported by the IDataMover. More...
 

Public Member Functions

virtual ~IDataMover ()=default
 ~IDataMover destructor method Destroy the IDataMover object.
 
virtual std::shared_ptr< IMemoryGetBuffer (const size_t size, const int memory_bank=0, const MemoryType type=MemoryType::Dual)=0
 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...
 
virtual Status Upload (const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype)=0
 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...
 
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 (const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype)=0
 Download method. 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 (const SyncType type)=0
 Sync method Synchronizes data movements in case of asynchronous Upload/Download. 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...
 
virtual DeviceStatus GetStatus ()=0
 GetStatus method Returns the status of the data mover in terms of transactions. More...
 

Static Public Member Functions

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

Interface for standardising the API of DataMover for a specific device: XRTDataMover.

Member Enumeration Documentation

◆ Type

Type Type of runtime supported by the IDataMover.

Enumerator
None 

No runtime

DMA 

DMA-based runtime

XRT 

XRT-based runtime

Member Function Documentation

◆ Create()

std::shared_ptr< IDataMover > cynq::IDataMover::Create ( IDataMover::Type  impl,
const uint64_t  addr,
std::shared_ptr< HardwareParameters hwparams 
)
static

Create method Factory method used for creating specific subclasses of IDataMover.

Parameters
implUsed for establishin if the object is dependent on a runtime, use None if this is not the case.
addrA 64 bit unsigned integer representing the beginning address of the IDataMover.
hwparamsHardware-specific parameters to configure the data mover and grab the correct memory blocks
Returns
std::shared_ptr<IDataMover> This is a shared_ptr with reference counting, the type will depend on the value of impl, the options are the following: following: XRT -> XRTDatamover None -> nullptr

◆ Download() [1/2]

virtual Status cynq::IDataMover::Download ( const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
pure virtual

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

Implemented in cynq::XRTDataMover, and cynq::DMADataMover.

◆ Download() [2/2]

Status cynq::IDataMover::Download ( std::shared_ptr< IExecutionGraph graph,
const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
virtual

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.

Parameters
graphExecution graph to execute on. If nullptr is passed, the execution will be synchronous.
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. In case of async execution type, a Sync call must be performed afterwards to get coherent results.
Returns
Status

◆ GetBuffer()

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

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_bankMemory bank corresponding to the memory to be allocated. It is used for XRT-based data allocators.
Returns
std::shared_ptr<IMemory>

Implemented in cynq::XRTDataMover, and cynq::DMADataMover.

◆ GetStatus()

virtual DeviceStatus cynq::IDataMover::GetStatus ( )
pure virtual

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

Returns
DeviceStatus

Implemented in cynq::XRTDataMover, and cynq::DMADataMover.

◆ Sync() [1/2]

virtual Status cynq::IDataMover::Sync ( const SyncType  type)
pure virtual

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

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

Implemented in cynq::XRTDataMover, and cynq::DMADataMover.

◆ Sync() [2/2]

Status cynq::IDataMover::Sync ( std::shared_ptr< IExecutionGraph graph,
const SyncType  type 
)
virtual

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.

Parameters
graphExecution graph to execute on. If nullptr is passed, the execution will be synchronous.
typesync type. Depending on the transaction, it will trigger sync
Returns
Status

◆ Upload() [1/2]

virtual Status cynq::IDataMover::Upload ( const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
pure virtual

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
memIMemory 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

Implemented in cynq::XRTDataMover, and cynq::DMADataMover.

◆ Upload() [2/2]

Status cynq::IDataMover::Upload ( std::shared_ptr< IExecutionGraph graph,
const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
virtual

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.

Parameters
graphExecution graph to execute on. If nullptr is passed, the execution will be synchronous.
memIMemory 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. In case of async execution type, a Sync call must be performed afterwards to get coherent results.
Returns
Status

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