Skip to content

Commit dfc93f3

Browse files
Virat AgarwalGitHub Enterprise
authored andcommitted
Updating hello_world README
1 parent f6175d8 commit dfc93f3

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

hello_world/README.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,73 @@ Once the environment has been configured, the application can be executed by
3535

3636
./hello_world <vadd XCLBIN>
3737

38+
DETAILS
39+
-------
40+
41+
This example a simple hello world example to explain the Host and Kernel
42+
code structure. Here a simple ``vadd`` kernel is used to explain the
43+
same.
44+
45+
Vitis kernel can have one s_axilite interface which will be used by host
46+
application to configure the kernel. Here ``bundle=control`` is defined
47+
which is s_axilite interface and associated with all the arguments (in1,
48+
in2, out_r and size). control interface must also be associated with
49+
``return``.
50+
51+
.. code:: cpp
52+
53+
void vadd(const unsigned int *in1,
54+
const unsigned int *in2,
55+
unsigned int *out_r,
56+
int size)
57+
#pragma HLS INTERFACE s_axilite port = in1 bundle = control
58+
#pragma HLS INTERFACE s_axilite port = in2 bundle = control
59+
#pragma HLS INTERFACE s_axilite port = out_r bundle = control
60+
#pragma HLS INTERFACE s_axilite port = size bundle = control
61+
#pragma HLS INTERFACE s_axilite port = return bundle = control
62+
63+
All the global memory access arguments are associated to m_axi(AXI
64+
Master Interface) as below:
65+
66+
.. code:: cpp
67+
68+
#pragma HLS INTERFACE m_axi port=in1 offset=slave bundle=gmem
69+
#pragma HLS INTERFACE m_axi port=in2 offset=slave bundle=gmem
70+
#pragma HLS INTERFACE m_axi port=out_r offset=slave bundle=gmem
71+
72+
Here all three arguments ``in1``, ``in2``, ``out_r`` are associated to
73+
bundle ``gmem`` which means that one AXI master interface named ``gmem``
74+
will be created in Kernel and all these variables will be accessing
75+
global memory through this interface. Multiple interfaces can also be
76+
created based on the requirements. For example when multiple memory
77+
accessing arguments need access to global memory simultaneously, user
78+
can create multiple master interfaces and can connect to different
79+
arguments.
80+
81+
Rather than reading individual items for addition, local buffers are
82+
created in kernel local memory and multiple items are read in a single
83+
burst. This is done to achieve low memory access latency and also for
84+
efficient use of bandwidth provided by the m_axi interface.
85+
86+
Similarly, results are stored in a buffer and are written to global
87+
memory in a burst. The for loops used have the following requirements to
88+
implement burst read/write:
89+
90+
- Pipeline the loop : Loop pipeline must have ``II`` (Initiation
91+
interval) = 1
92+
93+
- contiguous memory : Memory addresses for read/write should be
94+
contiguous.
95+
96+
.. code:: cpp
97+
98+
read1: for (int j = 0 ; j < chunk_size ; j++){
99+
#pragma HLS PIPELINE II=1
100+
v1_buffer[j] = in1[i + j];
101+
}
102+
write: for (int j = 0 ; j < chunk_size ; j++){
103+
#pragma HLS PIPELINE II=1
104+
out_r[i + j] = vout_buffer[j];
105+
}
106+
107+
For more comprehensive documentation, `click here <http://xilinx.github.io/Vitis_Accel_Examples>`__.

0 commit comments

Comments
 (0)