Skip to content

Commit 6daf535

Browse files
SDA USRYuanqiang Li
authored andcommitted
sync codec (#640)
* sync codec * update rst Co-authored-by: Yuanqiang Li <yuanqian@xilinx.com>
1 parent c128d6a commit 6daf535

File tree

531 files changed

+2822
-211092
lines changed

Some content is hidden

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

531 files changed

+2822
-211092
lines changed

codec/Jenkinsfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@Library('pipeline-library')_
2-
VitisLibPipeline (branch: 'next', libname: 'xf_codec', TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
2+
VitisLibPipeline (branch: 'regression', libname: 'xf_codec', TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
33
upstream_dependencies: 'xf_utils_hw,next,../utils; xf_database,next,../database; xf_fintech,next,../quantitative_finance',
4-
email: 'siyangw@xilinx.com', devtest: 'RunDeploy.sh', TOOLVERSION: '2021.2_stable_latest')
4+
devtest: 'RunDeploy.sh', TOOLVERSION: '2022.1_stable_latest')
5+

codec/L1/include/hls_EncodeCoeffOrders.hpp

Lines changed: 484 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
#
2+
# Copyright 2019-2020 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+
#
16+
17+
MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
18+
CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH)))
19+
XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L1/*}')
20+
21+
# MK_INC_BEGIN hls_common.mk
22+
23+
.PHONY: help
24+
25+
help::
26+
@echo ""
27+
@echo "Makefile Usage:"
28+
@echo ""
29+
@echo " make run CSIM=1 CSYNTH=1 COSIM=1 DEVICE=<FPGA platform> PLATFORM_REPO_PATHS=<path to platform directories>"
30+
@echo " Command to run the selected tasks for specified device."
31+
@echo ""
32+
@echo " Valid tasks are CSIM, CSYNTH, COSIM, VIVADO_SYN, VIVADO_IMPL"
33+
@echo ""
34+
@echo " DEVICE is case-insensitive and support awk regex."
35+
@echo " For example, \`make run DEVICE='u200.*xdma' COSIM=1\`"
36+
@echo " It can also be an absolute path to platform file."
37+
@echo ""
38+
@echo " PLATFORM_REPO_PATHS variable is used to specify the paths in which the platform files will be"
39+
@echo " searched for."
40+
@echo ""
41+
@echo " make run CSIM=1 CSYNTH=1 COSIM=1 XPART=<FPGA part name>"
42+
@echo " Alternatively, the FPGA part can be speficied via XPART."
43+
@echo " For example, \`make run XPART='xcu200-fsgd2104-2-e' COSIM=1\`"
44+
@echo " When XPART is set, DEVICE will be ignored."
45+
@echo ""
46+
@echo " make clean "
47+
@echo " Command to remove the generated files."
48+
@echo ""
49+
50+
# MK_INC_END hls_common.mk
51+
52+
# MK_INC_BEGIN vivado.mk
53+
54+
.PHONY: check_vivado
55+
check_vivado:
56+
ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado))
57+
@echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false
58+
endif
59+
60+
export PATH := $(XILINX_VIVADO)/bin:$(PATH)
61+
62+
# MK_INC_END vivado.mk
63+
64+
DEVICE ?= u200
65+
66+
# MK_INC_BEGIN vitis_set_part.mk
67+
68+
# MK_INC_BEGIN vitis.mk
69+
70+
.PHONY: check_vpp
71+
check_vpp:
72+
ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++))
73+
@echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false
74+
endif
75+
76+
.PHONY: check_xrt
77+
check_xrt:
78+
ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so))
79+
@echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false
80+
endif
81+
82+
export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH)
83+
84+
ifeq (,$(LD_LIBRARY_PATH))
85+
LD_LIBRARY_PATH := $(XILINX_XRT)/lib
86+
else
87+
LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH)
88+
endif
89+
ifneq (,$(wildcard $(XILINX_VITIS)/bin/ldlibpath.sh))
90+
export LD_LIBRARY_PATH := $(shell $(XILINX_VITIS)/bin/ldlibpath.sh $(XILINX_VITIS)/lib/lnx64.o):$(LD_LIBRARY_PATH)
91+
endif
92+
93+
# MK_INC_END vitis.mk
94+
95+
.PHONY: check_part
96+
97+
ifeq (,$(XPART))
98+
# MK_INC_BEGIN vitis_set_platform.mk
99+
100+
ifneq (,$(wildcard $(DEVICE)))
101+
# Use DEVICE as a file path
102+
XPLATFORM := $(DEVICE)
103+
else
104+
# Use DEVICE as a file name pattern
105+
DEVICE_L := $(shell echo $(DEVICE) | tr A-Z a-z)
106+
# 1. search paths specified by variable
107+
ifneq (,$(PLATFORM_REPO_PATHS))
108+
# 1.1 as exact name
109+
XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(DEVICE_L)/$(DEVICE_L).xpfm)))
110+
# 1.2 as a pattern
111+
ifeq (,$(XPLATFORM))
112+
XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm))
113+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/')))
114+
endif # 1.2
115+
endif # 1
116+
# 2. search Vitis installation
117+
ifeq (,$(XPLATFORM))
118+
# 2.1 as exact name
119+
XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm))
120+
# 2.2 as a pattern
121+
ifeq (,$(XPLATFORM))
122+
XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm)
123+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/')))
124+
endif # 2.2
125+
endif # 2
126+
# 3. search default locations
127+
ifeq (,$(XPLATFORM))
128+
# 3.1 as exact name
129+
XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(DEVICE_L)/$(DEVICE_L).xpfm))
130+
# 3.2 as a pattern
131+
ifeq (,$(XPLATFORM))
132+
XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm)
133+
XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(DEVICE_L)/')))
134+
endif # 3.2
135+
endif # 3
136+
endif
137+
138+
define MSG_PLATFORM
139+
No platform matched pattern '$(DEVICE)'.
140+
Available platforms are: $(XPLATFORMS)
141+
To add more platform directories, set the PLATFORM_REPO_PATHS variable or point DEVICE variable to the full path of platform .xpfm file.
142+
endef
143+
export MSG_PLATFORM
144+
145+
define MSG_DEVICE
146+
More than one platform matched: $(XPLATFORM)
147+
Please set DEVICE variable more accurately to select only one platform file, or set DEVICE variable to the full path of the platform .xpfm file.
148+
endef
149+
export MSG_DEVICE
150+
151+
.PHONY: check_platform
152+
check_platform:
153+
ifeq (,$(XPLATFORM))
154+
@echo "$${MSG_PLATFORM}" && false
155+
endif
156+
ifneq (,$(word 2,$(XPLATFORM)))
157+
@echo "$${MSG_DEVICE}" && false
158+
endif
159+
160+
XDEVICE := $(basename $(notdir $(firstword $(XPLATFORM))))
161+
162+
# MK_INC_END vitis_set_platform.mk
163+
ifeq (1, $(words $(XPLATFORM)))
164+
# Query the part name of device
165+
ifneq (,$(wildcard $(XILINX_VITIS)/bin/platforminfo))
166+
override XPART := $(shell $(XILINX_VITIS)/bin/platforminfo --json="hardwarePlatform.devices[0].fpgaPart" --platform $(firstword $(XPLATFORM)) | sed 's/^[^:]*://g' | sed 's/[^a-zA-Z0-9]/-/g' | sed 's/-\+/-/g')
167+
endif
168+
endif
169+
check_part: check_platform check_vpp
170+
ifeq (,$(XPART))
171+
@echo "XPART is not set and cannot be inferred. Please run \`make help\` for usage info." && false
172+
endif
173+
else # XPART
174+
check_part:
175+
@echo "XPART is directly set to $(XPART)"
176+
endif # XPART
177+
178+
# MK_INC_END vitis_set_part.mk
179+
180+
# MK_INC_BEGIN hls_test_rules.mk
181+
182+
183+
.PHONY: run setup runhls clean cleanall check
184+
185+
# Alias to run, for legacy test script
186+
check: run
187+
188+
CSIM ?= 0
189+
CSYNTH ?= 0
190+
COSIM ?= 0
191+
VIVADO_SYN ?= 0
192+
VIVADO_IMPL ?= 0
193+
QOR_CHECK ?= 0
194+
195+
# at least RTL synthesis before check QoR
196+
ifeq (1,$(QOR_CHECK))
197+
ifeq (0,$(VIVADO_IMPL))
198+
override VIVADO_SYN := 1
199+
endif
200+
endif
201+
202+
# need synthesis before cosim or vivado
203+
ifeq (1,$(VIVADO_IMPL))
204+
override CSYNTH := 1
205+
endif
206+
207+
ifeq (1,$(VIVADO_SYN))
208+
override CSYNTH := 1
209+
endif
210+
211+
ifeq (1,$(COSIM))
212+
override CSYNTH := 1
213+
endif
214+
215+
# From testbench.data_recipe of description.json
216+
data:
217+
@true
218+
219+
run: data setup runhls
220+
221+
setup: | check_part
222+
@rm -f ./settings.tcl
223+
@if [ -n "$$CLKP" ]; then echo 'set CLKP $(CLKP)' >> ./settings.tcl ; fi
224+
@echo 'set XPART $(XPART)' >> ./settings.tcl
225+
@echo 'set CSIM $(CSIM)' >> ./settings.tcl
226+
@echo 'set CSYNTH $(CSYNTH)' >> ./settings.tcl
227+
@echo 'set COSIM $(COSIM)' >> ./settings.tcl
228+
@echo 'set VIVADO_SYN $(VIVADO_SYN)' >> ./settings.tcl
229+
@echo 'set VIVADO_IMPL $(VIVADO_IMPL)' >> ./settings.tcl
230+
@echo 'set XF_PROJ_ROOT "$(XF_PROJ_ROOT)"' >> ./settings.tcl
231+
@echo 'set CUR_DIR "$(CUR_DIR)"' >> ./settings.tcl
232+
@echo "Configured: settings.tcl"
233+
@echo "----"
234+
@cat ./settings.tcl
235+
@echo "----"
236+
237+
HLS ?= vitis_hls
238+
runhls: data setup | check_vivado check_vpp
239+
$(HLS) -f run_hls.tcl;
240+
241+
clean:
242+
rm -rf settings.tcl *_hls.log tokenize.prj
243+
244+
# Used by Jenkins test
245+
cleanall: clean
246+
247+
# MK_INC_END hls_test_rules.mk

0 commit comments

Comments
 (0)