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

Interface for standardising the API of Hardware Devices: More...

#include <hardware.hpp>

Inheritance diagram for cynq::IHardware:

Public Types

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

Public Member Functions

virtual ~IHardware ()=default
 ~IHardware destructor method Destroy the IHardware object.
 
virtual Status Reset ()=0
 Reset method Sets the IHardware instance to its initial state. More...
 
virtual std::shared_ptr< IDataMoverGetDataMover (const uint64_t address)=0
 GetDataMover method Used for accessing the IDataMover instance of IHardware inheritors for decoupling the DataMovement separating the hardware logic from the data movement logic. More...
 
virtual std::shared_ptr< IAcceleratorGetAccelerator (const uint64_t address)=0
 GetAccelerator method IAccelerator instance of IAccelerator inheritors separating the hardware logic from the specific logic of the accelerator. More...
 
virtual std::shared_ptr< IAcceleratorGetAccelerator (const std::string &kernelname)=0
 GetAccelerator method IAccelerator instance of IAccelerator inheritors separating the hardware logic from the specific logic of the accelerator. More...
 
virtual std::shared_ptr< IExecutionGraphGetExecutionStream (const std::string &name, const IExecutionGraph::Type type=IExecutionGraph::Type::STREAM, const std::shared_ptr< ExecutionGraphParameters > params=nullptr)
 GetExecutionStream. More...
 
virtual std::vector< float > GetClocks () noexcept
 Get clocks from the PL. More...
 
virtual Status SetClocks (const std::vector< float > &clocks)
 Set clocks to the PL. More...
 

Static Public Member Functions

static std::shared_ptr< IHardwareCreate (const HardwareArchitecture hw, const std::string &bitstream, const std::string &xclbin)
 Create method Factory method to create a hardware-specific subclasses for accelerators and data movers. More...
 
static std::shared_ptr< IHardwareCreate (const HardwareArchitecture hw, const std::string &config)
 Create method Factory method to create a hardware-specific subclasses for accelerators and data movers. More...
 

Detailed Description

Interface for standardising the API of Hardware Devices:

  • no inheritors -

Member Enumeration Documentation

◆ Type

Type Type of runtime supported by the IHardware.

Enumerator
None 

No runtime

XRT 

Xilinx runtime

Member Function Documentation

◆ Create() [1/2]

std::shared_ptr< IHardware > cynq::IHardware::Create ( const HardwareArchitecture  hw,
const std::string &  bitstream,
const std::string &  xclbin 
)
static

Create method Factory method to create a hardware-specific subclasses for accelerators and data movers.

Parameters
hwOne of the values in the HardwareArchitecture enum class present in the enums.hpp file that should correspond to the device being used.
bitstreamstring that represents the name of the file with the bitstream. It is used for normal Vivado flow in ZYNQ boards. In Alveo, it is neglected.
xclbinstring that represents the name of the xclbin file. Used for Vitis and Alveo workflows
Returns
std::shared_ptr<IHardware> Returns an IAccelerator pointer with reference counting. It should be thread-safe.
Examples
alveo/vadd-host.cpp, zynq-mpsoc/ad08-sequential.cpp, zynq-mpsoc/ad08-streams.cpp, zynq-mpsoc/matrix-multiplication.cpp, zynq-mpsoc/xfopencv-filter2d.cpp, and zynq-mpsoc/xfopencv-warp-perspective.cpp.

◆ Create() [2/2]

std::shared_ptr< IHardware > cynq::IHardware::Create ( const HardwareArchitecture  hw,
const std::string &  config 
)
static

Create method Factory method to create a hardware-specific subclasses for accelerators and data movers.

Parameters
hwOne of the values in the HardwareArchitecture enum class present in the enums.hpp file that should correspond to the device being used.
configstring that represents the name of the file with the bitstream in the case of Ultrascale or xclbin for Vitis and Alveo workflows
Returns
std::shared_ptr<IHardware> Returns an IAccelerator pointer with reference counting. It should be thread-safe.

◆ GetAccelerator() [1/2]

virtual std::shared_ptr<IAccelerator> cynq::IHardware::GetAccelerator ( const std::string &  kernelname)
pure virtual

GetAccelerator method IAccelerator instance of IAccelerator inheritors separating the hardware logic from the specific logic of the accelerator.

Parameters
kernelnamestring that contains the kernel name to launch. It is used by the Vitis and Alveo workflows. It is not implemented in Vivado workflows
Returns
std::shared_ptr<IAccelerator> Returns an IAccelerator pointer with reference counting. It should be thread-safe.

Implemented in cynq::UltraScale, and cynq::Alveo.

◆ GetAccelerator() [2/2]

virtual std::shared_ptr<IAccelerator> cynq::IHardware::GetAccelerator ( const uint64_t  address)
pure virtual

GetAccelerator method IAccelerator instance of IAccelerator inheritors separating the hardware logic from the specific logic of the accelerator.

Parameters
addressa unsigned integer of 64 bits representing an address. In the case of ZYNQ boards, it corresponds to the base address of the accelerator BAR (Bank Address Register). In the case of Alveo boards, it is preferrable to use the GetAccelerator(const std::string &) overload.
Returns
std::shared_ptr<IAccelerator> Returns an IAccelerator pointer with reference counting. It should be thread-safe.

Implemented in cynq::UltraScale, and cynq::Alveo.

◆ GetClocks()

std::vector< float > cynq::IHardware::GetClocks ( )
virtualnoexcept

Get clocks from the PL.

This allows to check the current clocks from the PL in MHz. This method is optionally implementable. If it is not implemented, the number of elements of the vector is equal to zero.

Returns
a vector with a number of elements equal to the valid clocks

Reimplemented in cynq::UltraScale.

◆ GetDataMover()

virtual std::shared_ptr<IDataMover> cynq::IHardware::GetDataMover ( const uint64_t  address)
pure virtual

GetDataMover method Used for accessing the IDataMover instance of IHardware inheritors for decoupling the DataMovement separating the hardware logic from the data movement logic.

Parameters
addressa unsigned integer of 64 bits representing an address. In the case of ZYNQ boards, it corresponds to the base address of the accelerator BAR (Bank Address Register). In the case of Alveo boards, it is unused.
Returns
std::shared_ptr<IDataMover> Returns an IDataMover pointer with reference counting. It should be thread-safe.

Implemented in cynq::UltraScale, and cynq::Alveo.

◆ GetExecutionStream()

std::shared_ptr< IExecutionGraph > cynq::IHardware::GetExecutionStream ( const std::string &  name,
const IExecutionGraph::Type  type = IExecutionGraph::Type::STREAM,
const std::shared_ptr< ExecutionGraphParameters params = nullptr 
)
virtual

GetExecutionStream.

This method is a factory method to obtain an execution stream compatible with the hardware implementation. By default, it returns a new execution stream similar to the CUDA Stream, which is a queue-based scheduler to manage synchronism.

Parameters
namename of the stream for debugging purposes
typeimplementation for the execution graph. By default, it is STREAM
configconfigurations of the execution graph. By default, it is empty.
Returns
std::shared_ptr<IExecutionGraph> Returns an execution graph instance compatible with the API of the interface IExecutionGraph

◆ Reset()

virtual Status cynq::IHardware::Reset ( )
pure virtual

Reset method Sets the IHardware instance to its initial state.

Returns
Status

Implemented in cynq::UltraScale, and cynq::Alveo.

◆ SetClocks()

Status cynq::IHardware::SetClocks ( const std::vector< float > &  clocks)
virtual

Set clocks to the PL.

This allows to set the current clocks from the PL in MHz. This method is optionally implementable. If it is not implemented, no changes are performed.

The vector must contain a number of clocks equivalent to the supported by the platform. If a clock must remain untouched, set it to -1.f

Returns
Status of the operation

Reimplemented in cynq::UltraScale.


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