Skip to content

Commit 76d6cbf

Browse files
committed
Add documentation files
This adds the documentation files required for deployment
1 parent 6b7f16f commit 76d6cbf

File tree

318 files changed

+18141
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+18141
-23
lines changed

README.md

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,111 @@
1-
# cynq
2-
PYNQ bindings for C and C++ to avoid requiring Python or Vitis to execute hardware acceleration.
1+
# CYNQ
32

4-
# Dependencies
5-
1. meson 1.2.3
6-
2. Python 3.8.10
7-
3. C++17
3+
Framework to develop FPGA applications in C++ with the easiness of PYNQ
4+
5+
## Introduction
6+
7+
CYNQ is a C++ framework to implement FPGA-based accelerated applications with the same easiness as PYNQ framework for Python. This allows users to implement their own applications with better performance than in Python and avoids the long processing times of coding applications with Vitis.
8+
9+
## Dependencies
10+
11+
1. Meson >= 1.x
12+
2. Python >= 3.8
13+
3. GCC >= 9.x
14+
4. XRT >= 2.13
15+
5. Linux FPGA Manager
16+
17+
## Index
18+
19+
* [Foundations](docs/Foundations.md)
20+
* [Class Diagram](docs/ClassDiagram.md)
21+
* [Installation](docs/Installation.md)
22+
* [Getting Started](docs/GettingStarted.md)
23+
* [About](docs/About.md)
24+
25+
## How does CYNQ look like?
26+
27+
CYNQ is pretty similar to PYNQ, let's have a look.
28+
29+
PYNQ:
30+
31+
```python
32+
from pynq import allocate, Overlay
33+
34+
# Configure the FPGA
35+
design = Overlay("design.bit")
36+
37+
# Extract the accelerator (IP Core) and DMA
38+
dma = design.axi_dma_0
39+
accel = design.multiplication_accel_0
40+
41+
# Allocate buffers
42+
inbuf = allocate(shape=(input_elements,), dtype=np.uint16)
43+
outbuf = allocate(shape=(output_elements,), dtype=np.uint16)
44+
45+
# Run
46+
dma.sendchannel.transfer(inbuf)
47+
accel.write(accel.register_map.CTRL.address, 0x81)
48+
dma.recvchannel.transfer(outbuf)
49+
dma.recvchannel.wait()
50+
51+
# Dispose the buffers
52+
del input_hw
53+
del output_hw
54+
```
55+
56+
With CYNQ:
57+
58+
```c++
59+
#include <cynq/cynq.hpp>
60+
61+
using namespace cynq;
62+
63+
// Configure the FPGA
64+
auto kArch = HardwareArchitecture::UltraScale;
65+
auto platform = IHardware::Create(kArch, "design.bit", "default.xclbin");
66+
67+
// Extract the accelerator (IP Core) and DMA
68+
// Addresses are given by the design
69+
auto accel = platform->GetAccelerator(0xa000000);
70+
auto dma = platform->GetDataMover(0xa0010000);
71+
72+
// Allocate buffers and get the pointers
73+
auto inbuf = mover->GetBuffer(input_size);
74+
auto outbuf = mover->GetBuffer(output_size);
75+
uint16_t* input_ptr = inbuf->HostAddress<uint16_t>().get();
76+
uint16_t* output_ptr = outbuf->HostAddress<uint16_t>().get();
77+
78+
// Run
79+
accel->Start(StartMode::Continuous);
80+
inbuf->Sync(SyncType::HostToDevice);
81+
mover->Upload(in_mem, infbuf->Size(), 0, ExecutionType::Sync);
82+
mover->Download(out_mem, outbuf->Size(), 0, ExecutionType::Sync);
83+
outbuf->Sync(SyncType::DeviceToHost);
84+
85+
// Dispose? We use RAII
86+
```
87+
88+
## Currently tested
89+
90+
So far, we have tested CYNQ on:
91+
92+
1. Xilinx KV26-based with Ubuntu 2022.04
93+
94+
## Links & References:
95+
96+
* Docs: https://ecaslab.github.io/cynq
97+
* Github: https://github.com/ECASLab/cynq
98+
99+
Cite Us:
100+
101+
```
102+
@misc{cynq,
103+
author = {{León-vega, Luis G.
104+
AND Ávila-Torres, Diego
105+
AND Castro-Godínez, Jorge
106+
}},
107+
title = {{CYNQ (v0.1)}},
108+
year = {2023},
109+
url = {https://github.com/ECASLab/cynq},
110+
}
111+
```

docs/About.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# About
2+
3+
CYNQ is an alternative framework to code applications for Xilinx FPGAs with the easiness of PYNQ. Currently, most of the flow is quite complex and requires Vitis to get a decent C++ application and there are no bindings from the official PYNQ. Based on these needs, CYNQ proposes:
4+
5+
* Provide C++ bindings for C++ applications
6+
* Provide high performance
7+
* Keep the simplicity of PYNQ
8+
* Provide an agnostic interface amongst several hardware: ZYNQ, Alveo, PCIe cards
9+
10+
This project is completely Open Source thanks to:
11+
12+
* Ministero dell'Università e della Ricerca
13+
* University of Trieste
14+
* Costa Rica Institute of Technology
15+
16+
Our goal is to keep it Open Source, accessible and powerful. Collaboration and improvements are very welcome.
17+
18+
The current maintainers are:
19+
20+
* Luis G. Leon Vega <luis.leon@ieee.org>
21+
* Diego Avila Torres <diego.avila@uned.cr>

docs/ClassDiagram.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Class Diagram
2+
3+
@startuml
4+
interface IHardware {
5+
+{abstract} Reset() -> Status
6+
+{abstract} GetDataMover(address) -> IDataMover *
7+
+{abstract} GetAccelerator(address) -> IAccelerator *
8+
+{static} Create(hw: HardwareArchitecture, bitstream: string, xclbin: string) -> IHardware*
9+
10+
}
11+
12+
interface IMemory {
13+
{abstract} #GetHostAddress() -> uint8_t *
14+
{abstract} #GetDeviceAddress() -> uint8_t *
15+
+HostAddress<T>() -> T *
16+
+DeviceAddress<T>() -> T *
17+
{abstract} Sync(type: SyncType) -> Status
18+
{abstract} Size() -> size_t
19+
+{static} Create(impl: IMemoryType, size, hostptr, devptr) -> IMemory*
20+
}
21+
22+
enum IMemoryType {
23+
XRT
24+
CMA
25+
ALIGNED
26+
}
27+
28+
IMemoryType ..o IMemory
29+
30+
interface IAccelerator {
31+
{abstract} Start(mode: StartMode) -> Status
32+
{abstract} Stop() -> Status
33+
{abstract} #WriteRegister(address, data: uint8_t*, size: size_t) -> Status
34+
{abstract} #ReadRegister(address, data: uint8_t*, size: size_t) -> Status
35+
+Write<T>(address, data: T*, elems: size_t) -> Status
36+
+Read<T>(address, data: T*, elems: size_t) -> Status
37+
{abstract} GetStatus() -> DeviceStatus
38+
+{static} Create(impl: IAcceleratorType, addr: uint64) -> IAccelerator*
39+
}
40+
41+
enum IAcceleratorType {
42+
XRT
43+
MMIO
44+
CHAR
45+
}
46+
IAcceleratorType ..o IAccelerator
47+
48+
interface IDataMover {
49+
{abstract} GetBuffer(size: size_t, type: MemoryType) -> IMemory *
50+
{abstract} Upload(mem: IMemory, size: size_t, exetype: ExecutionType) -> Status
51+
{abstract} Download(mem: IMemory, size: size_t, exetype: ExecutionType) -> Status
52+
{abstract} Sync() -> Status
53+
{abstract} GetStatus() -> DeviceStatus
54+
+{static} Create(impl: IDataMoverType, addr: uint64) -> IDataMover*
55+
}
56+
57+
enum IDataMoverType {
58+
XRT
59+
DMA
60+
XDMA
61+
}
62+
IDataMoverType ..o IDataMover
63+
64+
enum HardwareArchitecture {
65+
UltraScale
66+
Zynq
67+
XDMA
68+
Alveo
69+
}
70+
71+
HardwareArchitecture ..o IHardware
72+
73+
enum SyncType {
74+
HostToDevice,
75+
DeviceToHost,
76+
}
77+
78+
enum StartMode {
79+
Once,
80+
Continuous
81+
}
82+
83+
enum MemoryType {
84+
Dual,
85+
Cacheable,
86+
Host,
87+
Device
88+
}
89+
90+
enum DeviceStatus {
91+
Unknown,
92+
Done,
93+
Idle,
94+
Running,
95+
Error
96+
}
97+
98+
enum ExecutionType {
99+
Sync,
100+
Async
101+
}
102+
103+
104+
class UltraScale {
105+
+Reset() -> Status
106+
+GetDataMover(address) -> XRTDataMover *
107+
+GetAccelerator(address) -> AmdAccelerator *
108+
+UltraScale(hw, bitsteam, xclbin)
109+
}
110+
111+
class XRTMemory {
112+
#GetHostAddress() -> uint8_t *
113+
#GetDeviceAddress() -> uint8_t *
114+
Sync(type: SyncType) -> Status
115+
Size() -> size_t
116+
+XRTMemory(hostptr, devptr)
117+
}
118+
119+
class XRTAccelerator {
120+
Start(mode: StartMode) -> Status
121+
Stop() -> Status
122+
GetStatus() -> DeviceStatus
123+
#WriteRegister(address, data: uint8_t*, size: size_t) -> Status
124+
#ReadRegister(address, data: uint8_t*, size: size_t) -> Status
125+
+AmdAccelerator(addr: uint64)
126+
}
127+
128+
class XRTDataMover {
129+
GetBuffer(size: size_t, type: MemoryType) -> XRTMemory *
130+
Upload(mem: IMemory, size: size_t, exetype: ExecutionType) -> Status
131+
Download(mem: IMemory, size: size_t, exetype: ExecutionType) -> Status
132+
Sync() -> Status
133+
GetStatus() -> DeviceStatus
134+
XRTDataMover(addr)
135+
}
136+
137+
UltraScale ..> IHardware
138+
XRTMemory ..> IMemory
139+
XRTAccelerator ..> IAccelerator
140+
XRTDataMover ..> IDataMover
141+
@enduml

0 commit comments

Comments
 (0)