MMIOAccelerator class This class provides the api to operate the accelerator. More...
#include <accelerator.hpp>
Public Member Functions | |
MMIOAccelerator ()=delete | |
Delete the default constructor since address is needed. | |
MMIOAccelerator (const uint64_t addr) | |
Construct a new MMIOAccelerator object. More... | |
virtual | ~MMIOAccelerator () |
~MMIOAccelerator destructor method Destroy the MMIOAccelerator object | |
Status | Start (const StartMode mode) override |
Start method. More... | |
Status | Stop () override |
Stop method. More... | |
Status | Sync () override |
Sync method. More... | |
int | GetMemoryBank (const uint pos) override |
Get the memory bank ID (not implemented) More... | |
DeviceStatus | GetStatus () override |
GetStatus method This returns the accelerator state by using the DeviceStatus. This reads the control register flags. More... | |
Status | Attach (const uint64_t index, std::shared_ptr< IMemory > mem) override |
Attach a memory argument. More... | |
![]() | |
virtual | ~IAccelerator ()=default |
~IAccelerator destructor method Destroy the IAccelerator object. | |
virtual Status | Start (std::shared_ptr< IExecutionGraph > graph, const StartMode mode) |
Start method (asynchronous) Please, refer to IAccelerator::Start 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 | Stop (std::shared_ptr< IExecutionGraph > graph) |
Stop method (asynchronous) Please, refer to IAccelerator::Stop 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) |
Sync method (asynchronous) Please, refer to IAccelerator::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... | |
template<typename T > | |
Status | Write (const uint64_t address, const T *data, const size_t elements=1) |
Write method Performs a write operation to the accelerator through a register. More... | |
template<typename T > | |
Status | Write (std::shared_ptr< IExecutionGraph > graph, const uint64_t address, const T *data, const size_t elements=1) |
Write method (asynchronous) Performs a write operation to the accelerator through a register in an execution graph. It returns as soon as the instruction is scheduled. More... | |
template<typename T > | |
Status | Read (const uint64_t address, T *data, const size_t elements=1) |
Read method Performs a write operation to the accelerator through a register. More... | |
template<typename T > | |
Status | Read (std::shared_ptr< IExecutionGraph > graph, const uint64_t address, T *data, const size_t elements=1) |
Read method (asynchronous) Performs a write operation to the accelerator through a register in an execution graph. It returns as soon as the instruction is scheduled. More... | |
template<typename T > | |
Status | Attach (const uint64_t index, T *data, const RegisterAccess access=RegisterAccess::WO, const size_t elements=1) |
Attach an argument Performs an attachment of the argument and the respective pointer. If the index/address to attach receives a nullptr, it gets detached. More... | |
template<typename T > | |
Status | Attach (const uint64_t index, T *data, const size_t elements, const RegisterAccess access=RegisterAccess::WO) |
Overload of the Attach<T>() More... | |
Protected Member Functions | |
Status | WriteRegister (const uint64_t address, const uint8_t *data, const size_t size) override |
Write Register method Writes to the register of the accelerator. More... | |
Status | ReadRegister (const uint64_t address, uint8_t *data, const size_t size) override |
Read Register method. More... | |
Status | AttachRegister (const uint64_t index, uint8_t *data, const RegisterAccess access, const size_t size) override |
Implementation of the Attach Register method. More... | |
![]() | |
virtual Status | WriteRegister (std::shared_ptr< IExecutionGraph > graph, const uint64_t address, const uint8_t *data, const size_t size) |
Write Register method (asynchronous) More... | |
virtual Status | ReadRegister (std::shared_ptr< IExecutionGraph > graph, const uint64_t address, uint8_t *data, const size_t size) |
Read Register method (asynchronous) More... | |
Additional Inherited Members | |
![]() | |
enum | Type { None = 0 , MMIO , XRT } |
Type Type of runtime supported by the IAccelerator. More... | |
![]() | |
static std::shared_ptr< IAccelerator > | Create (IAccelerator::Type impl, const uint64_t addr) |
Create method Factory method used for creating specific subclasses of IAccelerator. More... | |
static std::shared_ptr< IAccelerator > | Create (IAccelerator::Type impl, const std::string &kernelname, const std::shared_ptr< HardwareParameters > hwparams) |
Create method (overload) Factory method used for creating specific subclasses of IAccelerator. More... | |
MMIOAccelerator class This class provides the api to operate the accelerator.
|
explicit |
Construct a new MMIOAccelerator object.
It constructs an accessor to the accelerator in the PL design according to the AXI-lite memory mapping. This is widely compatible with AXI4-lite controlled HLS designs.
addr | 64-bit address in the physical memory space |
|
overridevirtual |
Attach a memory argument.
Performs an attachment of the argument and the respective pointer. The use of this overload for IMemory buffers is highly recommended.
index | Argument position of the argument to set |
mem | Memory buffer to attach to the argument |
Implements cynq::IAccelerator.
|
overrideprotectedvirtual |
Implementation of the Attach Register method.
index | index of the argument to set |
data | a pointer to an unsigned 8 bits variable which holds the data to read from the register. |
access | Access type of the register |
size | size in bytes of the data to read. |
Implements cynq::IAccelerator.
|
overridevirtual |
Get the memory bank ID (not implemented)
It corresponds to the argument memory argument for affinity. It is useful for assigning memory banks to the DataMovers before requesting any memory.
It is only used by Vitis and Alveo workflows
pos | memory bank position within the kernel |
Implements cynq::IAccelerator.
|
overridevirtual |
GetStatus method This returns the accelerator state by using the DeviceStatus. This reads the control register flags.
Implements cynq::IAccelerator.
|
overrideprotectedvirtual |
Read Register method.
address | a unsiged integer of 64 bits representing an address. |
data | a pointer to a unsigned 8 bits variable which holds the data to read from the register. |
size | size in bytes of the data to read. |
Implements cynq::IAccelerator.
|
overridevirtual |
Start method.
This method starts the accelerator in either once or continuous mode (with the autorestart). Under the hood, this writes the control register to turn on the accelerator with/without the autorestart bit.
It also synchronises the registers, writing them if attached.
mode | One of the values in the StartMode enum class present in the enums.hpp file. |
Implements cynq::IAccelerator.
|
overridevirtual |
Stop method.
This asynchronously turns off the accelerator by removing the autorestart and start bits from the control registers. Please, note that the accelerator will turn off once it finishes its current task.
It also synchronises the registers, reading them if attached.
Implements cynq::IAccelerator.
|
overridevirtual |
Sync method.
Forces to wait until the accelerator execution is different from "DeviceStatus::Running"
It also synchronises the registers, reading them if attached.
Implements cynq::IAccelerator.
|
overrideprotectedvirtual |
Write Register method Writes to the register of the accelerator.
address | a unsigned integer of 64 bits representing an address. |
data | a pointer to a unsigned 8 bits variable which holds the data to write to the register. |
size | size in bytes of the data to write. |
Implements cynq::IAccelerator.