Skip to content

Commit afbe258

Browse files
Bhaskar VishnuVardhan ChebroluGitHub Enterprise
authored andcommitted
new validate design for zynq ultrascale platforms
1 parent 540757f commit afbe258

File tree

13 files changed

+889
-0
lines changed

13 files changed

+889
-0
lines changed

validate/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Example | Description | Key Concepts / Keywords
88
---------------|-----------------------|-------------------------
99
[bandwidth_test/][]|This Bandwidth Example test the maximum possible bandwidth between Kernel and Global Memory.|__Key__ __Concepts__<br> - Burst Read/Write<br> - Bandwidth<br>
1010
[slavebridge_test/][]|This slave bridge bandwidth design explains how direct host memory access can be done by the kernel.|__Key__ __Concepts__<br> - slave bridge<br> - address translation unit<br>__Keywords__<br> - XCL_MEM_EXT_HOST_ONLY<br> - HOST[0]
11+
[validate_zcu/][]|This is a simple design that verifies if the platform has basic functionalities. It also tests the possible bandwidth between Kernel and Global Memory.|__Key__ __Concepts__<br> - Bandwidth<br>
1112
[verify_test/][]|This is a simple design to verify that the platform has basic functionality.|
1213

1314
[.]:.
1415
[bandwidth_test/]:bandwidth_test/
1516
[slavebridge_test/]:slavebridge_test/
17+
[validate_zcu/]:validate_zcu/
1618
[verify_test/]:verify_test/

validate/validate_zcu/Makefile

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
#
2+
# Copyright 2019-2021 Xilinx, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# makefile-generator v1.0.3
16+
#
17+
18+
############################## Help Section ##############################
19+
.PHONY: help
20+
21+
help::
22+
$(ECHO) "Makefile Usage:"
23+
$(ECHO) " make all TARGET=<sw_emu/hw_emu/hw> DEVICE=<FPGA platform> HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>"
24+
$(ECHO) " Command to generate the design for specified Target and Shell."
25+
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
26+
$(ECHO) ""
27+
$(ECHO) " make clean "
28+
$(ECHO) " Command to remove the generated non-hardware files."
29+
$(ECHO) ""
30+
$(ECHO) " make cleanall"
31+
$(ECHO) " Command to remove all the generated files."
32+
$(ECHO) ""
33+
$(ECHO) " make test DEVICE=<FPGA platform>"
34+
$(ECHO) " Command to run the application. This is same as 'run' target but does not have any makefile dependency."
35+
$(ECHO) ""
36+
$(ECHO) " make sd_card TARGET=<sw_emu/hw_emu/hw> DEVICE=<FPGA platform> HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>"
37+
$(ECHO) " Command to prepare sd_card files."
38+
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
39+
$(ECHO) ""
40+
$(ECHO) " make run TARGET=<sw_emu/hw_emu/hw> DEVICE=<FPGA platform> HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>"
41+
$(ECHO) " Command to run application in emulation."
42+
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
43+
$(ECHO) ""
44+
$(ECHO) " make build TARGET=<sw_emu/hw_emu/hw> DEVICE=<FPGA platform> HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>"
45+
$(ECHO) " Command to build xclbin application."
46+
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
47+
$(ECHO) ""
48+
$(ECHO) " make host HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>"
49+
$(ECHO) " Command to build host application."
50+
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
51+
$(ECHO) ""
52+
53+
############################## Setting up Project Variables ##############################
54+
# Points to top directory of Git repository
55+
MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
56+
COMMON_REPO ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%validate/validate_zcu/*}')
57+
PWD = $(shell readlink -f .)
58+
XF_PROJ_ROOT = $(shell readlink -f $(COMMON_REPO))
59+
60+
TARGET := hw
61+
HOST_ARCH := x86
62+
SYSROOT :=
63+
64+
include ./utils.mk
65+
66+
XSA :=
67+
ifneq ($(DEVICE), )
68+
XSA := $(call device2xsa, $(DEVICE))
69+
endif
70+
TEMP_DIR := ./_x.$(TARGET).$(XSA)
71+
BUILD_DIR := ./build_dir.$(TARGET).$(XSA)
72+
73+
# SoC variables
74+
RUN_APP_SCRIPT = ./run_app.sh
75+
PACKAGE_OUT = ./package.$(TARGET)
76+
77+
LAUNCH_EMULATOR = $(PACKAGE_OUT)/launch_$(TARGET).sh
78+
RESULT_STRING = TEST PASSED
79+
80+
VPP := v++
81+
VPP_PFLAGS :=
82+
CMD_ARGS = -x $(BUILD_DIR)/validate_zcu.xclbin
83+
SDCARD := sd_card
84+
85+
include $(XF_PROJ_ROOT)/common/includes/opencl/opencl.mk
86+
include config.mk
87+
88+
CXXFLAGS += $(opencl_CXXFLAGS) -Wall -O0 -g -std=c++1y
89+
LDFLAGS += $(opencl_LDFLAGS)
90+
91+
ifeq ($(findstring dma, $(DEVICE)), dma)
92+
$(error [ERROR]: This example is not supported for $(DEVICE).)
93+
endif
94+
ifeq ($(findstring u30, $(DEVICE)), u30)
95+
$(error [ERROR]: This example is not supported for $(DEVICE).)
96+
endif
97+
ifeq ($(findstring aws, $(DEVICE)), aws)
98+
$(error [ERROR]: This example is not supported for $(DEVICE).)
99+
endif
100+
ifeq ($(findstring samsung, $(DEVICE)), samsung)
101+
$(error [ERROR]: This example is not supported for $(DEVICE).)
102+
endif
103+
ifeq ($(findstring 2019, $(DEVICE)), 2019)
104+
$(error [ERROR]: This example is not supported for $(DEVICE).)
105+
endif
106+
ifeq ($(findstring 2018, $(DEVICE)), 2018)
107+
$(error [ERROR]: This example is not supported for $(DEVICE).)
108+
endif
109+
ifeq ($(findstring vck, $(DEVICE)), vck)
110+
$(error [ERROR]: This example is not supported for $(DEVICE).)
111+
endif
112+
113+
############################## Setting up Host Variables ##############################
114+
#Include Required Host Source Files
115+
CXXFLAGS += -I$(XF_PROJ_ROOT)/common/includes/xcl2
116+
CXXFLAGS += -I$(XF_PROJ_ROOT)/common/includes/cmdparser
117+
CXXFLAGS += -I$(XF_PROJ_ROOT)/common/includes/logger
118+
HOST_SRCS += $(XF_PROJ_ROOT)/common/includes/xcl2/xcl2.cpp $(XF_PROJ_ROOT)/common/includes/cmdparser/cmdlineparser.cpp $(XF_PROJ_ROOT)/common/includes/logger/logger.cpp ./src/host.cpp
119+
# Host compiler global settings
120+
CXXFLAGS += -fmessage-length=0
121+
LDFLAGS += -lrt -lstdc++
122+
123+
ifneq ($(HOST_ARCH), x86)
124+
LDFLAGS += --sysroot=$(SYSROOT)
125+
endif
126+
127+
############################## Setting up Kernel Variables ##############################
128+
# Kernel compiler global settings
129+
VPP_FLAGS += -t $(TARGET) --platform $(DEVICE) --save-temps
130+
ifneq ($(TARGET), hw)
131+
VPP_FLAGS += -g
132+
endif
133+
134+
135+
136+
EXECUTABLE = ./validate_zcu.exe
137+
EMCONFIG_DIR = $(TEMP_DIR)
138+
EMU_DIR = $(SDCARD)/data/emulation
139+
140+
############################## Declaring Binary Containers ##############################
141+
BINARY_CONTAINERS += $(BUILD_DIR)/validate_zcu.xclbin
142+
BINARY_CONTAINER_validate_zcu_OBJS += $(TEMP_DIR)/verify.xo
143+
BINARY_CONTAINER_validate_zcu_OBJS += $(TEMP_DIR)/bandwidth.xo
144+
145+
############################## Setting Targets ##############################
146+
CP = cp -rf
147+
148+
.PHONY: all clean cleanall docs emconfig
149+
all: check-devices $(EXECUTABLE) $(BINARY_CONTAINERS) emconfig sd_card
150+
151+
.PHONY: host
152+
host: $(EXECUTABLE)
153+
154+
.PHONY: build
155+
build: check-vitis $(BINARY_CONTAINERS)
156+
157+
.PHONY: xclbin
158+
xclbin: build
159+
160+
############################## Setting Rules for Binary Containers (Building Kernels) ##############################
161+
$(TEMP_DIR)/verify.xo: src/verify.cpp
162+
mkdir -p $(TEMP_DIR)
163+
$(VPP) $(VPP_FLAGS) -c -k verify --temp_dir $(TEMP_DIR) -I'$(<D)' -o'$@' '$<'
164+
$(TEMP_DIR)/bandwidth.xo: src/bandwidth.cpp
165+
mkdir -p $(TEMP_DIR)
166+
$(VPP) $(VPP_FLAGS) -c -k bandwidth --temp_dir $(TEMP_DIR) -I'$(<D)' -o'$@' '$<'
167+
$(BUILD_DIR)/validate_zcu.xclbin: $(BINARY_CONTAINER_validate_zcu_OBJS)
168+
mkdir -p $(BUILD_DIR)
169+
ifeq ($(HOST_ARCH), x86)
170+
$(VPP) $(VPP_FLAGS) -l $(VPP_LDFLAGS) --temp_dir $(TEMP_DIR) -o'$(BUILD_DIR)/validate_zcu.link.xclbin' $(+)
171+
$(VPP) -p $(BUILD_DIR)/validate_zcu.link.xclbin -t $(TARGET) --platform $(DEVICE) --package.out_dir $(PACKAGE_OUT) -o $(BUILD_DIR)/validate_zcu.xclbin
172+
else
173+
$(VPP) $(VPP_FLAGS) -l $(VPP_LDFLAGS) --temp_dir $(TEMP_DIR) -o'$(BUILD_DIR)/validate_zcu.xclbin' $(+)
174+
endif
175+
176+
############################## Setting Rules for Host (Building Host Executable) ##############################
177+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
178+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
179+
180+
emconfig:$(EMCONFIG_DIR)/emconfig.json
181+
$(EMCONFIG_DIR)/emconfig.json:
182+
emconfigutil --platform $(DEVICE) --od $(EMCONFIG_DIR)
183+
184+
############################## Setting Essential Checks and Running Rules ##############################
185+
run: all
186+
ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))
187+
ifeq ($(HOST_ARCH), x86)
188+
$(CP) $(EMCONFIG_DIR)/emconfig.json .
189+
XCL_EMULATION_MODE=$(TARGET) $(EXECUTABLE) $(CMD_ARGS)
190+
else
191+
$(LAUNCH_EMULATOR) -run-app $(RUN_APP_SCRIPT) | tee run_app.log; exit $${PIPESTATUS[0]}
192+
endif
193+
else
194+
ifeq ($(HOST_ARCH), x86)
195+
$(EXECUTABLE) $(CMD_ARGS)
196+
endif
197+
endif
198+
199+
200+
.PHONY: test
201+
test: $(EXECUTABLE)
202+
ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))
203+
ifeq ($(HOST_ARCH), x86)
204+
XCL_EMULATION_MODE=$(TARGET) $(EXECUTABLE) $(CMD_ARGS)
205+
else
206+
$(LAUNCH_EMULATOR) -run-app $(RUN_APP_SCRIPT) | tee run_app.log; exit $${PIPESTATUS[0]}
207+
endif
208+
else
209+
ifeq ($(HOST_ARCH), x86)
210+
$(EXECUTABLE) $(CMD_ARGS)
211+
else
212+
$(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board"
213+
endif
214+
endif
215+
216+
217+
############################## Preparing sdcard ##############################
218+
sd_card: $(BINARY_CONTAINERS) $(EXECUTABLE) gen_run_app
219+
ifneq ($(HOST_ARCH), x86)
220+
$(VPP) $(VPP_PFLAGS) -p $(BUILD_DIR)/validate_zcu.xclbin -t $(TARGET) --platform $(DEVICE) --package.out_dir $(PACKAGE_OUT) --package.rootfs $(EDGE_COMMON_SW)/rootfs.ext4 --package.sd_file $(SD_IMAGE_FILE) --package.sd_file xrt.ini --package.sd_file $(RUN_APP_SCRIPT) --package.sd_file $(EXECUTABLE) -o validate_zcu.xclbin
221+
endif
222+
223+
############################## Cleaning Rules ##############################
224+
# Cleaning stuff
225+
clean:
226+
-$(RMDIR) $(EXECUTABLE) $(XCLBIN)/{*sw_emu*,*hw_emu*}
227+
-$(RMDIR) profile_* TempConfig system_estimate.xtxt *.rpt *.csv
228+
-$(RMDIR) src/*.ll *v++* .Xil emconfig.json dltmp* xmltmp* *.log *.jou *.wcfg *.wdb
229+
230+
cleanall: clean
231+
-$(RMDIR) build_dir* sd_card*
232+
-$(RMDIR) package.*
233+
-$(RMDIR) _x* *xclbin.run_summary qemu-memory-_* emulation _vimage pl* start_simulation.sh *.xclbin
234+

validate/validate_zcu/README.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Validate Zynq UltraScale Platform (C)
2+
=====================================
3+
4+
This is a simple design that verifies if the platform has basic functionalities. It also tests the possible bandwidth between Kernel and Global Memory.
5+
6+
**KEY CONCEPTS:** Bandwidth
7+
8+
EXCLUDED PLATFORMS
9+
------------------
10+
11+
Platforms containing following strings in their names are not supported for this example :
12+
13+
::
14+
15+
dma
16+
u30
17+
aws
18+
samsung
19+
2019
20+
2018
21+
vck
22+
23+
DESIGN FILES
24+
------------
25+
26+
Application code is located in the src directory. Accelerator binary files will be compiled to the xclbin directory. The xclbin directory is required by the Makefile and its contents will be filled during compilation. A listing of all the files in this example is shown below
27+
28+
::
29+
30+
src/bandwidth.cpp
31+
src/host.cpp
32+
src/verify.cpp
33+
34+
COMMAND LINE ARGUMENTS
35+
----------------------
36+
37+
Once the environment has been configured, the application can be executed by
38+
39+
::
40+
41+
./validate_zcu.exe -x <validate_zcu XCLBIN>
42+
43+
DETAILS
44+
-------
45+
46+
This example contains verify test and bandwidth test to validate EDGE platforms.
47+
48+
In the verify test we have extremely simple HLS C Kernel to verify that the platform has basic functionality. It will make a call to the kernel with an empty global buffer. The kernel will then write the string of characters "Hello World" into the buffer and return. The host will copy this buffer locally and then print out the resulting buffer contents.
49+
50+
In the bandwidth test we try to get the maximum possible bandwidth between Kernel and Global Memory.
51+
52+
Using the ``sp`` option in the platform_bandwidth.cfg file AXI-Master Port is connected to the IP.
53+
54+
::
55+
56+
sp=bandwidth_1.input:HP0
57+
sp=bandwidth_1.output:HP0
58+
sp=bandwidth_2.input:HP1
59+
sp=bandwidth_2.output:HP1
60+
sp=bandwidth_3.input:HP2
61+
sp=bandwidth_3.output:HP2
62+
sp=bandwidth_4.input:HP3
63+
sp=bandwidth_4.output:HP3
64+
65+
66+
For more comprehensive documentation, `click here <http://xilinx.github.io/Vitis_Accel_Examples>`__.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[connectivity]
2+
sp=bandwidth_1.input:HP0
3+
sp=bandwidth_1.output:HP0
4+
sp=bandwidth_2.input:HP1
5+
sp=bandwidth_2.output:HP1
6+
sp=bandwidth_3.input:HP2
7+
sp=bandwidth_3.output:HP2
8+
sp=bandwidth_4.input:HP3
9+
sp=bandwidth_4.output:HP3
10+
nk=bandwidth:4

validate/validate_zcu/config.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
USR_VPP_FLAGS:=
2+
USR_VPP_LDFLAGS:=
3+
4+
VPP_LDFLAGS+= --config bandwidth.cfg
5+
ifneq ($(USR_VPP_FLAGS), )
6+
VPP_FLAGS += $(USR_VPP_FLAGS)
7+
endif
8+
ifneq ($(USR_VPP_LDFLAGS), )
9+
VPP_LDFLAGS += $(USR_VPP_LDFLAGS)
10+
endif

0 commit comments

Comments
 (0)