12-28-2020 08:33 PM - edited 12-28-2020 08:35 PM
Hi all,
I am using Ultra96 v2 board (Zynq UltraScale+ MPSoC) and I am new to this board. I am trying to create a simple design to test the data transfer between PL and L2 cache using the ACP port. My problems include the difference between the HP port and the ACP port regarding functionality and usage.
1. With regard to functionality, I know that the ACP port can access the L2 cache. From my understanding, I need to provide a DDR address, then the HP port will access DDR, while the ACP port will first access L2 cache and then DDR. Is that right?
2. My major problem is the usage of the ACP port. I created a simple IP using vivado HLS (vector addition), and created block design using vivado (I used "run block automation" and "run connection automation"), then I created my ipynb file to run on the FPGA. It did work for the HP port and I got the right results. According to my understanding on 1, I do not need to change the HLS code and the ipynb code if I want to use the ACP code. Is that right? Then I tried. I only chose different PS-PL interfaces (I chose S_AXI_ACP when re-customizing IP), and all the other operations maintained the same. Specifically, I also used "run block automation" and "run connection automation". It successfully generated bitstream, but when running the program, it did not do the vector addition. I do not know the reasons...
My HLS code, ipynb code and the block design are as follows:
HLS:
void vec_add(int *in1, int *in2, int *out) {
#pragma HLS INTERFACE m_axi depth=256 port=in1 offset=slave
#pragma HLS INTERFACE m_axi depth=256 port=in2 offset=slave
#pragma HLS INTERFACE m_axi depth=256 port=out offset=slave
#pragma HLS INTERFACE s_axilite port=return bundle=control
int tmp_in1[10];
int tmp_in2[10];
int tmp_out[10];
for(int i = 0; i < 10; i++) {
tmp_in1[i] = in1[i];
tmp_in2[i] = in2[i];
}
for(int i = 0; i < 10; i++) {
tmp_out[i] = tmp_in1[i] + tmp_in2[i];
}
for(int i = 0; i < 10; i++) {
out[i] = tmp_out[i];
}
}
ipynb file:
import sys
import os
import math
import time
import numpy as np
import cv2
import pynq
import ctypes
overlay = pynq.Overlay('design_1.bit')
xlnk = pynq.Xlnk()
nn_ctrl = overlay.vec_add_0
print('got nn accelerator!')
overlay = pynq.Overlay('design_1.bit')
xlnk = pynq.Xlnk()
nn_ctrl = overlay.vec_add_0
interval_time = 0
total_time = 0
total_energy = 0
rails = pynq.get_rails()
start = time.time()
recorder = pynq.DataRecorder(rails["5V"].power)
with recorder.record(0.05):
nn_ctrl.write(0x10, in_buffer0.physical_address)
nn_ctrl.write(0x18, in_buffer1.physical_address)
nn_ctrl.write(0x20, out_buffer.physical_address)
nn_ctrl.write(0x00, 0x01)
end = time.time()
t = end - start
print('in1: {}\nin2: {}\nout: {}'.format(in_buffer0, in_buffer1, out_buffer))
Design block:
And also some options:
Thanks in advance!
12-30-2020 08:21 PM
Using ACP is not that difficult. Please note the followng two points.
* AXI Signal (AxCACHE and AxPROT)
* cache-line friendly transactions
1. AXI Signal (AxCACHE and AxPROT)
See the Xilinx Wiki for more information.
To change the values of these signals in a component made with Vivado-HLS, do it from the Vivado Project.
Open the Vivado Project and select Open Block Design.
Right-click on the component you created in Vivado-HLS, then click Custmize Block ... Set the PROT value and CACHE value as follows:
PROT value "010"
CACHE value "1111"
2. cache-line friendly transactions
Quoted from [AR#66643](https://www.xilinx.com/support/answers/66643.html)
> The ACP interface on Zynq UltraScale+ MPSoC accepts only the following (cache-line friendly)transactions.
> Masters targeting ACP should account for these limitations:
>
> * 64-byte aligned 64-byte read/write INCR transactions.
> All write-byte strobes must be the same (either enabled or disabled).
> * 16-byte aligned 16-byte read/write INCR transactions.
> Write-byte strobes can have any value.
>
> All other transactions return an SLVERR response.
It can be little to meet this constraint with Vivado-HLS. I don't know how to this.
Instead, I created the ZynqMP-ACP-Adapter.
ZynqMP-ACP-Adapter is an adapter to connect AXI Master to ZynqMP ACP.
The adapter then splits any burst-length transaction into several 64-byte or 16-byte transactions.
For details, please refer to the following URL:
https://github.com/ikwzm/ZynqMP-ACP-Adapter
12-29-2020 05:13 PM
Can anyone give me any suggestions on my case or maybe some tutorials about ACP port? Thanks very much!!!!
12-30-2020 08:21 PM
Using ACP is not that difficult. Please note the followng two points.
* AXI Signal (AxCACHE and AxPROT)
* cache-line friendly transactions
1. AXI Signal (AxCACHE and AxPROT)
See the Xilinx Wiki for more information.
To change the values of these signals in a component made with Vivado-HLS, do it from the Vivado Project.
Open the Vivado Project and select Open Block Design.
Right-click on the component you created in Vivado-HLS, then click Custmize Block ... Set the PROT value and CACHE value as follows:
PROT value "010"
CACHE value "1111"
2. cache-line friendly transactions
Quoted from [AR#66643](https://www.xilinx.com/support/answers/66643.html)
> The ACP interface on Zynq UltraScale+ MPSoC accepts only the following (cache-line friendly)transactions.
> Masters targeting ACP should account for these limitations:
>
> * 64-byte aligned 64-byte read/write INCR transactions.
> All write-byte strobes must be the same (either enabled or disabled).
> * 16-byte aligned 16-byte read/write INCR transactions.
> Write-byte strobes can have any value.
>
> All other transactions return an SLVERR response.
It can be little to meet this constraint with Vivado-HLS. I don't know how to this.
Instead, I created the ZynqMP-ACP-Adapter.
ZynqMP-ACP-Adapter is an adapter to connect AXI Master to ZynqMP ACP.
The adapter then splits any burst-length transaction into several 64-byte or 16-byte transactions.
For details, please refer to the following URL:
https://github.com/ikwzm/ZynqMP-ACP-Adapter
01-03-2021 05:37 PM
Thank you very much!
01-03-2021 08:25 PM
But it seems that I cannot set the PROT value and CACHE value using Vivado (by clicking Customize Block...). What should I do?
01-03-2021 09:32 PM
What is Ultra_net? Isn't the component you made vec_add_0?
01-04-2021 12:06 AM
Oh sorry... I used another project ultra_net which uses AXI Stream interface... Sorry... I can now set the values for vec_add_0.