diff --git a/ultrasound/.clang-format b/ultrasound/.clang-format new file mode 100644 index 0000000000..0f21f51d95 --- /dev/null +++ b/ultrasound/.clang-format @@ -0,0 +1,89 @@ +--- +Language: Cpp +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: false +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: true +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +ReflowComments: true +SortIncludes: false +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp03 +TabWidth: 8 +UseTab: Never +... + diff --git a/ultrasound/.gitignore b/ultrasound/.gitignore new file mode 100644 index 0000000000..30870bca8c --- /dev/null +++ b/ultrasound/.gitignore @@ -0,0 +1,64 @@ +_x_* +build_dir* +emconfig.json +xclbin.run_summary +timeline_trace.csv +profile_summary.csv +reports +xrt.ini +*.swp +*.swo +*.wdb +*.wcfg +*.protoinst +sample_*.ini +jks.* +make_gen_*.ini +TestResults +*.prj +*_sw_emu +*_hw_emu +*_hw +.Xil +*log +bin_* +obj_* +hls +_x +Work +*.xo +*.a +*_output +*_summary +.run +*.xclbin +*.o +*.bak +*.xsa +host_ps_on_x86 +*.img +*.sh +tmp_org +.vscode +__tmp_build +*.BIN +*.exe +*.bif +*.bin +sd_card +sim +cfg +*.vcd +.ipcache +.AIE_SIM_CMD_LINE_OPTIONS +ISS_RPC_SERVER_PORT +pmc_args.txt +qemu_args.txt +pl_sample_counts +database_test.json +out_abt_beamform.json +output_res.json +sol.db +Map_Report.csv +temp +pl_sample_count_* diff --git a/ultrasound/Jenkinsfile b/ultrasound/Jenkinsfile new file mode 100644 index 0000000000..70b98a3760 --- /dev/null +++ b/ultrasound/Jenkinsfile @@ -0,0 +1,8 @@ +@Library('pipeline-library')_ + +VitisLibPipeline (branch: 'next', + libname: 'xf_ultrasound', + TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu:vitis_hw_build:vitis_hw_run:vitis_aie_sim:vitis_aie_x86sim', + upstream_dependencies: '', + devtest: 'RunDeploy.sh', + TOOLVERSION: '2023.1_stable_latest') \ No newline at end of file diff --git a/ultrasound/L1/README.md b/ultrasound/L1/README.md new file mode 100644 index 0000000000..7a026c0664 --- /dev/null +++ b/ultrasound/L1/README.md @@ -0,0 +1,453 @@ +## Ultrasound Library - Level 1 (L1) + +The level 1 of Vitis Ultrasound Library contains the aie kernels. For more details information, please reference to L1 User Guide in the document for usage and design information. + +## Overview of APIs +The L1 APIs is a set of APIs which are created to create a closest mapping possible between *NumPy* and the *C++* SIMD APIs of the AI Engine. The APIs resulted are a more comprehensive and easy interface for the user to create its own application using numpy-like interfaces. +The APIs can be divided in two main groups: + +1. Element-wise operations between vectors and matrices. Those operations varies between basic operations (i.e. sum, multiplication etc...) to more complex ones (i.e. reciprocal, sign etc...); +2. Vector managing and creation. Those operations are intended to be used by the user to create or modify the dimension of the vectorial operands. Two example of those operations are *Tile* and *Ones*. + +Follow the details of L1 kernel available in the library: + +### Kernel name: absV + +```c++ +template +void absV(input_stream* in1, output_stream* out); +``` + +Element-Wise absolute values of a vector. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: cosV + + +```c++ +template +void cosV(input_stream* in1, output_stream* out); +``` + +Element-Wise cosine values of a vector. Elements must be expressed in radians with the range [0...2k$\pi$] + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: diffMV + + +```c++ +template +void diffMV(input_stream* in1, input_stream* in2, output_stream* out); +``` + +Element-Wise difference between the of the row of a matrix and the values of a vector. The number of the column of the matrix and the entry of the vector must have the same size. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the first matrix to be passed to the kernel. + - `in2`: elements of the array to be passed to the kernel. + - `out`: elements of the result of the operation (matrix) to be passed from the kernel. + +### Kernel name: diffSV + + +```c++ +template +void diffSV(input_stream* in1, input_stream* in2, output_window* out); +``` + +Element-Wise difference between a scalar and the values of a vector. For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: scalar element to be passed to the kernel. + - `in2`: elements of the array to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: diffVS + +```c++ +template +void diffVS(input_stream* in1, input_stream* in2, output_stream* out); +``` + +Element-Wise difference between the values of a vector and a scalar. For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the array to be passed to the kernel. + - `in2`: scalar element to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: divVS + + +```c++ +template +void divVS(input_stream* in1, output_stream* out); +``` + +Element-Wise division between the values of a vector and a scalar. For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the array to be passed to the kernel. + - `in2`: scalar element to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: equalS + + +```c++ +template +void equalS(input_stream* in1, output_stream* out); +``` + +Check whether the element of an array are equal to a specific number. An array of 0s or 1s is returned. 1 means that the element at that specific position is equal to the scalar, otherwise 0 is returned. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; + - `SCALAR`: scalar to which the elements of the array are compared to; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: lessOrEqualThanS + + +```c++ +template +void lessOrEqualThanS(input_stream* in1, output_stream* out); +``` + +Check whether the element of an array are less or equal to a specific number. An array of 0s or 1s is returned. 1 means that the element at that specific position is less or equal to the scalar, otherwise 0 is returned. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; + - `SCALAR`: scalar to which the elements of the array are compared to; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: mulMM + + +```c++ +template +void mulMM(input_stream* in1, input_stream* in2, output_stream* out); +``` + +Element-Wise multiplication of two matrixes. The first matrix and the second one must have the same size. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the first matrix to be passed to the kernel. + - `in2`: elements of the second matrix to be passed to the kernel. + - `out`: elements of the result of the operation (matrix) to be passed from the kernel. + +### Kernel name: mulVS + + +```c++ +template +void mulVS(input_stream* in1, output_stream* out); +``` + +Element-Wise multiplication between the values of a vector and a scalar. For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the array to be passed to the kernel. + - `in2`: scalar element to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: mulVV + + +```c++ +template +void mulVV(input_stream* in1, input_stream* in2, output_stream* out); +``` + +Element-Wise multiplication of two vectors. The first vector and the second one must have the same size. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the first vector to be passed to the kernel. + - `in2`: elements of the second vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: norm_axis_1 + + +```c++ +template +void norm_axis_1(input_stream* in1, output_stream* out); +``` + +Perform row wise the euclidean norm of a matrix of the columns. Because for every row returns a number, the result is a vector of values which represents for every row the magnitude of the euclidean norm. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: ones + + +```c++ +template +void ones_stream(output_stream* out); +``` + +Return a vector of with all entry set to 1. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: outer + + +```c++ +template +void outer(input_window* in1, input_window* in2, output_stream* out); +``` + +Perform the outer product (also named cross-product or vector-product) between two vectors. The result of this operation is a matrix which rows are the number of the entry of the first vector and the column the number of the entry of the second one. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the first vector to be passed to the kernel. + - `in2`: elements of the second vector to be passed to the kernel. + - `out`: elements of the result of the operation (matrix) to be passed from the kernel. + +### Kernel name: reciprocalV + + +```c++ +template +void reciprocalV(input_stream* in1, output_stream* out); +``` + +Element-wise inverse operation of the entry of the vector. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: sqrtV + +```c++ +template +void sqrtV(input_stream* in1, output_stream* out); +``` + +Element-wise square root operation of the entry of the vector. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: squareV + +```c++ +template +void squareV(input_stream* in1, output_stream* out); +``` + +Element-wise square operation of the entry of the vector. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: sum_axis_1 + + +```c++ +template +void sum_axis_1(input_stream* in1, output_stream* out); +``` + +Perform row wise the reduce add of a matrix of the columns. Because for every row returns a number, the result is a vector of values which represents for every row the magnitude of the reduce add operation. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: sumMM + + +```c++ +template +void sumMM(input_window* in1, input_window* in2, output_stream* out); +``` + +Element-Wise sum of two matrixes. The first matrix and the second one must have the same size. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the first matrix to be passed to the kernel. + - `in2`: elements of the second matrix to be passed to the kernel. + - `out`: elements of the result of the operation to be passed from the kernel. + +### Kernel name: sumVS + + +```c++ +template +void sumVS(input_stream* in1, input_stream* in2, output_stream* out); +``` + +Element-Wise addition between the values of a vector and a scalar. For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the array to be passed to the kernel. + - `in2`: scalar element to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: sumVV + + +```c++ +template +void sumVV(input_stream* in1, input_stream* in2, output_stream* out); +``` + +Element-Wise addition of two vectors. The first vector and the second one must have the same size. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the first vector to be passed to the kernel. + - `in2`: elements of the second vector to be passed to the kernel. + - `out`: elements of the result of the operation (vector) to be passed from the kernel. + +### Kernel name: tileV + + +```c++ +template +void tileV(input_stream* in1, output_stream* out); +``` + +This kernel read in input a vector and returns it `LEN` times. This operation creates a matrix with the rows all equal to the others. + +- **Template params**: + - `T`: type of the operation; + - `LEN`: number of elements to be processed in the kernel per iteration; + - `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length; + - `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen; +- **Function params**: + - `in1`: elements of the vector to be passed to the kernel. + - `out`: elements of the result of the operation (matrix) to be passed from the kernel. + +## License +Copyright 2022 AMD, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/ultrasound/L1/include/absV/absV.cpp b/ultrasound/L1/include/absV/absV.cpp new file mode 100644 index 0000000000..6a4f336db9 --- /dev/null +++ b/ultrasound/L1/include/absV/absV.cpp @@ -0,0 +1,93 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void absV(adf::input_buffer& __restrict in, adf::output_buffer& __restrict out) { + T* __restrict p_in = in.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + res = aie::abs(op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void absVWS(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::abs(op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void absVSW(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::abs(op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void absVStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_VECTOR) { + op1 = readincr_v(in1); + + res = aie::abs(op1); + + window_writeincr(out, res); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/cosV/cosV.cpp b/ultrasound/L1/include/cosV/cosV.cpp new file mode 100644 index 0000000000..5e63c4a6e3 --- /dev/null +++ b/ultrasound/L1/include/cosV/cosV.cpp @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" +#include "cos_lut.hpp" + +namespace us { +namespace L1 { + +template +void cosV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(100); + aie::vector res = aie::zeros(); + + // int32 value_int; + int32 angle_index; + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + op1 = aie::mul(op1, op2); + + for (unsigned int j = 0; j < VECDIM; ++j) { + // value_int = op1[j] * 100; + angle_index = ((int32)(op1[j]) % 628); + res[j] = cos_lut[angle_index]; + } + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/cosV/cos_lut.hpp b/ultrasound/L1/include/cosV/cos_lut.hpp new file mode 100644 index 0000000000..e0602a71df --- /dev/null +++ b/ultrasound/L1/include/cosV/cos_lut.hpp @@ -0,0 +1,646 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +float cos_lut[628] = {1.0, + 0.9999500004166653, + 0.9998000066665778, + 0.9995500337489875, + 0.9992001066609779, + 0.9987502603949663, + 0.9982005399352042, + 0.9975510002532796, + 0.9968017063026194, + 0.9959527330119943, + 0.9950041652780258, + 0.9939560979566968, + 0.9928086358538663, + 0.9915618937147881, + 0.9902159962126371, + 0.9887710779360422, + 0.9872272833756269, + 0.9855847669095608, + 0.9838436927881214, + 0.9820042351172703, + 0.9800665778412416, + 0.9780309147241483, + 0.9758974493306055, + 0.9736663950053749, + 0.9713379748520297, + 0.9689124217106447, + 0.9663899781345132, + 0.9637708963658905, + 0.9610554383107709, + 0.9582438755126972, + 0.955336489125606, + 0.9523335698857134, + 0.9492354180824408, + 0.946042343528387, + 0.9427546655283462, + 0.9393727128473789, + 0.9358968236779348, + 0.9323273456060345, + 0.9286646355765102, + 0.9249090598573131, + 0.9210609940028851, + 0.9171208228166051, + 0.9130889403123083, + 0.9089657496748851, + 0.9047516632199634, + 0.9004471023526769, + 0.8960524975255252, + 0.891568288195329, + 0.8869949227792842, + 0.8823328586101215, + 0.8775825618903728, + 0.8727445076457513, + 0.8678191796776499, + 0.862807070514761, + 0.8577086813638242, + 0.8525245220595057, + 0.8472551110134161, + 0.8419009751622688, + 0.8364626499151869, + 0.8309406791001636, + 0.8253356149096783, + 0.8196480178454795, + 0.8138784566625339, + 0.8080275083121519, + 0.8020957578842927, + 0.7960837985490559, + 0.7899922314973651, + 0.7838216658808492, + 0.7775727187509279, + 0.7712460149971067, + 0.7648421872844885, + 0.7583618759905082, + 0.751805729140895, + 0.7451744023448704, + 0.7384685587295879, + 0.7316888688738209, + 0.7248360107409052, + 0.7179106696109433, + 0.7109135380122773, + 0.7038453156522361, + 0.6967067093471654, + 0.689498432951747, + 0.6822212072876136, + 0.6748757600712672, + 0.6674628258413081, + 0.6599831458849822, + 0.6524374681640519, + 0.6448265472400012, + 0.6371511441985802, + 0.6294120265736969, + 0.6216099682706644, + 0.6137457494888116, + 0.6058201566434628, + 0.5978339822872982, + 0.5897880250310983, + 0.5816830894638836, + 0.5735199860724567, + 0.5652995311603544, + 0.5570225467662173, + 0.5486898605815875, + 0.5403023058681398, + 0.5318607213743555, + 0.5233659512516495, + 0.5148188449699553, + 0.5062202572327784, + 0.49757104789172696, + 0.4888720818605275, + 0.4801242290285341, + 0.47132836417373997, + 0.4624853668753008, + 0.4535961214255773, + 0.4446615167417068, + 0.4356824462767121, + 0.4266598079301574, + 0.4175945039583582, + 0.4084874408841574, + 0.3993395294062732, + 0.3901516843082303, + 0.38092482436688185, + 0.371659872260533, + 0.3623577544766736, + 0.3530194012193304, + 0.34364574631604705, + 0.3342377271245026, + 0.32479628443877623, + 0.3153223623952687, + 0.30581690837828934, + 0.29628087292531874, + 0.2867152096319555, + 0.2771208750565576, + 0.26749882862458735, + 0.25785003253266964, + 0.2481754516523729, + 0.23847605343372313, + 0.22875280780845939, + 0.2190066870930415, + 0.20923866589141926, + 0.19944972099757285, + 0.18964083129783446, + 0.17981297767299959, + 0.16996714290024104, + 0.16010431155483126, + 0.15022546991168584, + 0.14033160584673673, + 0.13042370873814554, + 0.12050276936736662, + 0.11056977982006959, + 0.10062573338693173, + 0.09067162446430968, + 0.08070844845480063, + 0.0707372016677029, + 0.0607588812193859, + 0.05077448493357918, + 0.040785011241591035, + 0.03079145908246612, + 0.020794827803092428, + 0.010796117058267392, + 0.0007963267107332633, + -0.009203543268808336, + -0.01920249290169265, + -0.029199522301288815, + -0.03919363177298771, + -0.049183821914170554, + -0.059169093714148135, + -0.06914844865406194, + -0.07912088880673386, + -0.08908541693645897, + -0.09904103659872801, + -0.10898675223987112, + -0.11892156929661223, + -0.12884449429552464, + -0.13875453495237755, + -0.14865070027136365, + -0.15853200064419776, + -0.16839744794907702, + -0.17824605564949209, + -0.1880768388928801, + -0.197888814609109, + -0.2076810016087838, + -0.21745242068136464, + -0.2272020946930871, + -0.23692904868467468, + -0.24663230996883403, + -0.2563109082275227, + -0.2659638756089804, + -0.27559024682451294, + -0.28518905924502086, + -0.294759352997261, + -0.3043001710598332, + -0.31381055935888225, + -0.32328956686350335, + -0.33273624568084514, + -0.3421496511508982, + -0.35152884194095985, + -0.36087288013976715, + -0.3701808313512869, + -0.3794517647881545, + -0.388684753364752, + -0.397878873789916, + -0.4070332066592655, + -0.4161468365471424, + -0.4252188520981522, + -0.4342483461183005, + -0.4432344156657089, + -0.45217616214091194, + -0.46107269137671275, + -0.4699231137276022, + -0.4787265441587198, + -0.4874821023343594, + -0.49618891270599885, + -0.5048461045998576, + -0.5134528123039594, + -0.5220081751547073, + -0.5305113376229448, + -0.5389614493995115, + -0.547357665480271, + -0.5556991462506127, + -0.5639850575694101, + -0.5722145708524369, + -0.5803868631552219, + -0.5885011172553458, + -0.5965565217341599, + -0.6045522710579296, + -0.6124875656583851, + -0.6203616120126798, + -0.6281736227227391, + -0.6359228165940024, + -0.6436084187135406, + -0.6512296605275455, + -0.6587857799181878, + -0.6662760212798241, + -0.6736996355945609, + -0.6810558805071525, + -0.6883440203992384, + -0.6955633264629021, + -0.702713076773554, + -0.7097925563621205, + -0.7168010572865429, + -0.7237378787025686, + -0.7306023269338372, + -0.7373937155412454, + -0.7441113653915925, + -0.7507546047254909, + -0.7573227692245438, + -0.7638152020777741, + -0.7702312540473074, + -0.776570283533293, + -0.7828316566380653, + -0.7890147472295311, + -0.7951189370037843, + -0.8011436155469337, + -0.8070881803961459, + -0.81295203709989, + -0.8187345992773816, + -0.8244352886772223, + -0.8300535352352221, + -0.8355887771314077, + -0.8410404608462014, + -0.8464080412157756, + -0.8516909814865656, + -0.8568887533689473, + -0.8620008370900635, + -0.8670267214458024, + -0.8719659038519165, + -0.8768178903942815, + -0.8815821958782859, + -0.886258343877352, + -0.8908458667805764, + -0.8953443058394921, + -0.8997532112139414, + -0.9040721420170612, + -0.9083006663593701, + -0.912438361391958, + -0.9164848133487693, + -0.9204396175879807, + -0.9243023786324636, + -0.9280727102093326, + -0.9317502352885721, + -0.9353345861207387, + -0.9388254042737362, + -0.9422223406686581, + -0.9455250556146959, + -0.948733218843107, + -0.9518465095402424, + -0.9548646163796264, + -0.9577872375530904, + -0.9606140808009522, + -0.9633448634412433, + -0.9659793123979747, + -0.9685171642284466, + -0.9709581651495905, + -0.9733020710633487, + -0.9755486475810826, + -0.9776976700470132, + -0.9797489235606842, + -0.9817022029984541, + -0.9835573130340064, + -0.9853140681578838, + -0.9869722926960376, + -0.988531820827396, + -0.9899924966004454, + -0.9913541739488259, + -0.9926167167059371, + -0.9937799986185556, + -0.9948439033594595, + -0.9958083245390612, + -0.9966731657160466, + -0.9974383404070185, + -0.9981037720951457, + -0.9986693942378135, + -0.9991351502732795, + -0.9995009936263278, + -0.9997668877129283, + -0.9999328059438939, + -0.9999987317275395, + -0.999964658471342, + -0.9998305895825983, + -0.9995965384680858, + -0.9992625285327209, + -0.9988285931772186, + -0.9982947757947531, + -0.9976611297666176, + -0.9969277184568869, + -0.9960946152060809, + -0.9951619033238304, + -0.9941296760805463, + -0.9929980366980927, + -0.991767098339465, + -0.9904369840974732, + -0.9890078269824328, + -0.9874797699088649, + -0.9858529656812031, + -0.9841275769785145, + -0.9823037763382317, + -0.9803817461388988, + -0.9783616785819341, + -0.9762437756724099, + -0.9740282491988521, + -0.9717153207120621, + -0.9693052215029608, + -0.9667981925794611, + -0.9641944846423657, + -0.9614943580602988, + -0.9586980828436685, + -0.9558059386176664, + -0.9528182145943047, + -0.9497352095434962, + -0.9465572317631765, + -0.9432845990484758, + -0.9399176386599379, + -0.9364566872907963, + -0.9329020910333036, + -0.9292542053441233, + -0.9255133950087845, + -0.9216800341052034, + -0.917754505966276, + -0.9137372031415447, + -0.9096285273579445, + -0.9054288894796296, + -0.9011387094668886, + -0.896758416334147, + -0.8922884481070684, + -0.8877292517787501, + -0.8830812832650261, + -0.878345007358874, + -0.8735208976839379, + -0.8686094366471648, + -0.8636111153905661, + -0.8585264337421017, + -0.8533559001656995, + -0.848100031710408, + -0.8427593539586935, + -0.83733440097388, + -0.8318257152467456, + -0.8262338476412722, + -0.8205593573395608, + -0.8148028117859125, + -0.8089647866300855, + -0.8030458656697309, + -0.7970466407920117, + -0.7909677119144168, + -0.7848096869247678, + -0.7785731816204325, + -0.7722588196467437, + -0.7658672324346374, + -0.7593990591375078, + -0.7528549465672953, + -0.7462355491298028, + -0.7395415287592585, + -0.7327735548521205, + -0.7259323042001402, + -0.7190184609226812, + -0.7120327163983101, + -0.7049757691956576, + -0.6978483250035638, + -0.6906510965605076, + -0.6833848035833362, + -0.6760501726952918, + -0.6686479373533513, + -0.66117883777488, + -0.6536436208636119, + -0.6460430401349587, + -0.6383778556406595, + -0.6306488338927753, + -0.6228567477870415, + -0.6150023765255744, + -0.6070865055389552, + -0.599109926407685, + -0.5910734367830314, + -0.5829778403072591, + -0.5748239465332692, + -0.5666125708436437, + -0.55834453436911, + -0.5500206639064251, + -0.5416417918356986, + -0.5332087560371543, + -0.5247223998073464, + -0.5161835717748248, + -0.5075931258152773, + -0.4989519209661403, + -0.4902608213406994, + -0.4815206960416738, + -0.47273241907430985, + -0.4638968692589801, + -0.4550149301433047, + -0.4460874899137928, + -0.43711544130702784, + -0.42809968152039385, + -0.41904111212235556, + -0.4099406389623056, + -0.40079917207997545, + -0.3916176256144355, + -0.38239691771268025, + -0.3731379704378176, + -0.3638417096768584, + -0.35450906504813195, + -0.3451409698083231, + -0.33573836075915076, + -0.3263021781536835, + -0.3168333656023185, + -0.30733286997841935, + -0.29780164132363307, + -0.2882406327528816, + -0.2786508003590546, + -0.26903310311739903, + -0.2593885027896261, + -0.24971796382773062, + -0.24002245327754992, + -0.23030294068205867, + -0.22056039798441854, + -0.2107957994307797, + -0.20101012147286038, + -0.19120434267030162, + -0.18137944359281138, + -0.1715364067221118, + -0.1616762163536865, + -0.15179985849835556, + -0.14190832078367338, + -0.13200259235517026, + -0.12208366377743342, + -0.11215252693505487, + -0.10221017493344206, + -0.09225760199951166, + -0.08229580338226238, + -0.07232577525325448, + -0.06234851460699166, + -0.052365019161225934, + -0.04237628725718146, + -0.03238331775972473, + -0.022387109957477145, + -0.01238866346289056, + -0.0023889781122815386, + 0.007610946134147902, + 0.01761010929230725, + 0.02760751145421152, + 0.03760215288797655, + 0.047593034137787815, + 0.05757915612384602, + 0.0675595202422752, + 0.07753312846497869, + 0.0874989834394464, + 0.09745608858848573, + 0.10740344820988024, + 0.11734006757595546, + 0.12726495303305616, + 0.1371771121009073, + 0.1470755535718631, + 0.15695928761002342, + 0.1668273258502217, + 0.17667868149685725, + 0.18651236942257576, + 0.19632740626677758, + 0.20612281053395834, + 0.21589760269185415, + 0.2256508052693957, + 0.23538144295445118, + 0.24508854269136174, + 0.25477113377824295, + 0.2644282479640558, + 0.27405891954542744, + 0.28366218546322625, + 0.2932370853988631, + 0.30278266187032354, + 0.3122979603279158, + 0.3217820292497218, + 0.3312339202367537, + 0.34065268810778926, + 0.35003739099389114, + 0.3593870904325897, + 0.3687008514617332, + 0.37797774271298024, + 0.3872168365049372, + 0.39641720893592247, + 0.4055779399763607, + 0.4146981135607818, + 0.4237768176794282, + 0.43281314446945207, + 0.44180619030570545, + 0.45075505589109877, + 0.4596588463465318, + 0.4685166713003771, + 0.47732764497752167, + 0.48609088628794017, + 0.49480551891480506, + 0.5034706714021142, + 0.5120854772418407, + 0.5206490749605794, + 0.5291606082056949, + 0.5376192258309563, + 0.5460240819816483, + 0.5543743361791608, + 0.5626691534050324, + 0.5709077041844536, + 0.5790891646692105, + 0.5872127167200731, + 0.5952775479886061, + 0.6032828519984039, + 0.6112278282257352, + 0.6191116821795987, + 0.6269336254811689, + 0.6346928759426347, + 0.6423886576454144, + 0.6500202010177517, + 0.657586742911669, + 0.6650875266792828, + 0.6725218022484659, + 0.6798888261978571, + 0.6871878618312006, + 0.6944181792510162, + 0.701579055431586, + 0.70866977429126, + 0.715689626764061, + 0.7226379108705916, + 0.729513931788232, + 0.7363170019206192, + 0.7430464409664099, + 0.7497015759873071, + 0.7562817414753555, + 0.7627862794194885, + 0.7692145393713327, + 0.7755658785102496, + 0.7818396617076188, + 0.7880352615903476, + 0.7941520586036113, + 0.8001894410728057, + 0.8061468052647157, + 0.8120235554478855, + 0.8178191039521945, + 0.823532871227622, + 0.8291642859022023, + 0.8347127848391598, + 0.840177813193225, + 0.8455588244661169, + 0.8508552805611925, + 0.8560666518372553, + 0.8611924171615208, + 0.8662320639617282, + 0.871185088277397, + 0.8760509948102237, + 0.880829296973609, + 0.8855195169413189, + 0.8901211856952652, + 0.8946338430724075, + 0.8990570378107678, + 0.9033903275945588, + 0.9076332790984132, + 0.9117854680307166, + 0.9158464791760352, + 0.9198159064366391, + 0.92369335287311, + 0.9274784307440359, + 0.9311707615447831, + 0.934769976045349, + 0.9382757143272825, + 0.9416876258196776, + 0.9450053693342275, + 0.9482286130993458, + 0.951357034793342, + 0.954390321576654, + 0.9573281701231308, + 0.960170286650366, + 0.9629163869490754, + 0.9655661964115176, + 0.9681194500589547, + 0.9705758925681492, + 0.9729352782968974, + 0.9751973713085926, + 0.977361945395819, + 0.9794287841029711, + 0.9813976807479009, + 0.9832684384425845, + 0.9850408701128117, + 0.9867147985168921, + 0.9882900562633804, + 0.9897664858278147, + 0.991143939568469, + 0.9924222797411169, + 0.9936013785128064, + 0.994681117974643, + 0.9956613901535805, + 0.9965420970232175, + 0.9973231505136012, + 0.9980044725200334, + 0.9985859949108813, + 0.9990676595343903, + 0.9994494182244994, + 0.9997312328056578, + 0.9999130750966423}; diff --git a/ultrasound/L1/include/dataMover/dataMover.cpp b/ultrasound/L1/include/dataMover/dataMover.cpp new file mode 100644 index 0000000000..65961fbe68 --- /dev/null +++ b/ultrasound/L1/include/dataMover/dataMover.cpp @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void dataMover(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; ++i) { + res = aie::broadcast(*p_in); + p_in++; + // // window_writeincr(out1, res); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/diffMS/diffMS.cpp b/ultrasound/L1/include/diffMS/diffMS.cpp new file mode 100644 index 0000000000..ccf70cff45 --- /dev/null +++ b/ultrasound/L1/include/diffMS/diffMS.cpp @@ -0,0 +1,36 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +void diffMS(input_window* in1, input_stream* in2, output_stream* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = readincr_v<4>(in2); + + op3 = aie::concat(op2, op2, op2, op2); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_MATRIX) { + window_readincr_v(in1, op1); + + res = aie::sub(op1, op3); + + writeincr(out, res); + } +}; diff --git a/ultrasound/L1/include/diffMV/diffMV.cpp b/ultrasound/L1/include/diffMV/diffMV.cpp new file mode 100644 index 0000000000..7b170d454c --- /dev/null +++ b/ultrasound/L1/include/diffMV/diffMV.cpp @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void diffMV(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = aie::load_v(p_in2); + +#if SIMD_DEPTH == 4 + op3 = op2; +#endif +#if SIMD_DEPTH == 8 + op3 = aie::concat(op2, op2); +#endif +#if SIMD_DEPTH == 16 + op3 = aie::concat(op2, op2, op2, op2); +#endif + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::sub(op1, op3); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/diffSV/diffSV.cpp b/ultrasound/L1/include/diffSV/diffSV.cpp new file mode 100644 index 0000000000..14ae75aec1 --- /dev/null +++ b/ultrasound/L1/include/diffSV/diffSV.cpp @@ -0,0 +1,338 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void diffSV(adf::input_buffer& __restrict in1, adf::input_buffer& __restrict in2, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op3 = aie::load_v(p_in1); + op2 = aie::broadcast(op3[1]); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in2); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::sub(op2, op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void diffOneV(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = aie::broadcast(1); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = readincr_v(in1); + + res = aie::sub(op2, op1); + + window_writeincr(out, res); + } +}; + +template +void diffOneVWW(adf::input_buffer& __restrict in, adf::output_buffer& __restrict out) { + T* __restrict p_in = in.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = aie::broadcast(1); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + res = aie::sub(op2, op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void diffOneLin(adf::output_buffer& __restrict out) { + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + +#if SIMD_DEPTH == 16 + + op1[0] = 1.0; + op1[1] = 1.06666667; + op1[2] = 1.13333333; + op1[3] = 1.2; + op1[4] = 1.26666667; + op1[5] = 1.33333333; + op1[6] = 1.4; + op1[7] = 1.46666667; + op1[8] = 1.53333333; + op1[9] = 1.6; + op1[10] = 1.66666667; + op1[11] = 1.73333333; + op1[12] = 1.8; + op1[13] = 1.86666667; + op1[14] = 1.93333333; + op1[15] = 2.0; + +#endif +#if SIMD_DEPTH == 4 + + op1[0] = 1.0; + op1[1] = 1.33333333; + op1[2] = 1.66666667; + op1[3] = 2; +#endif +#if SIMD_DEPTH == 8 + + op1[0] = 1.0; + op1[1] = 1.14285714; + op1[2] = 1.28571429; + op1[3] = 1.42857143; + op1[4] = 1.57142857; + op1[5] = 1.71428571; + op1[6] = 1.85714286; + op1[7] = 2.0; + +#endif + + for (unsigned i = 0; i < LEN; ++i) { + res = aie::sub(op2, op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void diffOneV(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += SIMD_DEPTH) { + window_readincr_v(in1, op1); + + res = aie::sub(op2, op1); + + window_writeincr(out, res); + } +}; + +void diffOneVStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + op1 = readincr_v(in1); + + res = aie::sub(op2, op1); + + window_writeincr(out, res); + } +}; + +void diffTwoV(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + window_readincr_v(in1, op1); + + res = aie::sub(op2, op1); + + window_writeincr(out, res); + } +}; + +template +void diffTwoLin(adf::output_buffer& __restrict out) { + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2); + aie::vector res = aie::zeros(); + +#if SIMD_DEPTH == 16 + + op1[0] = 1.0; + op1[1] = 1.06666667; + op1[2] = 1.13333333; + op1[3] = 1.2; + op1[4] = 1.26666667; + op1[5] = 1.33333333; + op1[6] = 1.4; + op1[7] = 1.46666667; + op1[8] = 1.53333333; + op1[9] = 1.6; + op1[10] = 1.66666667; + op1[11] = 1.73333333; + op1[12] = 1.8; + op1[13] = 1.86666667; + op1[14] = 1.93333333; + op1[15] = 2.0; + +#endif +#if SIMD_DEPTH == 4 + + op1[0] = 1.0; + op1[1] = 1.33333333; + op1[2] = 1.66666667; + op1[3] = 2; +#endif +#if SIMD_DEPTH == 8 + + op1[0] = 1.0; + op1[1] = 1.14285714; + op1[2] = 1.28571429; + op1[3] = 1.42857143; + op1[4] = 1.57142857; + op1[5] = 1.71428571; + op1[6] = 1.85714286; + op1[7] = 2.0; + +#endif + for (unsigned i = 0; i < LEN; ++i) { + res = aie::sub(op2, op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void diffTwoVStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + op1 = readincr_v(in1); + + res = aie::sub(op2, op1); + + window_writeincr(out, res); + } +}; + +void diffThreeV(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(3); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + window_readincr_v(in1, op1); + + res = aie::sub(op2, op1); + + window_writeincr(out, res); + } +}; + +template +void diffThreeLin(adf::output_buffer& __restrict out) { + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(3); + aie::vector res = aie::zeros(); + +#if SIMD_DEPTH == 16 + + op1[0] = 1.0; + op1[1] = 1.06666667; + op1[2] = 1.13333333; + op1[3] = 1.2; + op1[4] = 1.26666667; + op1[5] = 1.33333333; + op1[6] = 1.4; + op1[7] = 1.46666667; + op1[8] = 1.53333333; + op1[9] = 1.6; + op1[10] = 1.66666667; + op1[11] = 1.73333333; + op1[12] = 1.8; + op1[13] = 1.86666667; + op1[14] = 1.93333333; + op1[15] = 2.0; + +#endif +#if SIMD_DEPTH == 4 + + op1[0] = 1.0; + op1[1] = 1.33333333; + op1[2] = 1.66666667; + op1[3] = 2; +#endif +#if SIMD_DEPTH == 8 + + op1[0] = 1.0; + op1[1] = 1.14285714; + op1[2] = 1.28571429; + op1[3] = 1.42857143; + op1[4] = 1.57142857; + op1[5] = 1.71428571; + op1[6] = 1.85714286; + op1[7] = 2.0; + +#endif + + for (unsigned i = 0; i < LEN; ++i) { + res = aie::sub(op2, op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void diffThreeVStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(3); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + op1 = readincr_v(in1); + + res = aie::sub(op2, op1); + + window_writeincr(out, res); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/diffVS/diffVS.cpp b/ultrasound/L1/include/diffVS/diffVS.cpp new file mode 100644 index 0000000000..92286a25d6 --- /dev/null +++ b/ultrasound/L1/include/diffVS/diffVS.cpp @@ -0,0 +1,274 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void diffVS(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = aie::load_v(p_in2); + op3 = aie::broadcast(op2[1]); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::sub(op1, op3); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void diffVSStreamOut(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = aie::load_v(p_in2); + + op3 = aie::broadcast(op2[1]); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::sub(op1, op3); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void diffVOne(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + window_readincr_v(in1, op1); + + res = aie::sub(op1, op2); + + window_writeincr(out, res); + } +}; + +template +void diffLinOne(adf::output_buffer& __restrict out) { + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + +#if SIMD_DEPTH == 16 + + op1[0] = 1.0; + op1[1] = 1.06666667; + op1[2] = 1.13333333; + op1[3] = 1.2; + op1[4] = 1.26666667; + op1[5] = 1.33333333; + op1[6] = 1.4; + op1[7] = 1.46666667; + op1[8] = 1.53333333; + op1[9] = 1.6; + op1[10] = 1.66666667; + op1[11] = 1.73333333; + op1[12] = 1.8; + op1[13] = 1.86666667; + op1[14] = 1.93333333; + op1[15] = 2.0; + +#endif +#if SIMD_DEPTH == 4 + + op1[0] = 1.0; + op1[1] = 1.33333333; + op1[2] = 1.66666667; + op1[3] = 2; +#endif +#if SIMD_DEPTH == 8 + + op1[0] = 1.0; + op1[1] = 1.14285714; + op1[2] = 1.28571429; + op1[3] = 1.42857143; + op1[4] = 1.57142857; + op1[5] = 1.71428571; + op1[6] = 1.85714286; + op1[7] = 2.0; + +#endif + + for (unsigned i = 0; i < LEN; ++i) { + res = aie::sub(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void diffVOneStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + op1 = readincr_v(in1); + + res = aie::sub(op1, op2); + + window_writeincr(out, res); + } +}; + +void diffVTwo(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + window_readincr_v(in1, op1); + + res = aie::sub(op1, op2); + + window_writeincr(out, res); + } +}; + +template +void diffLinTwo(adf::output_buffer& __restrict out) { + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2); + aie::vector res = aie::zeros(); + +#if SIMD_DEPTH == 16 + + op1[0] = 1.0; + op1[1] = 1.06666667; + op1[2] = 1.13333333; + op1[3] = 1.2; + op1[4] = 1.26666667; + op1[5] = 1.33333333; + op1[6] = 1.4; + op1[7] = 1.46666667; + op1[8] = 1.53333333; + op1[9] = 1.6; + op1[10] = 1.66666667; + op1[11] = 1.73333333; + op1[12] = 1.8; + op1[13] = 1.86666667; + op1[14] = 1.93333333; + op1[15] = 2.0; + +#endif +#if SIMD_DEPTH == 4 + + op1[0] = 1.0; + op1[1] = 1.33333333; + op1[2] = 1.66666667; + op1[3] = 2; +#endif +#if SIMD_DEPTH == 8 + + op1[0] = 1.0; + op1[1] = 1.14285714; + op1[2] = 1.28571429; + op1[3] = 1.42857143; + op1[4] = 1.57142857; + op1[5] = 1.71428571; + op1[6] = 1.85714286; + op1[7] = 2.0; + +#endif + + for (unsigned i = 0; i < LEN; ++i) { + res = aie::sub(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void diffVTwoStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + op1 = readincr_v(in1); + + res = aie::sub(op1, op2); + + window_writeincr(out, res); + } +}; + +void diffVThree(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(3); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + window_readincr_v(in1, op1); + + res = aie::sub(op1, op2); + + window_writeincr(out, res); + } +}; + +void diffVThreeStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(3); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + op1 = readincr_v(in1); + + res = aie::sub(op1, op2); + + window_writeincr(out, res); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/divMS/divMS.cpp b/ultrasound/L1/include/divMS/divMS.cpp new file mode 100644 index 0000000000..ed29ff76b3 --- /dev/null +++ b/ultrasound/L1/include/divMS/divMS.cpp @@ -0,0 +1,31 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +void divMS(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(INVERSE_SPEED_OF_SOUND); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_MATRIX) { + window_readincr_v(in1, op1); + + res = aie::mul(op1, op2); + + window_writeincr(out, res); + } +}; diff --git a/ultrasound/L1/include/divVS/divVS.cpp b/ultrasound/L1/include/divVS/divVS.cpp new file mode 100644 index 0000000000..6aa5c439c1 --- /dev/null +++ b/ultrasound/L1/include/divVS/divVS.cpp @@ -0,0 +1,63 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void divVSSpeedOfSound(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(INVERSE_SPEED_OF_SOUND); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void divVSStream(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(INVERSE_SPEED_OF_SOUND); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_VECTOR) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/equalS/equalS.cpp b/ultrasound/L1/include/equalS/equalS.cpp new file mode 100644 index 0000000000..3ac51b6126 --- /dev/null +++ b/ultrasound/L1/include/equalS/equalS.cpp @@ -0,0 +1,45 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void equalS(adf::input_buffer& __restrict in1, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res; + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + for (unsigned j = 0; j < VECDIM; ++j) { + res[j] = (T)(op1[j] == static_cast(SCALAR)); + } + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/kernels.hpp b/ultrasound/L1/include/kernels.hpp new file mode 100644 index 0000000000..c52e2c95e7 --- /dev/null +++ b/ultrasound/L1/include/kernels.hpp @@ -0,0 +1,244 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#include "aie_api/aie.hpp" +#include "aie_api/utils.hpp" +#include "aie_api/aie_adf.hpp" + +#define KERNEL_RATIO 0.4 // 1.0 + +#define SIMD_DEPTH 4 +#define LENGTH 32 +#define LENGTH_FOC LENGTH +#define SPACE_DIMENSION 4 +//#define WIN_SIZE 128 +#define FIFO_DEPTH 8100 +//#define FRAME_LENGTH 64 +//#define N_SAMPLES 2048 +#define INCREMENT_MATRIX (SIMD_DEPTH / SPACE_DIMENSION) +#define INCREMENT_VECTOR SIMD_DEPTH +#define SPEED_OF_SOUND 1540 +#define INVERSE_SPEED_OF_SOUND 0.000649350649 //(1/SPEED_OF_SOUND) +#define F_NUMBER 2 +#define PI 3.1415926536 +#define PI_2 6.28318531 +#define BYTE_ALIGNMENT 4 +#define WIN_SIZE_VECTOR (LENGTH * BYTE_ALIGNMENT) +#define WIN_SIZE_MATRIX (LENGTH * BYTE_ALIGNMENT * SPACE_DIMENSION) +#define SAMPLING_FREQUENCY 100000000 // 0.000000083 +#define POINTS_PER_ITERATION 32 +#define WIN_SIZE_INTERPOLATOR (POINTS_PER_ITERATION * SIMD_DEPTH * BYTE_ALIGNMENT) + +#define DIM_VECTOR (LENGTH / INCREMENT_VECTOR * SIMD_DEPTH) +#define DIM_MATRIX (LENGTH / INCREMENT_MATRIX * SIMD_DEPTH) + +namespace us { +namespace L1 { + +template +void ones(adf::output_buffer& __restrict out); + +template +void outer(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void outerStream(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void sumMM(adf::input_buffer& in1, adf::input_buffer& in2, adf::output_buffer& out); + +template +void tileVApo(adf::output_buffer& __restrict out); + +template +void diffMV(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void mulMM(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void sum_axis_1(adf::input_buffer& in1, adf::output_buffer& out); + +template +void absV(adf::input_buffer& __restrict in, adf::output_buffer& __restrict out); + +template +void diffVS(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void mulVV(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void norm_axis_1(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void divVSSpeedOfSound(adf::input_buffer& in1, adf::output_buffer& out); + +template +void sumVSStream(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void diffVSStreamOut(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void mulVSStreamIn(input_window* in1, input_stream* in2, output_window* out); + +template +void sumVOne(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void sumVVStreamIn1(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void diffSV(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void squareV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void sumVV(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void sqrtV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void mulVSCRSWindow(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void mulLinSCRStreamIn(adf::input_buffer& __restrict in2, adf::output_buffer& __restrict out); + +template +void diffOneLin(adf::output_buffer& __restrict out); + +template +void diffTwoLin(adf::output_buffer& __restrict out); + +template +void diffLinOne(adf::output_buffer& __restrict out); + +template +void sumVVStreamOut(input_window* in1, input_window* in2, output_stream* out); + +template +void diffLinTwo(adf::output_buffer& __restrict out); + +template +void mulVHalfInt(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void mulLinHalf(adf::output_buffer& __restrict out); + +template +void mulVVStream(input_window* in1, input_stream* in2, output_window* out); + +template +void dataMover(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void diffThreeLin(adf::output_buffer& __restrict out); + +template +void equalS(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void lessOrEqualThanS(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void mulVPi(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void mulV1e_16(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void mulVS(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void mulVSStream(input_stream* in1, input_stream* in2, output_stream* out); + +template +void mulVSWS(adf::input_buffer& __restrict in1, adf::input_buffer& __restrict in2, adf::output_buffer& out); + +template +void absVSW(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void reciprocalV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void cosV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void diffOneV(input_stream* in1, output_window* out); + +template +void absVWS(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void mulVHalf(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void sumVOneSW(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +template +void mulVVStreamOut(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out); + +template +void diffOneVWW(adf::input_buffer& __restrict in, adf::output_buffer& __restrict out); + +// template +// void sumVVStreamIn1(input_stream* in1, input_window* in2, output_window* out); + +// template +// void diffMS(adf::input_buffer& __restrict in, adf::output_buffer& __restrict out); + +template +void sign(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out); + +} // namespace L1 + +} // namespace us diff --git a/ultrasound/L1/include/lessOrEqualThanS/lessOrEqualThanS.cpp b/ultrasound/L1/include/lessOrEqualThanS/lessOrEqualThanS.cpp new file mode 100644 index 0000000000..b837949d2f --- /dev/null +++ b/ultrasound/L1/include/lessOrEqualThanS/lessOrEqualThanS.cpp @@ -0,0 +1,44 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void lessOrEqualThanS(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res; + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + for (unsigned j = 0; j < VECDIM; ++j) { + res[j] = (T)(op1[j] <= static_cast(SCALAR)); + } + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/mulMM/mulMM.cpp b/ultrasound/L1/include/mulMM/mulMM.cpp new file mode 100644 index 0000000000..f12e09ea11 --- /dev/null +++ b/ultrasound/L1/include/mulMM/mulMM.cpp @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void mulMM(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + // matrix of beamf are nx3, so we pad with 1 zero and operate row by row, count = n° rows + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + op2 = aie::load_v(p_in2); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/mulVS/mulVS.cpp b/ultrasound/L1/include/mulVS/mulVS.cpp new file mode 100644 index 0000000000..6865eaec15 --- /dev/null +++ b/ultrasound/L1/include/mulVS/mulVS.cpp @@ -0,0 +1,509 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void mulVS(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + op2 = aie::load_v(p_in2); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +} + +template +void mulVSStream(input_stream* in1, input_stream* in2, output_stream* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op2 = readincr_v(in2); + + for (unsigned j = 0; j < SPACE_DIMENSION; ++j) { + op1 = readincr_v(in1); + + op3 = aie::broadcast(op2[j]); + + res = aie::mul(op1, op3); + + writeincr(out, res); + } + } +}; + +template +void mulVSStreamIn(input_window* in1, input_stream* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = readincr_v(in2); + + op3 = aie::broadcast(op2[1]); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + window_readincr_v(in1, op1); + + res = aie::mul(op1, op3); + + window_writeincr(out, res); + } +}; + +template +void mulVPi(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(PI); // 2*PI/2 + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void mulVPiStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2 * PI / 2); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = readincr_v(in1); + + res = aie::mul(op1, op2); + + window_writeincr(out, res); + } +}; + +template +void mulV1e_16(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1e-16); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void mulVSWS(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = aie::load_v(p_in2); + + op3 = aie::broadcast(op2[0]); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::mul(op1, op3); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void mulVSSamplingFrequency(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(SAMPLING_FREQUENCY); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += SIMD_DEPTH) { + window_readincr_v(in1, op1); + + res = aie::mul(op1, op2); + + window_writeincr(out, res); + } +}; + +void mulV1eMin16(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1e-16); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_VECTOR) { + window_readincr_v(in1, op1); + + res = aie::mul(op1, op2); + + window_writeincr(out, res); + } +}; + +void mulVTwo(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_VECTOR) { + window_readincr_v(in1, op1); + + res = aie::mul(op1, op2); + + window_writeincr(out, res); + } +}; + +// void mulVSStreamIn(input_window* in1, input_stream* in2, output_window* out){ +// +// aie::vector op1 = aie::zeros(); +// aie::vector op2 = aie::zeros(); +// aie::vector op3 = aie::zeros(); +// aie::vector res = aie::zeros(); +// +// op2 = readincr_v(in2); +// +// op3 = aie::concat(op2, op2, op2, op2); +// +// for(unsigned i = 0; i < LENGTH; i+=INCREMENT_VECTOR){ +// +// window_readincr_v(in1, op1); +// +// res = aie::mul(op1, op3); +// +// window_writeincr(out, res); +// } +// +// }; + +void mulV2FNumber(input_window* in1, output_stream* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2 * F_NUMBER); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_VECTOR) { + window_readincr_v(in1, op1); + + res = aie::mul(op1, op2); + + writeincr(out, res); + } +}; + +void mulV2Pi2(input_window* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(2 * PI / 2); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_VECTOR) { + window_readincr_v(in1, op1); + + res = aie::mul(op1, op2); + + window_writeincr(out, res); + } +}; + +template +void mulVHalf(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(0.5); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void mulVHalfInt(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(0.5); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; ++i) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void mulLinHalf(adf::output_buffer& __restrict out) { + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(0.5); + aie::vector res = aie::zeros(); + +#if SIMD_DEPTH == 16 + + op1[0] = 1.0; + op1[1] = 1.06666667; + op1[2] = 1.13333333; + op1[3] = 1.2; + op1[4] = 1.26666667; + op1[5] = 1.33333333; + op1[6] = 1.4; + op1[7] = 1.46666667; + op1[8] = 1.53333333; + op1[9] = 1.6; + op1[10] = 1.66666667; + op1[11] = 1.73333333; + op1[12] = 1.8; + op1[13] = 1.86666667; + op1[14] = 1.93333333; + op1[15] = 2.0; + +#endif +#if SIMD_DEPTH == 4 + + op1[0] = 1.0; + op1[1] = 1.33333333; + op1[2] = 1.66666667; + op1[3] = 2; +#endif +#if SIMD_DEPTH == 8 + + op1[0] = 1.0; + op1[1] = 1.14285714; + op1[2] = 1.28571429; + op1[3] = 1.42857143; + op1[4] = 1.57142857; + op1[5] = 1.71428571; + op1[6] = 1.85714286; + op1[7] = 2.0; + +#endif + + for (unsigned i = 0; i < LEN; ++i) { + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void mulVSCRStream(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(0.5); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; ++i) { + op1 = readincr_v(in1); + res = aie::mul(op1, op2); + window_writeincr(out, res); + } +}; + +void mulVSCRWindowIn(input_window* in1, input_window* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; i += 4) { // POINTS_PER_ITERATION / 4, 4 points per iteration + window_readincr_v(in2, op3); + for (unsigned j = 0; j < 4; ++j) { + window_readincr_v(in1, op1); + op2 = aie::broadcast(op3[j]); + res = aie::mul(op1, op2); + window_writeincr(out, res); + } + } +}; + +void mulVSCRStreamIn(input_window* in1, input_stream* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; i += 4) { // POINTS_PER_ITERATION / 4, 4 points per iteration + op3 = readincr_v<4>(in2); + for (unsigned j = 0; j < 4; ++j) { + window_readincr_v(in1, op1); + op2 = aie::broadcast(op3[j]); + res = aie::mul(op1, op2); + window_writeincr(out, res); + } + } +}; + +template +void mulLinSCRStreamIn(adf::input_buffer& __restrict in2, adf::output_buffer& __restrict out) { + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + +#if SIMD_DEPTH == 16 + + op1[0] = 1.0; + op1[1] = 1.06666667; + op1[2] = 1.13333333; + op1[3] = 1.2; + op1[4] = 1.26666667; + op1[5] = 1.33333333; + op1[6] = 1.4; + op1[7] = 1.46666667; + op1[8] = 1.53333333; + op1[9] = 1.6; + op1[10] = 1.66666667; + op1[11] = 1.73333333; + op1[12] = 1.8; + op1[13] = 1.86666667; + op1[14] = 1.93333333; + op1[15] = 2.0; + +#endif +#if SIMD_DEPTH == 4 + + op1[0] = 1.0; + op1[1] = 1.33333333; + op1[2] = 1.66666667; + op1[3] = 2; +#endif +#if SIMD_DEPTH == 8 + + op1[0] = 1.0; + op1[1] = 1.14285714; + op1[2] = 1.28571429; + op1[3] = 1.42857143; + op1[4] = 1.57142857; + op1[5] = 1.71428571; + op1[6] = 1.85714286; + op1[7] = 2.0; + +#endif + + for (unsigned i = 0; i < LEN; ++i) { + op2 = aie::load_v(p_in2); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +void mulVSCRStreamIn2(input_stream* in1, input_stream* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; i += 4) { // POINTS_PER_ITERATION / 4, 4 points per iteration + op3 = readincr_v<4>(in2); + for (unsigned j = 0; j < 4; ++j) { + op1 = readincr_v(in1); + op2 = aie::broadcast(op3[j]); + res = aie::mul(op1, op2); + window_writeincr(out, res); + } + } +}; + +template +void mulVSCRSWindow(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; ++i) { + op1 = aie::load_v(p_in1); + op2 = aie::load_v(p_in2); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/mulVV/mulVV.cpp b/ultrasound/L1/include/mulVV/mulVV.cpp new file mode 100644 index 0000000000..025b4edb1a --- /dev/null +++ b/ultrasound/L1/include/mulVV/mulVV.cpp @@ -0,0 +1,89 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void mulVV(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + op2 = aie::load_v(p_in2); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void mulVVStream(input_window* in1, input_stream* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; ++i) { + window_readincr_v(in1, op1); + op2 = readincr_v(in2); + + res = aie::mul(op1, op2); + + window_writeincr(out, res); + } +}; + +template +void mulVVStreamOut(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + op2 = aie::load_v(p_in2); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::mul(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/norm_axis_1/norm_axis_1.cpp b/ultrasound/L1/include/norm_axis_1/norm_axis_1.cpp new file mode 100644 index 0000000000..84357deb88 --- /dev/null +++ b/ultrasound/L1/include/norm_axis_1/norm_axis_1.cpp @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void norm_axis_1(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + // euclidean norm per row, max 128 bit simd + T* __restrict p_in = in1.data(); + auto outIter = aie::begin(out); + + aie::vector op1 = aie::zeros(); + aie::vector pow2 = aie::zeros(); + + T res; + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + pow2 = aie::mul_square(op1); + res = aie::sqrt(aie::reduce_add(pow2)); + + *outIter++ = res; + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/ones/ones.cpp b/ultrasound/L1/include/ones/ones.cpp new file mode 100644 index 0000000000..a2be12c361 --- /dev/null +++ b/ultrasound/L1/include/ones/ones.cpp @@ -0,0 +1,35 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void ones(adf::output_buffer& __restrict out) { + T* __restrict p_out = out.data(); + + aie::vector res = aie::broadcast(1); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/outer/outer.cpp b/ultrasound/L1/include/outer/outer.cpp new file mode 100644 index 0000000000..2657b38da1 --- /dev/null +++ b/ultrasound/L1/include/outer/outer.cpp @@ -0,0 +1,81 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void outer(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + op2 = aie::load_v(p_in2); + p_in2 = byte_incr(p_in2, SPACE_DIMENSION * sizeof(T)); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + for (unsigned j = 0; j < VECDIM; j++) { + op3 = aie::broadcast(op1[j]); + res = aie::mul(op3, op2); + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } + } +}; + +// template +// void outerStream(adf::input_buffer& __restrict in1, +// adf::input_buffer& __restrict in2, +// adf::output_buffer& __restrict out) { +// T* __restrict p_in1 = in1.data(); +// T* __restrict p_in2 = in2.data(); +// T* __restrict p_out = out.data(); + +// aie::vector op1 = aie::zeros(); +// aie::vector op2 = aie::zeros(); +// aie::vector op3 = aie::zeros(); +// aie::vector res = aie::zeros(); + +// op2 = aie::load_v(p_in2); +// p_in2 = byte_incr(p_in2, SPACE_DIMENSION * sizeof(T)); + +// for (unsigned i = 0; i < LEN; i += INCREMENT) { +// op1 = aie::load_v(p_in1); +// p_in1 = byte_incr(p_in1, SPACE_DIMENSION * sizeof(T)); + +// for (unsigned j = 0; j < VECDIM; j++) { +// op3 = aie::broadcast(op1[j]); +// res = aie::mul(op3, op2); +// // window_writeincr(out, res); +// aie::store_v(p_out, res); +// p_out = byte_incr(p_out, VECDIM * sizeof(T)); +// } +// } +// }; +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/reciprocalV/reciprocalV.cpp b/ultrasound/L1/include/reciprocalV/reciprocalV.cpp new file mode 100644 index 0000000000..2a772486ab --- /dev/null +++ b/ultrasound/L1/include/reciprocalV/reciprocalV.cpp @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void reciprocalV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + res = aie::inv(op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/sign/sign.cpp b/ultrasound/L1/include/sign/sign.cpp new file mode 100644 index 0000000000..90ec7d647c --- /dev/null +++ b/ultrasound/L1/include/sign/sign.cpp @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void sign(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + // input & output pointer + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + // vector definition + aie::vector op1 = aie::zeros(); + aie::vector res; + + // sign function + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + for (unsigned j = 0; j < INCREMENT; ++j) { + if (op1[j] == 0) + res[j] = (T)0; + else + res[j] = (T)(op1[j] < 0 ? -1 : 1); + } + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/sqrtV/sqrtV.cpp b/ultrasound/L1/include/sqrtV/sqrtV.cpp new file mode 100644 index 0000000000..c37ee86ab7 --- /dev/null +++ b/ultrasound/L1/include/sqrtV/sqrtV.cpp @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void sqrtV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += VECDIM) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + res = aie::sqrt(op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/squareV/squareV.cpp b/ultrasound/L1/include/squareV/squareV.cpp new file mode 100644 index 0000000000..c01c416c0c --- /dev/null +++ b/ultrasound/L1/include/squareV/squareV.cpp @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void squareV(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in); + p_in = byte_incr(p_in, VECDIM * sizeof(T)); + + res = aie::mul_square(op1); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/sumMM/sumMM.cpp b/ultrasound/L1/include/sumMM/sumMM.cpp new file mode 100644 index 0000000000..b652485a8b --- /dev/null +++ b/ultrasound/L1/include/sumMM/sumMM.cpp @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void sumMM(adf::input_buffer& in1, adf::input_buffer& in2, adf::output_buffer& out) { + // matrix of beamf are nx3, so we pad with 1 zero and operate row by row, count = n° rows + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + op2 = aie::load_v(p_in2); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::add(op1, op2); + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; +} // namespace L1 +} // namespace us + +void sumMM2Out(input_window* in1, + input_window* in2, + output_stream* out1, + output_stream* out2) { + // matrix of beamf are nx3, so we pad with 1 zero and operate row by row, count = n° rows + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += SPACE_DIMENSION) { + window_readincr_v(in1, op1); + window_readincr_v(in2, op2); + + res = aie::add(op1, op2); + + writeincr(out1, res); + writeincr(out2, res); + } +}; diff --git a/ultrasound/L1/include/sumVS/sumVS.cpp b/ultrasound/L1/include/sumVS/sumVS.cpp new file mode 100644 index 0000000000..68f419fc83 --- /dev/null +++ b/ultrasound/L1/include/sumVS/sumVS.cpp @@ -0,0 +1,124 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void sumVSStream(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector op3 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + op2 = aie::load_v(p_in2); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + op3 = aie::broadcast(op2[1]); + res = aie::add(op1, op3); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void sumVOne(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + // window_readincr_v(in1, op1); + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::add(op1, op2); + + // writeincr(out, res); + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +template +void sumVOneSW(adf::input_buffer& __restrict in1, adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + res = aie::add(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +}; + +} // namespace L1 +} // namespace us + +// void sumVOne(input_window* in1, output_stream* out){ +// +// aie::vector op1 = aie::zeros(); +// aie::vector op2 = aie::broadcast(1); +// aie::vector res = aie::zeros(); +// +// for(unsigned i = 0; i < LENGTH; i+=SIMD_DEPTH){ +// +// window_readincr_v(in1, op1); +// +// res = aie::add(op1, op2); +// +// writeincr(out, res); +// } +// +// }; + +void sumVOneStreamIn(input_stream* in1, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::broadcast(1); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += 16) { + op1 = readincr_v(in1); + + res = aie::add(op1, op2); + + window_writeincr(out, res); + } +}; diff --git a/ultrasound/L1/include/sumVV/sumVV.cpp b/ultrasound/L1/include/sumVV/sumVV.cpp new file mode 100644 index 0000000000..2826fcadd2 --- /dev/null +++ b/ultrasound/L1/include/sumVV/sumVV.cpp @@ -0,0 +1,168 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void sumVVStreamIn1(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, SIMD_DEPTH * sizeof(T)); + op2 = aie::load_v(p_in2); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::add(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +} + +template +void sumVV(adf::input_buffer& __restrict in1, + adf::input_buffer& __restrict in2, + adf::output_buffer& __restrict out) { + T* __restrict p_in1 = in1.data(); + T* __restrict p_in2 = in2.data(); + T* __restrict p_out = out.data(); + + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + + op2 = aie::load_v(p_in2); + p_in2 = byte_incr(p_in2, VECDIM * sizeof(T)); + + res = aie::add(op1, op2); + + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + } +} + +template +void sumVVStreamOut(input_window* in1, input_window* in2, output_stream* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LEN; i++) { + window_readincr_v(in1, op1); + window_readincr_v(in2, op2); + + res = aie::add(op1, op2); + + writeincr(out, res); + } +} + +} // namespace L1 +} // namespace us + +void sumVV_foc(input_window* in1, input_window* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH_FOC; i += SIMD_DEPTH) { + window_readincr_v(in1, op1); + window_readincr_v(in2, op2); + + res = aie::add(op1, op2); + + window_writeincr(out, res); + } +} + +// void sumVVStreamIn1(input_stream* in1, input_window* in2, output_window* out){ +// +// aie::vector op1 = aie::zeros(); +// aie::vector op2 = aie::zeros(); +// aie::vector res = aie::zeros(); +// +// for(unsigned i = 0; i < LENGTH; i+=SIMD_DEPTH){ +// +// op1 = readincr_v(in1); +// window_readincr_v(in2, op2); +// +// res = aie::add(op1, op2); +// +// window_writeincr(out, res); +// } +// +// } + +void sumVVStreamIn2(input_window* in1, input_stream* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < LENGTH; i += INCREMENT_VECTOR) { + window_readincr_v(in1, op1); + op2 = readincr_v(in2); + + res = aie::add(op1, op2); + + window_writeincr(out, res); + } +} + +void sumVV(input_window* in1, input_window* in2, output_window* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; i++) { + window_readincr_v(in1, op1); + window_readincr_v(in2, op2); + + res = aie::add(op1, op2); + + window_writeincr(out, res); + } +} + +void sumVVStream(input_window* in1, input_window* in2, output_stream* out) { + aie::vector op1 = aie::zeros(); + aie::vector op2 = aie::zeros(); + aie::vector res = aie::zeros(); + + for (unsigned i = 0; i < POINTS_PER_ITERATION; i++) { + window_readincr_v(in1, op1); + window_readincr_v(in2, op2); + + res = aie::add(op1, op2); + + writeincr(out, res); + } +} diff --git a/ultrasound/L1/include/sum_axis_1/sum_axis_1.cpp b/ultrasound/L1/include/sum_axis_1/sum_axis_1.cpp new file mode 100644 index 0000000000..8257ca282e --- /dev/null +++ b/ultrasound/L1/include/sum_axis_1/sum_axis_1.cpp @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +template +void sum_axis_1(adf::input_buffer& in1, adf::output_buffer& out) { + T* __restrict p_in1 = in1.data(); + auto outIter = aie::begin(out); + + aie::vector op1 = aie::zeros(); + + T op2 = 0; + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + op1 = aie::load_v(p_in1); + p_in1 = byte_incr(p_in1, VECDIM * sizeof(T)); + op2 = aie::reduce_add(op1); + *outIter++ = op2; + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/include/tileV/tileV.cpp b/ultrasound/L1/include/tileV/tileV.cpp new file mode 100644 index 0000000000..e72b4eb44d --- /dev/null +++ b/ultrasound/L1/include/tileV/tileV.cpp @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "kernels.hpp" + +namespace us { +namespace L1 { + +// void tileV(input_stream* in1, output_window* out){ +// +// aie::vector res = aie::vector(); +// +// res = readincr_v(in1); +// +// for(unsigned i = 0; i < LENGTH; ++i){ +// window_writeincr(out, res); +// } +// +// }; + +template +void tileVApo(adf::output_buffer& __restrict out) { + + T* __restrict p_out = out.data(); + aie::vector res = aie::vector(); + + res[0] = 0; + res[1] = 0; + res[2] = 1; + res[3] = 0; + + for (unsigned i = 0; i < LEN; i += INCREMENT) { + aie::store_v(p_out, res); + p_out = byte_incr(p_out, VECDIM * sizeof(T)); + + } +}; + +} // namespace L1 +} // namespace us diff --git a/ultrasound/L1/meta/api.json b/ultrasound/L1/meta/api.json new file mode 100644 index 0000000000..6efb5e47ca --- /dev/null +++ b/ultrasound/L1/meta/api.json @@ -0,0 +1,1802 @@ +{ + "schema": "vitis_libraries_api_list_schema-1.0", + "api_list": [ + { + "api_name": "us::L1::ones", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::ones", + "display_name": "ones", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::outer", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::outer", + "display_name": "outer", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::outerStream", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::outerStream", + "display_name": "outerStream", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sumMM", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sumMM", + "display_name": "sumMM", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::tileVApo", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::tileVApo", + "display_name": "tileVApo", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffMV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffMV", + "display_name": "diffMV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulMM", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulMM", + "display_name": "mulMM", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sum_axis_1", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sum_axis_1", + "display_name": "sum_axis_1", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::absV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::absV", + "display_name": "absV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffVS", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffVS", + "display_name": "diffVS", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sign", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sign", + "display_name": "sign", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVV", + "display_name": "mulVV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::norm_axis_1", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::norm_axis_1", + "display_name": "norm_axis_1", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::divVSSpeedOfSound", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::divVSSpeedOfSound", + "display_name": "divVSSpeedOfSound", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sumVSStream", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sumVSStream", + "display_name": "sumVSStream", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffVSStreamOut", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffVSStreamOut", + "display_name": "diffVSStreamOut", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVSStreamIn", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVSStreamIn", + "display_name": "mulVSStreamIn", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sumVOne", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sumVOne", + "display_name": "sumVOne", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sumVVStreamIn1", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sumVVStreamIn1", + "display_name": "sumVVStreamIn1", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffSV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffSV", + "display_name": "diffSV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::squareV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::squareV", + "display_name": "squareV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sumVV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sumVV", + "display_name": "sumVV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sqrtV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sqrtV", + "display_name": "sqrtV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVSCRSWindow", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVSCRSWindow", + "display_name": "mulVSCRSWindow", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulLinSCRStreamIn", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulLinSCRStreamIn", + "display_name": "mulLinSCRStreamIn", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffOneLin", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffOneLin", + "display_name": "diffOneLin", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffTwoLin", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffTwoLin", + "display_name": "diffTwoLin", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffLinOne", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffLinOne", + "display_name": "diffLinOne", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sumVVStreamOut", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sumVVStreamOut", + "display_name": "sumVVStreamOut", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffLinTwo", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffLinTwo", + "display_name": "diffLinTwo", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVHalfInt", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVHalfInt", + "display_name": "mulVHalfInt", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulLinHalf", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulLinHalf", + "display_name": "mulLinHalf", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVVStream", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVVStream", + "display_name": "mulVVStream", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::dataMover", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::dataMover", + "display_name": "dataMover", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffThreeLin", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffThreeLin", + "display_name": "diffThreeLin", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::equalS", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::equalS", + "display_name": "equalS", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + }, + { + "name": "SCALAR", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::lessOrEqualThanS", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::lessOrEqualThanS", + "display_name": "lessOrEqualThanS", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + }, + { + "name": "SCALAR", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVPi", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVPi", + "display_name": "mulVPi", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulV1e_16", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulV1e_16", + "display_name": "mulV1e_16", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVS", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVS", + "display_name": "mulVS", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVSStream", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVSStream", + "display_name": "mulVSStream", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVSWS", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVSWS", + "display_name": "mulVSWS", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::absVSW", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::absVSW", + "display_name": "absVSW", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::reciprocalV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::reciprocalV", + "display_name": "reciprocalV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::cosV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::cosV", + "display_name": "cosV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffOneV", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffOneV", + "display_name": "diffOneV", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::absVWS", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::absVWS", + "display_name": "absVWS", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned" + }, + { + "name": "INCREMENT", + "type": "const unsigned" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVHalf", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVHalf", + "display_name": "mulVHalf", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::sumVOneSW", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::sumVOneSW", + "display_name": "sumVOneSW", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::mulVVStreamOut", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::mulVVStreamOut", + "display_name": "mulVVStreamOut", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L1::diffOneVWW", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L1::diffOneVWW", + "display_name": "diffOneVWW", + "brief": "", + "target_domain": "", + "header_file_name": [ + "kernels.hpp" + ], + "search_paths": [ + "L1/include" + ], + "instance": "function", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LEN", + "type": "const unsigned int" + }, + { + "name": "INCREMENT", + "type": "const unsigned int" + }, + { + "name": "VECDIM", + "type": "const unsigned" + } + ], + "ports": [] + } + } + ], + "target_domain": "" +} \ No newline at end of file diff --git a/ultrasound/L2/README.md b/ultrasound/L2/README.md new file mode 100644 index 0000000000..28a400abeb --- /dev/null +++ b/ultrasound/L2/README.md @@ -0,0 +1,132 @@ +# Ultrasound Library - Level 2 (L2) + +The level 2 of Vitis Ultrasound Library contains the host-callable kernels. For more details information, please reference to L2 User Guide in the document for usage and design information. + +## Overview of APIs +The L2 APIs are composed of the mathematical components needed for the beamformation of the rf-data. Those components are `AIE graphs` based on L1 kernels. + +### Image Points + +The Image Points graph is used to create a matrix which represents the part of investigation made by the specific emission of the Ultrasound Probe. The rows of this matrix have incremental values which represents our values used to compute delay for the **virtual sources**. It is dependent on the investigation depth and the incremental investigation which we want to perform (based on our sampling frquency). + +- **Graph Inputs**: + - `start_positions`: the position which we start the investigation in cartesian coordinate; + - `directions`: X-Y-Z values of propagation of the spherical or planar wave emitted; + - `samples_arange`: array with the index of the rf-data; +- **Graph Outputs**: + - `Image Points`: A Nx4 matrix which represents our points to analyze; + +### Delay + +This graph is used to compute the transmit delay. It returns an array of values which represent the transmission time for every incremental point of the investigation. *This graph is used in ScanLine and SA applications*. + +- **Graph Inputs**: + - `image_points_from_PL`: the result of Image Points; + - `image_points_from_PL2`: the result of Image Points; + - `tx_def_ref_point`: X-Y-Z array with the reference point of the investigation for that iteration; + - `tx_def_delay_distance`: X-Y-Z array which represent our absolute distance with respect to our focus; + - `tx_def_delay_distance2`: X-Y-Z array which represent our absolute distance with respect to our focus; + - `tx_def_focal_point`: X-Y-Z array which represent our focus; + - `t_start`: The starting time of emission; +- **Graph Outputs**: + - `delay_to_PL`: A vector which represents our time delay per point to analyze; + +### Delay_PW + +This graph is used to compute the transmit delay. It returns an array of values which represent the transmission time for every incremental point of the investigation. *This graph is used in PW application*. + +- **Graph Inputs**: + - `image_points_from_PL`: the result of Image Points; + - `tx_def_ref_point`: X-Y-Z array with the reference point of the investigation for that iteration; + - `t_start`: The starting time of emission; +- **Graph Outputs**: + - `delay_to_PL`: A vector which represents our time delay per point to analyze; + +### Focusing + +This graph is used to compute the distance of our reference apodization point for the dynamic apodization with respect to the transducers position. It returns an array of values which represent the magnitude per transducer. + +- **Graph Inputs**: + - `apo_ref_0`: X component of the vector of apodization reference; + - `xdc_def_0`: X component of the vector which represent the transducer positions; + - `apo_ref_1`: Y component of the vector of apodization reference; + - `xdc_def_1`: Y component of the vector which represent the transducer positions; +- **Graph Outputs**: + - `focusing_output`: A vector which represents apodization distance per transducer; + +### Focusing_SA + +This graph is used to compute the distance of our reference apodization point for the dynamic apodization with respect to the image points. This version is used in SA to create a dynamic apodization also in transmission and not only in reception. + +- **Graph Inputs**: + - `apo_ref_0`: X component of the vector of apodization reference; + - `img_points_0`: X component of the Image Points result; + - `apo_ref_1`: Y component of the vector of apodization reference; + - `img_points_1`: Y component of the Image Points result; +- **Graph Outputs**: + - `focusing_output`: A vector which represents apodization distance in transmission; + +### Samples + +This graph is used to compute the delay in reception for every transducer. It sums also the delay in transmission to obtain the valid samples for the interpolation. + +- **Graph Inputs**: + - `image_points_from_PL_2`: Result of Image Points; + - `delay_from_PL`: Result of Delay; + - `xdc_def_positions`: X-Y-Z vector which represents the positions of our transducers in the probe; + - `sampling_frequency`: The sampling frequency of the probe; +- **Graph Outputs**: + - `samples_to_PL`: A vector which represents our valid entries in the rf-data vector; + +### Apodization + +This graph is used to compute a dynamic Hanning Window for every transducer. So, this graph is used to calculate the apodization for the reception. + +- **Graph Inputs**: + - `image_points`: Result of Image Points; + - `apodization_reference`: X-Y-Z vector which represents the positions of our apodization reference; + - `apo_distance_k`: Result of Focusing; + - `F_number`: The selected F number for the application; +- **Graph Outputs**: + - `apodization`: A vector which represents our Hanning Window for the reference point chosen; + +### Apodization_SA + +This graph is used to compute a dynamic Hanning Window for the transmission. *For this reason this graph is computed every line only in SA* + +- **Graph Inputs**: + - `image_points`: Result of Image Points; + - `apodization_reference_tx`: X-Y-Z vector which represents the positions of our apodization reference (transmission); + - `apo_distance_k_tx`: Result of Focusing_SA; + - `F_number`: The selected F number for the application; +- **Graph Outputs**: + - `apodization`: A vector which represents our Hanning Window for the reference point chosen; + +### bSpline + +This graph is used to compute the chordal version of the Catmull-Rom. It is called *bSpline* as generally we refer to the Catmull-Rom as the centripetal one. + +- **Graph Inputs**: + - `P1`: First point to be interpolated; + - `P2`: Second point to be interpolated; + - `P3`: Second point to be interpolated; + - `P4`: Third point to be interpolated; + - `P5`: Third point to be interpolated; + - `P6`: Fourth point to be interpolated; +- **Graph Outputs**: + - `C`: A vector with the result of the interpolation + +## License +Copyright 2022 AMD, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/ultrasound/L2/include/apodization.hpp b/ultrasound/L2/include/apodization.hpp new file mode 100644 index 0000000000..0184470e54 --- /dev/null +++ b/ultrasound/L2/include/apodization.hpp @@ -0,0 +1,253 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _APODIZATION_HPP_ +#define _APODIZATION_HPP_ + +#include "kernels.hpp" +#include + +namespace us { +namespace L2 { + +template +class apodization_graph : public adf::graph { + public: + // input and output port + adf::port image_points; + adf::port apodization_reference_i; + adf::port apo_distance_k; + adf::port F_number; + adf::port apodization_output; + + apodization_graph(double kernel_ratio = KERNEL_RATIO) { + // kernel + tileVKernel = adf::kernel::create(us::L1::tileVApo); + diffMVKernel = adf::kernel::create(us::L1::diffMV); + mulMMKernel = adf::kernel::create(us::L1::mulMM); + sumAxis1Kernel = adf::kernel::create(us::L1::sum_axis_1); + absVKernel1 = adf::kernel::create(us::L1::absV); + equalZeroKernel = adf::kernel::create(us::L1::equalS); + mulVS1Kernel = adf::kernel::create(us::L1::mulV1e_16); + sumVVKernel = adf::kernel::create(us::L1::sumVV); + reciprocalVKernel = adf::kernel::create(us::L1::reciprocalV); + mulVS2Kernel = adf::kernel::create(us::L1::mulVS); + mulVS2FNumberKernel = adf::kernel::create(us::L1::mulVSWS); + sumVOneKernel = adf::kernel::create(us::L1::sumVOneSW); + mulVS2Pi2Kernel = adf::kernel::create(us::L1::mulVPi); + cosVKernel = adf::kernel::create(us::L1::cosV); + diffOneVKernel = adf::kernel::create(us::L1::diffOneVWW); + mulVHalfKernel = adf::kernel::create(us::L1::mulVHalf); + absVKernel2 = adf::kernel::create(us::L1::absV); + lessThanOneKernel = + adf::kernel::create(us::L1::lessOrEqualThanS); + mulVVKernel = adf::kernel::create(us::L1::mulVV); + + adf::source(tileVKernel) = "tileV/tileV.cpp"; + adf::source(diffMVKernel) = "diffMV/diffMV.cpp"; + adf::source(mulMMKernel) = "mulMM/mulMM.cpp"; + adf::source(sumAxis1Kernel) = "sum_axis_1/sum_axis_1.cpp"; + adf::source(absVKernel1) = "absV/absV.cpp"; + adf::source(equalZeroKernel) = "equalS/equalS.cpp"; + adf::source(mulVS1Kernel) = "mulVS/mulVS.cpp"; + adf::source(sumVVKernel) = "sumVV/sumVV.cpp"; + adf::source(reciprocalVKernel) = "reciprocalV/reciprocalV.cpp"; + adf::source(mulVS2Kernel) = "mulVS/mulVS.cpp"; + adf::source(mulVS2FNumberKernel) = "mulVS/mulVS.cpp"; + adf::source(mulVS2Pi2Kernel) = "mulVS/mulVS.cpp"; + adf::source(cosVKernel) = "cosV/cosV.cpp"; + adf::source(diffOneVKernel) = "diffSV/diffSV.cpp"; + adf::source(mulVHalfKernel) = "mulVS/mulVS.cpp"; + adf::source(absVKernel2) = "absV/absV.cpp"; + adf::source(lessThanOneKernel) = "lessOrEqualThanS/lessOrEqualThanS.cpp"; + adf::source(mulVVKernel) = "mulVV/mulVV.cpp"; + adf::source(sumVOneKernel) = "sumVS/sumVS.cpp"; + + // diffMV + adf::connect<>(image_points, diffMVKernel.in[0]); + adf::connect<>(apodization_reference_i, diffMVKernel.in[1]); + + adf::dimensions(diffMVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(diffMVKernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(diffMVKernel.out[0]) = {DIM_MATRIX_}; + + // tileV & mulMM + adf::connect<>(tileVKernel.out[0], mulMMKernel.in[0]); + adf::connect<>(diffMVKernel.out[0], mulMMKernel.in[1]); + + adf::dimensions(tileVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.out[0]) = {DIM_MATRIX_}; + + // sumAxis1 + adf::connect<>(mulMMKernel.out[0], sumAxis1Kernel.in[0]); + + adf::dimensions(sumAxis1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(sumAxis1Kernel.out[0]) = {DIM_VECTOR_}; + + // absV + adf::connect<>(sumAxis1Kernel.out[0], absVKernel1.in[0]); + + adf::dimensions(absVKernel1.in[0]) = {DIM_VECTOR_}; + adf::dimensions(absVKernel1.out[0]) = {DIM_VECTOR_}; + + // equalZero + adf::connect<>(absVKernel1.out[0], equalZeroKernel.in[0]); + + adf::dimensions(equalZeroKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(equalZeroKernel.out[0]) = {DIM_VECTOR_}; + + // mulVS (1e-16 * apo_depth_zero) + adf::connect<>(equalZeroKernel.out[0], mulVS1Kernel.in[0]); + + adf::dimensions(mulVS1Kernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS1Kernel.out[0]) = {DIM_VECTOR_}; + + // sumVV + adf::connect<>(mulVS1Kernel.out[0], sumVVKernel.in[1]); + adf::connect<>(absVKernel1.out[0], sumVVKernel.in[0]); + + adf::dimensions(sumVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(sumVVKernel.out[0]) = {DIM_VECTOR_}; + + // reciprocalV + adf::connect<>(sumVVKernel.out[0], reciprocalVKernel.in[0]); + + adf::dimensions(reciprocalVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(reciprocalVKernel.out[0]) = {DIM_VECTOR_}; + + // mulVS (apo_distance) + adf::connect<>(reciprocalVKernel.out[0], mulVS2Kernel.in[0]); + adf::connect<>(apo_distance_k, mulVS2Kernel.in[1]); + + adf::dimensions(mulVS2Kernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2Kernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2Kernel.out[0]) = {DIM_VECTOR_}; + + // mulV2FNumber + adf::connect<>(mulVS2Kernel.out[0], mulVS2FNumberKernel.in[0]); + adf::connect<>(F_number, mulVS2FNumberKernel.in[1]); + + adf::dimensions(mulVS2FNumberKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2FNumberKernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(mulVS2FNumberKernel.out[0]) = {DIM_VECTOR_}; + + // sumVOne + adf::connect<>(mulVS2FNumberKernel.out[0], sumVOneKernel.in[0]); + + adf::dimensions(sumVOneKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumVOneKernel.out[0]) = {DIM_VECTOR_}; + + // mulV2Pi2 + adf::connect<>(sumVOneKernel.out[0], mulVS2Pi2Kernel.in[0]); + + adf::dimensions(mulVS2Pi2Kernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2Pi2Kernel.out[0]) = {DIM_VECTOR_}; + + // cosV + adf::connect<>(mulVS2Pi2Kernel.out[0], cosVKernel.in[0]); + + adf::dimensions(cosVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(cosVKernel.out[0]) = {DIM_VECTOR_}; + + // diffOneV + adf::connect<>(cosVKernel.out[0], diffOneVKernel.in[0]); + + adf::dimensions(diffOneVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(diffOneVKernel.out[0]) = {DIM_VECTOR_}; + + // mulVHalf + adf::connect<>(diffOneVKernel.out[0], mulVHalfKernel.in[0]); + + adf::dimensions(mulVHalfKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVHalfKernel.out[0]) = {DIM_VECTOR_}; + + // absVStreamIn + adf::connect<>(mulVS2FNumberKernel.out[0], absVKernel2.in[0]); + + adf::dimensions(absVKernel2.in[0]) = {DIM_VECTOR_}; + adf::dimensions(absVKernel2.out[0]) = {DIM_VECTOR_}; + + // lessThanOne + adf::connect<>(absVKernel2.out[0], lessThanOneKernel.in[0]); + + adf::dimensions(lessThanOneKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(lessThanOneKernel.out[0]) = {DIM_VECTOR_}; + + // mulVV + adf::connect<>(mulVHalfKernel.out[0], mulVVKernel.in[0]); + adf::connect<>(lessThanOneKernel.out[0], mulVVKernel.in[1]); + adf::connect<>(mulVVKernel.out[0], apodization_output); + + adf::dimensions(mulVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.out[0]) = {DIM_VECTOR_}; + + // config + adf::runtime(tileVKernel) = kernel_ratio; + adf::runtime(diffMVKernel) = kernel_ratio; + adf::runtime(mulMMKernel) = kernel_ratio; + adf::runtime(sumAxis1Kernel) = kernel_ratio; + adf::runtime(absVKernel1) = kernel_ratio; + adf::runtime(mulVS1Kernel) = kernel_ratio; + adf::runtime(sumVVKernel) = kernel_ratio; + adf::runtime(reciprocalVKernel) = kernel_ratio; + adf::runtime(mulVS2Kernel) = kernel_ratio; + adf::runtime(mulVS2FNumberKernel) = kernel_ratio; + adf::runtime(sumVOneKernel) = kernel_ratio; + adf::runtime(mulVS2Pi2Kernel) = kernel_ratio; + adf::runtime(cosVKernel) = 1.0; + adf::runtime(diffOneVKernel) = kernel_ratio; + adf::runtime(mulVHalfKernel) = kernel_ratio; + adf::runtime(absVKernel2) = kernel_ratio; + adf::runtime(lessThanOneKernel) = kernel_ratio; + adf::runtime(mulVVKernel) = kernel_ratio; + adf::runtime(equalZeroKernel) = kernel_ratio; + } + + private: + adf::kernel tileVKernel; + adf::kernel diffMVKernel; + adf::kernel mulMMKernel; + adf::kernel sumAxis1Kernel; + adf::kernel absVKernel1; + adf::kernel mulVS1Kernel; + adf::kernel sumVVKernel; + adf::kernel reciprocalVKernel; + adf::kernel equalZeroKernel; + adf::kernel mulVS2Kernel; + adf::kernel mulVS2FNumberKernel; + adf::kernel sumVOneKernel; + adf::kernel mulVS2Pi2Kernel; + adf::kernel cosVKernel; + adf::kernel diffOneVKernel; + adf::kernel mulVHalfKernel; + adf::kernel absVKernel2; + adf::kernel lessThanOneKernel; + adf::kernel mulVVKernel; +}; + +} // namespace L2 +} // namespace us + +#endif diff --git a/ultrasound/L2/include/apodization_sa.hpp b/ultrasound/L2/include/apodization_sa.hpp new file mode 100644 index 0000000000..14e7a68702 --- /dev/null +++ b/ultrasound/L2/include/apodization_sa.hpp @@ -0,0 +1,238 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _APODIZATION_SA_HPP_ +#define _APODIZATION_SA_HPP_ + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class apodization_sa_graph : public adf::graph { + public: + // input and output port + adf::port image_points; + adf::port apodization_reference; + adf::port apo_distance_k; + adf::port F_number; + adf::port apodization_output; + + apodization_sa_graph(double kernel_ratio = KERNEL_RATIO) { + tileVKernel = adf::kernel::create(us::L1::tileVApo); + diffMVKernel = adf::kernel::create(us::L1::diffMV); + mulMMKernel = adf::kernel::create(us::L1::mulMM); + sumAxis1Kernel = adf::kernel::create(us::L1::sum_axis_1); + absVKernel = adf::kernel::create(us::L1::absVWS); + equalZeroKernel = adf::kernel::create(us::L1::equalS); + mulVS1Kernel = adf::kernel::create(us::L1::mulV1e_16); + sumVVStreamInKernel = + adf::kernel::create(us::L1::sumVVStreamIn1); + reciprocalVKernel = adf::kernel::create(us::L1::reciprocalV); + mulVS2Kernel = adf::kernel::create(us::L1::mulVS); + mulVS2FNumberKernel = adf::kernel::create(us::L1::mulVSWS); + sumVOneKernel = adf::kernel::create(us::L1::sumVOneSW); + mulVS2Pi2Kernel = adf::kernel::create(us::L1::mulVPi); + cosVKernel = adf::kernel::create(us::L1::cosV); + diffOneVKernel = adf::kernel::create(us::L1::diffOneVWW); + mulVHalfKernel = adf::kernel::create(us::L1::mulVHalf); + absVStreamInKernel = adf::kernel::create(us::L1::absVSW); + lessThanOneKernel = adf::kernel::create(us::L1::lessOrEqualThanS); + mulVVKernel = adf::kernel::create(us::L1::mulVVStreamOut); + + adf::source(tileVKernel) = "tileV/tileV.cpp"; + adf::source(diffMVKernel) = "diffMV/diffMV.cpp"; + adf::source(mulMMKernel) = "mulMM/mulMM.cpp"; + adf::source(sumAxis1Kernel) = "sum_axis_1/sum_axis_1.cpp"; + adf::source(absVKernel) = "absV/absV.cpp"; + adf::source(equalZeroKernel) = "equalS/equalS.cpp"; + adf::source(mulVS1Kernel) = "mulVS/mulVS.cpp"; + adf::source(sumVVStreamInKernel) = "sumVV/sumVV.cpp"; + adf::source(reciprocalVKernel) = "reciprocalV/reciprocalV.cpp"; + adf::source(mulVS2Kernel) = "mulVS/mulVS.cpp"; + adf::source(mulVS2FNumberKernel) = "mulVS/mulVS.cpp"; + adf::source(mulVS2Pi2Kernel) = "mulVS/mulVS.cpp"; + adf::source(cosVKernel) = "cosV/cosV.cpp"; + adf::source(diffOneVKernel) = "diffSV/diffSV.cpp"; + adf::source(mulVHalfKernel) = "mulVS/mulVS.cpp"; + adf::source(absVStreamInKernel) = "absV/absV.cpp"; + adf::source(lessThanOneKernel) = "lessOrEqualThanS/lessOrEqualThanS.cpp"; + adf::source(mulVVKernel) = "mulVV/mulVV.cpp"; + adf::source(sumVOneKernel) = "sumVS/sumVS.cpp"; + + // diffMV & tileV + adf::connect<>(image_points, diffMVKernel.in[0]); + adf::connect<>(apodization_reference, diffMVKernel.in[1]); + + adf::dimensions(tileVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(diffMVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(diffMVKernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(diffMVKernel.out[0]) = {DIM_MATRIX_}; + + // mulMM + adf::connect<>(tileVKernel.out[0], mulMMKernel.in[0]); + adf::connect<>(diffMVKernel.out[0], mulMMKernel.in[1]); + adf::dimensions(mulMMKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.out[0]) = {DIM_MATRIX_}; + + // sumAxis1 + adf::connect<>(mulMMKernel.out[0], sumAxis1Kernel.in[0]); + adf::dimensions(sumAxis1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(sumAxis1Kernel.out[0]) = {DIM_VECTOR_}; + + // absV + adf::connect<>(sumAxis1Kernel.out[0], absVKernel.in[0]); + adf::dimensions(absVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(absVKernel.out[0]) = {DIM_VECTOR_}; + + // equalZero + adf::connect<>(absVKernel.out[0], equalZeroKernel.in[0]); + adf::dimensions(equalZeroKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(equalZeroKernel.out[0]) = {DIM_VECTOR_}; + + // mulVS (1e-16 * apo_depth_zero) + adf::connect<>(equalZeroKernel.out[0], mulVS1Kernel.in[0]); + adf::dimensions(mulVS1Kernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS1Kernel.out[0]) = {DIM_VECTOR_}; + + // sumVV + adf::connect<>(mulVS1Kernel.out[0], sumVVStreamInKernel.in[1]); + adf::connect<>(absVKernel.out[0], sumVVStreamInKernel.in[0]); + adf::dimensions(sumVVStreamInKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumVVStreamInKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(sumVVStreamInKernel.out[0]) = {DIM_VECTOR_}; + + // reciprocalV + adf::connect<>(sumVVStreamInKernel.out[0], reciprocalVKernel.in[0]); + adf::dimensions(reciprocalVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(reciprocalVKernel.out[0]) = {DIM_VECTOR_}; + + // mulVS (apo_distance) + adf::connect<>(reciprocalVKernel.out[0], mulVS2Kernel.in[0]); + adf::connect<>(apo_distance_k, mulVS2Kernel.in[1]); + adf::dimensions(mulVS2Kernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2Kernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2Kernel.out[0]) = {DIM_VECTOR_}; + + // mulV2FNumber + adf::connect<>(mulVS2Kernel.out[0], mulVS2FNumberKernel.in[0]); + adf::connect<>(F_number, mulVS2FNumberKernel.in[1]); + adf::dimensions(mulVS2FNumberKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2FNumberKernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(mulVS2FNumberKernel.out[0]) = {DIM_VECTOR_}; + + // sumVOne + adf::connect<>(mulVS2FNumberKernel.out[0], sumVOneKernel.in[0]); + adf::dimensions(sumVOneKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumVOneKernel.out[0]) = {DIM_VECTOR_}; + + // mulV2Pi2 + adf::connect<>(sumVOneKernel.out[0], mulVS2Pi2Kernel.in[0]); + adf::dimensions(mulVS2Pi2Kernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVS2Pi2Kernel.out[0]) = {DIM_VECTOR_}; + + // cosV + adf::connect<>(mulVS2Pi2Kernel.out[0], cosVKernel.in[0]); + adf::dimensions(cosVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(cosVKernel.out[0]) = {DIM_VECTOR_}; + + // diffOneV + adf::connect<>(cosVKernel.out[0], diffOneVKernel.in[0]); + adf::dimensions(diffOneVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(diffOneVKernel.out[0]) = {DIM_VECTOR_}; + + // mulVHalf + adf::connect<>(diffOneVKernel.out[0], mulVHalfKernel.in[0]); + adf::dimensions(mulVHalfKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVHalfKernel.out[0]) = {DIM_VECTOR_}; + + // absVStreamIn + adf::connect<>(mulVS2FNumberKernel.out[0], absVStreamInKernel.in[0]); + adf::dimensions(absVStreamInKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(absVStreamInKernel.out[0]) = {DIM_VECTOR_}; + + // lessThanOne + adf::connect<>(absVStreamInKernel.out[0], lessThanOneKernel.in[0]); + + adf::dimensions(lessThanOneKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(lessThanOneKernel.out[0]) = {DIM_VECTOR_}; + + // mulVV + adf::connect<>(mulVHalfKernel.out[0], mulVVKernel.in[0]); + adf::connect<>(lessThanOneKernel.out[0], mulVVKernel.in[1]); + + adf::dimensions(mulVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.out[0]) = {DIM_VECTOR_}; + + // result + adf::connect<>(mulVVKernel.out[0], apodization_output); + + // config + adf::runtime(tileVKernel) = kernel_ratio; + adf::runtime(diffMVKernel) = kernel_ratio; + adf::runtime(mulMMKernel) = kernel_ratio; + adf::runtime(sumAxis1Kernel) = kernel_ratio; + adf::runtime(absVKernel) = kernel_ratio; + adf::runtime(mulVS1Kernel) = kernel_ratio; + adf::runtime(sumVVStreamInKernel) = kernel_ratio; + adf::runtime(reciprocalVKernel) = kernel_ratio; + adf::runtime(mulVS2Kernel) = kernel_ratio; + adf::runtime(mulVS2FNumberKernel) = kernel_ratio; + adf::runtime(sumVOneKernel) = kernel_ratio; + adf::runtime(mulVS2Pi2Kernel) = kernel_ratio; + adf::runtime(cosVKernel) = kernel_ratio; + adf::runtime(diffOneVKernel) = kernel_ratio; + adf::runtime(mulVHalfKernel) = kernel_ratio; + adf::runtime(absVStreamInKernel) = kernel_ratio; + adf::runtime(lessThanOneKernel) = kernel_ratio; + adf::runtime(mulVVKernel) = kernel_ratio; + adf::runtime(equalZeroKernel) = kernel_ratio; + } + + private: + adf::kernel tileVKernel; + adf::kernel diffMVKernel; + adf::kernel mulMMKernel; + adf::kernel sumAxis1Kernel; + adf::kernel absVKernel; + adf::kernel mulVS1Kernel; + adf::kernel sumVVStreamInKernel; + adf::kernel reciprocalVKernel; + adf::kernel equalZeroKernel; + adf::kernel mulVS2Kernel; + adf::kernel mulVS2FNumberKernel; + adf::kernel sumVOneKernel; + adf::kernel mulVS2Pi2Kernel; + adf::kernel cosVKernel; + adf::kernel diffOneVKernel; + adf::kernel mulVHalfKernel; + adf::kernel absVStreamInKernel; + adf::kernel lessThanOneKernel; + adf::kernel mulVVKernel; +}; + +} // namespace L2 +} // namespace us + +#endif \ No newline at end of file diff --git a/ultrasound/L2/include/bSpline.hpp b/ultrasound/L2/include/bSpline.hpp new file mode 100644 index 0000000000..7baf09eac1 --- /dev/null +++ b/ultrasound/L2/include/bSpline.hpp @@ -0,0 +1,382 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _BSPLINE_HPP_ +#define _BSPLINE_HPP_ + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class bSpline_graph : public adf::graph { + public: + // interpolator + adf::port P1; + adf::port P2; + adf::port P3; + adf::port P4; + adf::port P5; + adf::port P6; + adf::port C; + + bSpline_graph(double kernel_ratio = KERNEL_RATIO) { + // kernels + interpolator_A1_diffSVKernel = adf::kernel::create(us::L1::diffOneLin); + interpolator_A1_mulVSCRStreamIn1Kernel = adf::kernel::create(us::L1::mulVSCRSWindow); + interpolator_A1_mulVSCRStreamIn2Kernel = + adf::kernel::create(us::L1::mulLinSCRStreamIn); + interpolator_A1_sumVVKernel = adf::kernel::create(us::L1::sumVV); + + interpolator_A2_diffSVKernel = adf::kernel::create(us::L1::diffTwoLin); + interpolator_A2_mulVSCRStreamIn1Kernel = adf::kernel::create(us::L1::mulVSCRSWindow); + interpolator_A2_mulVSCRStreamIn2Kernel = adf::kernel::create(us::L1::mulVSCRSWindow); + interpolator_A2_diffVSKernel = adf::kernel::create(us::L1::diffLinOne); + interpolator_A2_sumVVKernel = adf::kernel::create(us::L1::sumVV); + + interpolator_A3_diffSVKernel = adf::kernel::create(us::L1::diffThreeLin); + interpolator_A3_mulVSCRStreamIn1Kernel = adf::kernel::create(us::L1::mulVSCRSWindow); + interpolator_A3_mulVSCRStreamIn2Kernel = adf::kernel::create(us::L1::mulVSCRSWindow); + interpolator_A3_diffVSKernel = adf::kernel::create(us::L1::diffLinTwo); + interpolator_A3_sumVVKernel = adf::kernel::create(us::L1::sumVV); + + interpolator_B1_diffSVKernel = adf::kernel::create(us::L1::diffTwoLin); // diffOneLin + interpolator_B1_mulVSCRKernel = adf::kernel::create(us::L1::mulVHalfInt); + interpolator_B1_mulVSCRStreamKernel = adf::kernel::create(us::L1::mulLinHalf); + interpolator_B1_mulVV1Kernel = adf::kernel::create(us::L1::mulVV); + interpolator_B1_mulVV2Kernel = adf::kernel::create(us::L1::mulVV); + interpolator_B1_sumVVKernel = adf::kernel::create(us::L1::sumVV); + + interpolator_B2_diffSVKernel = adf::kernel::create(us::L1::diffThreeLin); + interpolator_B2_mulVSCR1Kernel = adf::kernel::create(us::L1::mulVHalfInt); + interpolator_B2_mulVSCR2Kernel = adf::kernel::create(us::L1::mulVHalfInt); + interpolator_B2_diffVSKernel = adf::kernel::create(us::L1::diffLinOne); + interpolator_B2_mulVV1Kernel = adf::kernel::create(us::L1::mulVV); + interpolator_B2_mulVV2Kernel = adf::kernel::create(us::L1::mulVV); + interpolator_B2_sumVVKernel = adf::kernel::create(us::L1::sumVV); + + interpolator_C_diffSVKernel = adf::kernel::create(us::L1::diffTwoLin); + interpolator_C_mulVV1Kernel = adf::kernel::create(us::L1::mulVV); + interpolator_C_diffVSKernel = adf::kernel::create(us::L1::diffLinOne); + interpolator_C_mulVV2Kernel = adf::kernel::create(us::L1::mulVV); + interpolator_C_sumVVKernel = adf::kernel::create(us::L1::sumVV); + + dataMoverKernel1 = adf::kernel::create(us::L1::dataMover); + dataMoverKernel2 = adf::kernel::create(us::L1::dataMover); + dataMoverKernel3 = adf::kernel::create(us::L1::dataMover); + dataMoverKernel4 = adf::kernel::create(us::L1::dataMover); + dataMoverKernel5 = adf::kernel::create(us::L1::dataMover); + dataMoverKernel6 = adf::kernel::create(us::L1::dataMover); + + adf::source(interpolator_A1_diffSVKernel) = "diffSV/diffSV.cpp"; + adf::source(interpolator_A1_mulVSCRStreamIn1Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_A1_mulVSCRStreamIn2Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_A1_sumVVKernel) = "sumVV/sumVV.cpp"; + + adf::source(interpolator_A2_diffSVKernel) = "diffSV/diffSV.cpp"; + adf::source(interpolator_A2_mulVSCRStreamIn1Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_A2_diffVSKernel) = "diffVS/diffVS.cpp"; + adf::source(interpolator_A2_mulVSCRStreamIn2Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_A2_sumVVKernel) = "sumVV/sumVV.cpp"; + + adf::source(interpolator_A3_diffSVKernel) = "diffSV/diffSV.cpp"; + adf::source(interpolator_A3_mulVSCRStreamIn1Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_A3_diffVSKernel) = "diffVS/diffVS.cpp"; + adf::source(interpolator_A3_mulVSCRStreamIn2Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_A3_sumVVKernel) = "sumVV/sumVV.cpp"; + + adf::source(interpolator_B1_diffSVKernel) = "diffSV/diffSV.cpp"; + adf::source(interpolator_B1_mulVSCRKernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_B1_mulVSCRStreamKernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_B1_mulVV1Kernel) = "mulVV/mulVV.cpp"; + adf::source(interpolator_B1_mulVV2Kernel) = "mulVV/mulVV.cpp"; + adf::source(interpolator_B1_sumVVKernel) = "sumVV/sumVV.cpp"; + + adf::source(interpolator_B2_diffSVKernel) = "diffSV/diffSV.cpp"; + adf::source(interpolator_B2_mulVSCR1Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_B2_mulVSCR2Kernel) = "mulVS/mulVS.cpp"; + adf::source(interpolator_B2_diffVSKernel) = "diffVS/diffVS.cpp"; + adf::source(interpolator_B2_mulVV1Kernel) = "mulVV/mulVV.cpp"; + adf::source(interpolator_B2_mulVV2Kernel) = "mulVV/mulVV.cpp"; + adf::source(interpolator_B2_sumVVKernel) = "sumVV/sumVV.cpp"; + + adf::source(interpolator_C_diffSVKernel) = "diffSV/diffSV.cpp"; + adf::source(interpolator_C_mulVV1Kernel) = "mulVV/mulVV.cpp"; + adf::source(interpolator_C_diffVSKernel) = "diffVS/diffVS.cpp"; + adf::source(interpolator_C_mulVV2Kernel) = "mulVV/mulVV.cpp"; + adf::source(interpolator_C_sumVVKernel) = "sumVV/sumVV.cpp"; + adf::source(dataMoverKernel1) = "dataMover/dataMover.cpp"; + adf::source(dataMoverKernel2) = "dataMover/dataMover.cpp"; + adf::source(dataMoverKernel3) = "dataMover/dataMover.cpp"; + adf::source(dataMoverKernel4) = "dataMover/dataMover.cpp"; + adf::source(dataMoverKernel5) = "dataMover/dataMover.cpp"; + adf::source(dataMoverKernel6) = "dataMover/dataMover.cpp"; + + // dataMover + adf::connect<>(P1, dataMoverKernel1.in[0]); + adf::connect<>(P2, dataMoverKernel2.in[0]); + adf::connect<>(P3, dataMoverKernel3.in[0]); + adf::connect<>(P4, dataMoverKernel4.in[0]); + adf::connect<>(P5, dataMoverKernel5.in[0]); + adf::connect<>(P6, dataMoverKernel6.in[0]); + + adf::dimensions(dataMoverKernel1.in[0]) = {LENGTH_}; + adf::dimensions(dataMoverKernel2.in[0]) = {LENGTH_}; + adf::dimensions(dataMoverKernel3.in[0]) = {LENGTH_}; + adf::dimensions(dataMoverKernel4.in[0]) = {LENGTH_}; + adf::dimensions(dataMoverKernel5.in[0]) = {LENGTH_}; + adf::dimensions(dataMoverKernel6.in[0]) = {LENGTH_}; + adf::dimensions(dataMoverKernel1.out[0]) = {DIM_MATRIX_}; + adf::dimensions(dataMoverKernel2.out[0]) = {DIM_MATRIX_}; + adf::dimensions(dataMoverKernel3.out[0]) = {DIM_MATRIX_}; + adf::dimensions(dataMoverKernel4.out[0]) = {DIM_MATRIX_}; + adf::dimensions(dataMoverKernel5.out[0]) = {DIM_MATRIX_}; + adf::dimensions(dataMoverKernel6.out[0]) = {DIM_MATRIX_}; + + // diffSV + adf::connect<>(interpolator_A1_diffSVKernel.out[0], interpolator_A1_mulVSCRStreamIn1Kernel.in[0]); + adf::connect<>(dataMoverKernel1.out[0], interpolator_A1_mulVSCRStreamIn1Kernel.in[1]); + // A1_mulVSCRStreamIn2 + adf::connect<>(dataMoverKernel2.out[0], interpolator_A1_mulVSCRStreamIn2Kernel.in[0]); + // sumVV + adf::connect<>(interpolator_A1_mulVSCRStreamIn1Kernel.out[0], interpolator_A1_sumVVKernel.in[0]); + adf::connect<>(interpolator_A1_mulVSCRStreamIn2Kernel.out[0], interpolator_A1_sumVVKernel.in[1]); + + // A2 + adf::connect<>(interpolator_A2_diffSVKernel.out[0], interpolator_A2_mulVSCRStreamIn1Kernel.in[0]); + adf::connect<>(dataMoverKernel3.out[0], interpolator_A2_mulVSCRStreamIn1Kernel.in[1]); + // diffVS + adf::connect<>(interpolator_A2_diffVSKernel.out[0], interpolator_A2_mulVSCRStreamIn2Kernel.in[0]); + adf::connect<>(dataMoverKernel4.out[0], interpolator_A2_mulVSCRStreamIn2Kernel.in[1]); + // sumVV + adf::connect<>(interpolator_A2_mulVSCRStreamIn1Kernel.out[0], interpolator_A2_sumVVKernel.in[0]); + adf::connect<>(interpolator_A2_mulVSCRStreamIn2Kernel.out[0], interpolator_A2_sumVVKernel.in[1]); + + // A3 + adf::connect<>(interpolator_A3_diffSVKernel.out[0], interpolator_A3_mulVSCRStreamIn1Kernel.in[0]); + adf::connect<>(dataMoverKernel5.out[0], interpolator_A3_mulVSCRStreamIn1Kernel.in[1]); + // diffVS + adf::connect<>(interpolator_A3_diffVSKernel.out[0], interpolator_A3_mulVSCRStreamIn2Kernel.in[0]); + adf::connect<>(dataMoverKernel6.out[0], interpolator_A3_mulVSCRStreamIn2Kernel.in[1]); + // sumVV + adf::connect<>(interpolator_A3_mulVSCRStreamIn1Kernel.out[0], interpolator_A3_sumVVKernel.in[0]); + adf::connect<>(interpolator_A3_mulVSCRStreamIn2Kernel.out[0], interpolator_A3_sumVVKernel.in[1]); + + // B1 + adf::connect<>(interpolator_B1_diffSVKernel.out[0], interpolator_B1_mulVSCRKernel.in[0]); + adf::connect<>(interpolator_B1_mulVSCRKernel.out[0], interpolator_B1_mulVV1Kernel.in[0]); + adf::connect<>(interpolator_A1_sumVVKernel.out[0], interpolator_B1_mulVV1Kernel.in[1]); + adf::connect<>(interpolator_B1_mulVSCRStreamKernel.out[0], interpolator_B1_mulVV2Kernel.in[0]); + adf::connect<>(interpolator_A2_sumVVKernel.out[0], interpolator_B1_mulVV2Kernel.in[1]); + adf::connect<>(interpolator_B1_mulVV1Kernel.out[0], interpolator_B1_sumVVKernel.in[0]); + adf::connect<>(interpolator_B1_mulVV2Kernel.out[0], interpolator_B1_sumVVKernel.in[1]); + + // B2 + adf::connect<>(interpolator_B2_diffSVKernel.out[0], interpolator_B2_mulVSCR1Kernel.in[0]); + adf::connect<>(interpolator_B2_mulVSCR1Kernel.out[0], interpolator_B2_mulVV1Kernel.in[0]); + adf::connect<>(interpolator_A2_sumVVKernel.out[0], interpolator_B2_mulVV1Kernel.in[1]); + adf::connect<>(interpolator_B2_diffVSKernel.out[0], interpolator_B2_mulVSCR2Kernel.in[0]); + adf::connect<>(interpolator_B2_mulVSCR2Kernel.out[0], interpolator_B2_mulVV2Kernel.in[0]); + adf::connect<>(interpolator_A3_sumVVKernel.out[0], interpolator_B2_mulVV2Kernel.in[1]); + adf::connect<>(interpolator_B2_mulVV1Kernel.out[0], interpolator_B2_sumVVKernel.in[0]); + adf::connect<>(interpolator_B2_mulVV2Kernel.out[0], interpolator_B2_sumVVKernel.in[1]); + + // C + adf::connect<>(interpolator_C_diffSVKernel.out[0], interpolator_C_mulVV1Kernel.in[0]); + adf::connect<>(interpolator_B1_sumVVKernel.out[0], interpolator_C_mulVV1Kernel.in[1]); + adf::connect<>(interpolator_C_diffVSKernel.out[0], interpolator_C_mulVV2Kernel.in[0]); + adf::connect<>(interpolator_B2_sumVVKernel.out[0], interpolator_C_mulVV2Kernel.in[1]); + adf::connect<>(interpolator_C_mulVV1Kernel.out[0], interpolator_C_sumVVKernel.in[0]); + adf::connect<>(interpolator_C_mulVV2Kernel.out[0], interpolator_C_sumVVKernel.in[1]); + + // RESULTS + adf::connect<>(interpolator_C_sumVVKernel.out[0], C); + + adf::dimensions(interpolator_A1_diffSVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_mulVSCRStreamIn1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_mulVSCRStreamIn1Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_mulVSCRStreamIn1Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_mulVSCRStreamIn2Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_mulVSCRStreamIn2Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_sumVVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_sumVVKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A1_sumVVKernel.out[0]) = {DIM_MATRIX_}; + + adf::dimensions(interpolator_A2_diffSVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_diffVSKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_mulVSCRStreamIn1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_mulVSCRStreamIn1Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_mulVSCRStreamIn1Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_mulVSCRStreamIn2Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_mulVSCRStreamIn2Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_mulVSCRStreamIn2Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_sumVVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_sumVVKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A2_sumVVKernel.out[0]) = {DIM_MATRIX_}; + + adf::dimensions(interpolator_A3_diffSVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_diffVSKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_mulVSCRStreamIn1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_mulVSCRStreamIn1Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_mulVSCRStreamIn1Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_mulVSCRStreamIn2Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_mulVSCRStreamIn2Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_mulVSCRStreamIn2Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_sumVVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_sumVVKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_A3_sumVVKernel.out[0]) = {DIM_MATRIX_}; + + adf::dimensions(interpolator_B1_diffSVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVSCRKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVSCRKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVSCRStreamKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVV1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVV1Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVV1Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVV2Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVV2Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_mulVV2Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_sumVVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_sumVVKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B1_sumVVKernel.out[0]) = {DIM_MATRIX_}; + + adf::dimensions(interpolator_B2_diffSVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVSCR1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVSCR1Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVSCR2Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVSCR2Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_diffVSKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVV1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVV1Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVV1Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVV2Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVV2Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_mulVV2Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_sumVVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_sumVVKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_B2_sumVVKernel.out[0]) = {DIM_MATRIX_}; + + adf::dimensions(interpolator_C_diffSVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_mulVV1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_mulVV1Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_mulVV1Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_diffVSKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_mulVV2Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_mulVV2Kernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_mulVV2Kernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_sumVVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_sumVVKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(interpolator_C_sumVVKernel.out[0]) = {DIM_MATRIX_}; + + // interpolator + adf::runtime(interpolator_A1_diffSVKernel) = kernel_ratio; + adf::runtime(interpolator_A1_mulVSCRStreamIn1Kernel) = kernel_ratio; + adf::runtime(interpolator_A1_mulVSCRStreamIn2Kernel) = kernel_ratio; + adf::runtime(interpolator_A1_sumVVKernel) = kernel_ratio; + + adf::runtime(interpolator_A2_diffSVKernel) = kernel_ratio; + adf::runtime(interpolator_A2_mulVSCRStreamIn1Kernel) = kernel_ratio; + adf::runtime(interpolator_A2_diffVSKernel) = kernel_ratio; + adf::runtime(interpolator_A2_mulVSCRStreamIn2Kernel) = kernel_ratio; + adf::runtime(interpolator_A2_sumVVKernel) = kernel_ratio; + + adf::runtime(interpolator_A3_diffSVKernel) = kernel_ratio; + adf::runtime(interpolator_A3_mulVSCRStreamIn1Kernel) = kernel_ratio; + adf::runtime(interpolator_A3_diffVSKernel) = kernel_ratio; + adf::runtime(interpolator_A3_mulVSCRStreamIn2Kernel) = kernel_ratio; + adf::runtime(interpolator_A3_sumVVKernel) = kernel_ratio; + + adf::runtime(interpolator_B1_diffSVKernel) = kernel_ratio; + adf::runtime(interpolator_B1_mulVSCRKernel) = kernel_ratio; + adf::runtime(interpolator_B1_mulVSCRStreamKernel) = kernel_ratio; + adf::runtime(interpolator_B1_mulVV1Kernel) = kernel_ratio; + adf::runtime(interpolator_B1_mulVV2Kernel) = kernel_ratio; + adf::runtime(interpolator_B1_sumVVKernel) = kernel_ratio; + + adf::runtime(interpolator_B2_diffSVKernel) = kernel_ratio; + adf::runtime(interpolator_B2_mulVSCR1Kernel) = kernel_ratio; + adf::runtime(interpolator_B2_mulVSCR2Kernel) = kernel_ratio; + adf::runtime(interpolator_B2_diffVSKernel) = kernel_ratio; + adf::runtime(interpolator_B2_mulVV1Kernel) = kernel_ratio; + adf::runtime(interpolator_B2_mulVV2Kernel) = kernel_ratio; + adf::runtime(interpolator_B2_sumVVKernel) = kernel_ratio; + + adf::runtime(interpolator_C_diffSVKernel) = kernel_ratio; + adf::runtime(interpolator_C_mulVV1Kernel) = kernel_ratio; + adf::runtime(interpolator_C_diffVSKernel) = kernel_ratio; + adf::runtime(interpolator_C_mulVV2Kernel) = kernel_ratio; + adf::runtime(interpolator_C_sumVVKernel) = kernel_ratio; + adf::runtime(dataMoverKernel1) = kernel_ratio; + adf::runtime(dataMoverKernel2) = kernel_ratio; + adf::runtime(dataMoverKernel3) = kernel_ratio; + adf::runtime(dataMoverKernel4) = kernel_ratio; + adf::runtime(dataMoverKernel5) = kernel_ratio; + adf::runtime(dataMoverKernel6) = kernel_ratio; + } + + private: + adf::kernel interpolator_A1_diffSVKernel; + adf::kernel interpolator_A1_mulVSCRStreamIn1Kernel; + adf::kernel interpolator_A1_mulVSCRStreamIn2Kernel; + adf::kernel interpolator_A1_sumVVKernel; + + adf::kernel interpolator_A2_diffSVKernel; + adf::kernel interpolator_A2_diffVSKernel; + adf::kernel interpolator_A2_mulVSCRStreamIn1Kernel; + adf::kernel interpolator_A2_mulVSCRStreamIn2Kernel; + adf::kernel interpolator_A2_sumVVKernel; + + adf::kernel interpolator_A3_diffSVKernel; + adf::kernel interpolator_A3_diffVSKernel; + adf::kernel interpolator_A3_mulVSCRStreamIn1Kernel; + adf::kernel interpolator_A3_mulVSCRStreamIn2Kernel; + adf::kernel interpolator_A3_sumVVKernel; + + adf::kernel interpolator_B1_diffSVKernel; + adf::kernel interpolator_B1_mulVSCRKernel; + adf::kernel interpolator_B1_mulVSCRStreamKernel; + adf::kernel interpolator_B1_mulVV1Kernel; + adf::kernel interpolator_B1_mulVV2Kernel; + adf::kernel interpolator_B1_sumVVKernel; + + adf::kernel interpolator_B2_diffSVKernel; + adf::kernel interpolator_B2_mulVSCR1Kernel; + adf::kernel interpolator_B2_mulVSCR2Kernel; + adf::kernel interpolator_B2_diffVSKernel; + adf::kernel interpolator_B2_mulVV1Kernel; + adf::kernel interpolator_B2_mulVV2Kernel; + adf::kernel interpolator_B2_sumVVKernel; + + adf::kernel interpolator_C_diffSVKernel; + adf::kernel interpolator_C_mulVV1Kernel; + adf::kernel interpolator_C_diffVSKernel; + adf::kernel interpolator_C_mulVV2Kernel; + adf::kernel interpolator_C_sumVVKernel; + + adf::kernel dataMoverKernel1; + adf::kernel dataMoverKernel2; + adf::kernel dataMoverKernel3; + adf::kernel dataMoverKernel4; + adf::kernel dataMoverKernel5; + adf::kernel dataMoverKernel6; +}; + +} // namespace L2 +} // namespace us + +#endif diff --git a/ultrasound/L2/include/delay.hpp b/ultrasound/L2/include/delay.hpp new file mode 100644 index 0000000000..480d6bcb5f --- /dev/null +++ b/ultrasound/L2/include/delay.hpp @@ -0,0 +1,199 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _DELAY_HPP_ +#define _DELAY_HPP_ + +#include "kernels.hpp" +#include + +namespace us { +namespace L2 { + +template +class delay_graph : public adf::graph { + public: + // DELAY + adf::port image_points_from_PL; + adf::port image_points_from_PL_; + adf::port tx_def_ref_point; + adf::port tx_def_delay_distance; + adf::port tx_def_delay_distance2; + adf::port tx_def_focal_point; + adf::port t_start; + adf::port delay_to_PL; + + delay_graph(double kernel_ratio = KERNEL_RATIO) { + // kernel + tileVKernel = adf::kernel::create(us::L1::tileVApo); + diffMVKernel1 = adf::kernel::create(us::L1::diffMV); + mulMMKernel = adf::kernel::create(us::L1::mulMM); + sumAxis1Kernel = adf::kernel::create(us::L1::sum_axis_1); + absVKernel = adf::kernel::create(us::L1::absV); + diffVSKernel = adf::kernel::create(us::L1::diffVS); + signKernel = adf::kernel::create(us::L1::sign); + diffMVKernel2 = adf::kernel::create(us::L1::diffMV); + normAxis1Kernel = adf::kernel::create(us::L1::norm_axis_1); + mulVVKernel = adf::kernel::create(us::L1::mulVV); + divVSKernel = adf::kernel::create(us::L1::divVSSpeedOfSound); + sumVSKernel = adf::kernel::create(us::L1::sumVSStream); + diffVSKernel2 = adf::kernel::create(us::L1::diffVSStreamOut); + + adf::source(tileVKernel) = "tileV/tileV.cpp"; + adf::source(diffMVKernel1) = "diffMV/diffMV.cpp"; + adf::source(mulMMKernel) = "mulMM/mulMM.cpp"; + adf::source(sumAxis1Kernel) = "sum_axis_1/sum_axis_1.cpp"; + adf::source(absVKernel) = "absV/absV.cpp"; + adf::source(diffVSKernel) = "diffVS/diffVS.cpp"; + adf::source(signKernel) = "sign/sign.cpp"; + adf::source(diffMVKernel2) = "diffMV/diffMV.cpp"; + adf::source(normAxis1Kernel) = "norm_axis_1/norm_axis_1.cpp"; + adf::source(mulVVKernel) = "mulVV/mulVV.cpp"; + adf::source(divVSKernel) = "divVS/divVS.cpp"; + adf::source(sumVSKernel) = "sumVS/sumVS.cpp"; + adf::source(diffVSKernel2) = "diffVS/diffVS.cpp"; + + // diffMVKernel1 + adf::connect<>(image_points_from_PL, diffMVKernel1.in[0]); + adf::connect<>(tx_def_ref_point, diffMVKernel1.in[1]); + + adf::dimensions(tileVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(diffMVKernel1.in[0]) = {DIM_MATRIX_}; + adf::dimensions(diffMVKernel1.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(diffMVKernel1.out[0]) = {DIM_MATRIX_}; + + // mulMM + adf::connect<>(tileVKernel.out[0], mulMMKernel.in[0]); + adf::connect<>(diffMVKernel1.out[0], mulMMKernel.in[1]); + + adf::dimensions(mulMMKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.out[0]) = {DIM_MATRIX_}; + + // sum_axis_1 + adf::connect<>(mulMMKernel.out[0], sumAxis1Kernel.in[0]); + + adf::dimensions(sumAxis1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(sumAxis1Kernel.out[0]) = {DIM_VECTOR_}; + + // absV + adf::connect<>(sumAxis1Kernel.out[0], absVKernel.in[0]); + + adf::dimensions(absVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(absVKernel.out[0]) = {DIM_VECTOR_}; + + // diffVS + adf::connect<>(absVKernel.out[0], diffVSKernel.in[0]); + adf::connect<>(tx_def_delay_distance, diffVSKernel.in[1]); + + adf::dimensions(diffVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(diffVSKernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(diffVSKernel.out[0]) = {DIM_VECTOR_}; + + // sign + adf::connect<>(diffVSKernel.out[0], signKernel.in[0]); + + adf::dimensions(signKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(signKernel.out[0]) = {DIM_VECTOR_}; + + // diffMV2 + adf::connect<>(image_points_from_PL_, diffMVKernel2.in[0]); + adf::connect<>(tx_def_focal_point, diffMVKernel2.in[1]); + + adf::dimensions(diffMVKernel2.in[0]) = {DIM_MATRIX_}; + adf::dimensions(diffMVKernel2.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(diffMVKernel2.out[0]) = {DIM_MATRIX_}; + + // normAxis1 + adf::connect<>(diffMVKernel2.out[0], normAxis1Kernel.in[0]); + + adf::dimensions(normAxis1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(normAxis1Kernel.out[0]) = {DIM_VECTOR_}; + + // mulVV + adf::connect<>(signKernel.out[0], mulVVKernel.in[0]); + adf::connect<>(normAxis1Kernel.out[0], mulVVKernel.in[1]); + + adf::dimensions(mulVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.out[0]) = {DIM_VECTOR_}; + + // sumVS + adf::connect<>(mulVVKernel.out[0], sumVSKernel.in[0]); + adf::connect<>(tx_def_delay_distance2, sumVSKernel.in[1]); + + adf::dimensions(sumVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumVSKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(sumVSKernel.out[0]) = {DIM_VECTOR_}; + + // divVS + adf::connect<>(sumVSKernel.out[0], divVSKernel.in[0]); + + adf::dimensions(divVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(divVSKernel.out[0]) = {DIM_VECTOR_}; + + // diffVS2 + adf::connect<>(divVSKernel.out[0], diffVSKernel2.in[0]); + adf::connect<>(t_start, diffVSKernel2.in[1]); + + adf::dimensions(diffVSKernel2.in[0]) = {DIM_VECTOR_}; + adf::dimensions(diffVSKernel2.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(diffVSKernel2.out[0]) = {DIM_VECTOR_}; + + // result + adf::connect<>(diffVSKernel2.out[0], delay_to_PL); + + // runtime ratio setting + adf::runtime(tileVKernel) = kernel_ratio; + adf::runtime(diffMVKernel1) = kernel_ratio; + adf::runtime(mulMMKernel) = kernel_ratio; + adf::runtime(sumAxis1Kernel) = kernel_ratio; + adf::runtime(absVKernel) = kernel_ratio; + adf::runtime(diffVSKernel) = kernel_ratio; + adf::runtime(signKernel) = kernel_ratio; + adf::runtime(diffMVKernel2) = kernel_ratio; + adf::runtime(normAxis1Kernel) = kernel_ratio; + adf::runtime(mulVVKernel) = kernel_ratio; + adf::runtime(divVSKernel) = kernel_ratio; + adf::runtime(sumVSKernel) = kernel_ratio; + adf::runtime(diffVSKernel2) = kernel_ratio; + } + + private: + // DELAY + adf::kernel tileVKernel; + adf::kernel diffMVKernel1; + adf::kernel mulMMKernel; + adf::kernel sumAxis1Kernel; + adf::kernel absVKernel; + adf::kernel diffVSKernel; + adf::kernel signKernel; + adf::kernel diffMVKernel2; + adf::kernel normAxis1Kernel; + adf::kernel mulVVKernel; + adf::kernel divVSKernel; + adf::kernel sumVSKernel; + adf::kernel diffVSKernel2; +}; +} // namespace L2 +} // namespace us + +#endif diff --git a/ultrasound/L2/include/delay_pw.hpp b/ultrasound/L2/include/delay_pw.hpp new file mode 100644 index 0000000000..c91c4a50c9 --- /dev/null +++ b/ultrasound/L2/include/delay_pw.hpp @@ -0,0 +1,116 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _DELAY_PW_HPP_ +#define _DELAY_PW_HPP_ + +#include "kernels.hpp" +#include + +namespace us { +namespace L2 { + +template +class delay_pw_graph : public adf::graph { + public: + // input and output ports + adf::port image_points_from_PL; + adf::port tx_def_reference_point; + adf::port t_start; + adf::port delay_to_PL; + + delay_pw_graph(double kernel_ratio = KERNEL_RATIO) { + // kernel + tileVKernel = adf::kernel::create(us::L1::tileVApo); + diffMVKernel1 = adf::kernel::create(us::L1::diffMV); + mulMMKernel = adf::kernel::create(us::L1::mulMM); + sumAxis1Kernel = adf::kernel::create(us::L1::sum_axis_1); + divVSKernel = adf::kernel::create(us::L1::divVSSpeedOfSound); + diffVSKernel2 = adf::kernel::create(us::L1::diffVSStreamOut); + + adf::source(tileVKernel) = "tileV/tileV.cpp"; + adf::source(diffMVKernel1) = "diffMV/diffMV.cpp"; + adf::source(mulMMKernel) = "mulMM/mulMM.cpp"; + adf::source(sumAxis1Kernel) = "sum_axis_1/sum_axis_1.cpp"; + adf::source(divVSKernel) = "divVS/divVS.cpp"; + adf::source(diffVSKernel2) = "diffVS/diffVS.cpp"; + + // diffMV1 + adf::connect<>(image_points_from_PL, diffMVKernel1.in[0]); + adf::connect<>(tx_def_reference_point, diffMVKernel1.in[1]); + + adf::dimensions(diffMVKernel1.in[0]) = {DIM_MATRIX_}; + adf::dimensions(diffMVKernel1.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(diffMVKernel1.out[0]) = {DIM_MATRIX_}; + + // tileV & mulMM + adf::connect<>(tileVKernel.out[0], mulMMKernel.in[0]); + adf::connect<>(diffMVKernel1.out[0], mulMMKernel.in[1]); + + adf::dimensions(tileVKernel.out[0]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.in[1]) = {DIM_MATRIX_}; + adf::dimensions(mulMMKernel.out[0]) = {DIM_MATRIX_}; + + // sum_axis_1 + adf::connect<>(mulMMKernel.out[0], sumAxis1Kernel.in[0]); + + adf::dimensions(sumAxis1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(sumAxis1Kernel.out[0]) = {DIM_VECTOR_}; + + // divVS + adf::connect<>(sumAxis1Kernel.out[0], divVSKernel.in[0]); + + adf::dimensions(divVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(divVSKernel.out[0]) = {DIM_VECTOR_}; + + // diffVS2 + adf::connect<>(divVSKernel.out[0], diffVSKernel2.in[0]); + adf::connect<>(t_start, diffVSKernel2.in[1]); + adf::connect<>(diffVSKernel2.out[0], delay_to_PL); + + adf::dimensions(diffVSKernel2.in[0]) = {DIM_VECTOR_}; + adf::dimensions(diffVSKernel2.in[1]) = {DIM_VECTOR_}; + adf::dimensions(diffVSKernel2.out[0]) = {DIM_VECTOR_}; + + // config + adf::runtime(tileVKernel) = kernel_ratio; + adf::runtime(diffMVKernel1) = kernel_ratio; + adf::runtime(mulMMKernel) = kernel_ratio; + adf::runtime(sumAxis1Kernel) = kernel_ratio; + adf::runtime(divVSKernel) = kernel_ratio; + adf::runtime(diffVSKernel2) = kernel_ratio; + } + + private: + // DELAY + adf::kernel tileVKernel; + adf::kernel diffMVKernel1; + adf::kernel mulMMKernel; + adf::kernel sumAxis1Kernel; + adf::kernel divVSKernel; + adf::kernel diffVSKernel2; +}; + +} // namespace L2 +} // namespace us + +#endif diff --git a/ultrasound/L2/include/focusing.hpp b/ultrasound/L2/include/focusing.hpp new file mode 100644 index 0000000000..aa6ec03d41 --- /dev/null +++ b/ultrasound/L2/include/focusing.hpp @@ -0,0 +1,119 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _FOCUSING_HPP_ +#define _FOCUSING_HPP_ + +#include "kernels.hpp" +#include + +namespace us { +namespace L2 { + +template +class focusing_graph : public adf::graph { + public: + // input and output port + adf::port apo_ref_0; + adf::port xdc_def_0; + adf::port apo_ref_1; + adf::port xdc_def_1; + adf::port focusing_output; + + focusing_graph(double kernel_ratio = KERNEL_RATIO) { + // kernel + focusing_diffSVKernel1 = adf::kernel::create(us::L1::diffSV); + focusing_diffSVKernel2 = adf::kernel::create(us::L1::diffSV); + focusing_squareVKernel1 = adf::kernel::create(us::L1::squareV); + focusing_squareVKernel2 = adf::kernel::create(us::L1::squareV); + focusing_sumVVKernel = adf::kernel::create(us::L1::sumVV); + focusing_sqrtVKernel = adf::kernel::create(us::L1::sqrtV); + + adf::source(focusing_diffSVKernel1) = "diffSV/diffSV.cpp"; + adf::source(focusing_diffSVKernel2) = "diffSV/diffSV.cpp"; + adf::source(focusing_squareVKernel1) = "squareV/squareV.cpp"; + adf::source(focusing_squareVKernel2) = "squareV/squareV.cpp"; + adf::source(focusing_sumVVKernel) = "sumVV/sumVV.cpp"; + adf::source(focusing_sqrtVKernel) = "sqrtV/sqrtV.cpp"; + + // diffSV1 + adf::connect<>(apo_ref_0, focusing_diffSVKernel1.in[0]); + adf::connect<>(xdc_def_0, focusing_diffSVKernel1.in[1]); + + adf::dimensions(focusing_diffSVKernel1.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel1.in[1]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel1.out[0]) = {DIM_VECTOR_}; + + // diffSV2 + adf::connect<>(apo_ref_1, focusing_diffSVKernel2.in[0]); + adf::connect<>(xdc_def_1, focusing_diffSVKernel2.in[1]); + + adf::dimensions(focusing_diffSVKernel2.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel2.in[1]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel2.out[0]) = {DIM_VECTOR_}; + + // squareV1 + adf::connect<>(focusing_diffSVKernel1.out[0], focusing_squareVKernel1.in[0]); + + adf::dimensions(focusing_squareVKernel1.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_squareVKernel1.out[0]) = {DIM_VECTOR_}; + + // squareV2 + adf::connect<>(focusing_diffSVKernel2.out[0], focusing_squareVKernel2.in[0]); + + adf::dimensions(focusing_squareVKernel2.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_squareVKernel2.out[0]) = {DIM_VECTOR_}; + + // sumVV + adf::connect<>(focusing_squareVKernel1.out[0], focusing_sumVVKernel.in[0]); + adf::connect<>(focusing_squareVKernel2.out[0], focusing_sumVVKernel.in[1]); + + adf::dimensions(focusing_sumVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sumVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sumVVKernel.out[0]) = {DIM_VECTOR_}; + + // sqrtV + adf::connect<>(focusing_sumVVKernel.out[0], focusing_sqrtVKernel.in[0]); + adf::connect<>(focusing_sqrtVKernel.out[0], focusing_output); + + adf::dimensions(focusing_sqrtVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sqrtVKernel.out[0]) = {DIM_VECTOR_}; + + // depth + // runtime ratio + adf::runtime(focusing_diffSVKernel1) = kernel_ratio; + adf::runtime(focusing_diffSVKernel2) = kernel_ratio; + adf::runtime(focusing_squareVKernel1) = kernel_ratio; + adf::runtime(focusing_squareVKernel2) = kernel_ratio; + adf::runtime(focusing_sumVVKernel) = kernel_ratio; + adf::runtime(focusing_sqrtVKernel) = kernel_ratio; + } + + private: + adf::kernel focusing_diffSVKernel1; + adf::kernel focusing_diffSVKernel2; + adf::kernel focusing_squareVKernel1; + adf::kernel focusing_squareVKernel2; + adf::kernel focusing_sumVVKernel; + adf::kernel focusing_sqrtVKernel; +}; + +} // namespace L2 +} // namespace us + +#endif diff --git a/ultrasound/L2/include/focusing_sa.hpp b/ultrasound/L2/include/focusing_sa.hpp new file mode 100644 index 0000000000..45b5cb5ef8 --- /dev/null +++ b/ultrasound/L2/include/focusing_sa.hpp @@ -0,0 +1,103 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _FOCUSING_SA_HPP_ +#define _FOCUSING_SA_HPP_ + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class focusing_sa_graph : public adf::graph { + public: + // input and output port + adf::port apo_ref_0; + adf::port img_points_0; + adf::port apo_ref_1; + adf::port img_points_1; + adf::port focusing_output; + + focusing_sa_graph(double kernel_ratio = KERNEL_RATIO) { + // kernel + focusing_diffSVKernel1 = adf::kernel::create(us::L1::diffSV); + focusing_diffSVKernel2 = adf::kernel::create(us::L1::diffSV); + focusing_squareVKernel1 = adf::kernel::create(us::L1::squareV); + focusing_squareVKernel2 = adf::kernel::create(us::L1::squareV); + focusing_sumVVKernel = adf::kernel::create(us::L1::sumVV); + focusing_sqrtVKernel = adf::kernel::create(us::L1::sqrtV); + + adf::source(focusing_diffSVKernel1) = "diffSV/diffSV.cpp"; + adf::source(focusing_diffSVKernel2) = "diffSV/diffSV.cpp"; + adf::source(focusing_squareVKernel1) = "squareV/squareV.cpp"; + adf::source(focusing_squareVKernel2) = "squareV/squareV.cpp"; + adf::source(focusing_sumVVKernel) = "sumVV/sumVV.cpp"; + adf::source(focusing_sqrtVKernel) = "sqrtV/sqrtV.cpp"; + + // connections + adf::connect<>(apo_ref_0, focusing_diffSVKernel1.in[0]); + adf::connect<>(img_points_0, focusing_diffSVKernel1.in[1]); + adf::connect<>(apo_ref_1, focusing_diffSVKernel2.in[0]); + adf::connect<>(img_points_1, focusing_diffSVKernel2.in[1]); + adf::connect<>(focusing_sqrtVKernel.out[0], focusing_output); + + adf::connect<>(focusing_diffSVKernel1.out[0], focusing_squareVKernel1.in[0]); + adf::connect<>(focusing_diffSVKernel2.out[0], focusing_squareVKernel2.in[0]); + adf::connect<>(focusing_squareVKernel1.out[0], focusing_sumVVKernel.in[0]); + adf::connect<>(focusing_squareVKernel2.out[0], focusing_sumVVKernel.in[1]); + adf::connect<>(focusing_sumVVKernel.out[0], focusing_sqrtVKernel.in[0]); + + adf::dimensions(focusing_diffSVKernel1.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel1.in[1]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel1.out[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel2.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel2.in[1]) = {DIM_VECTOR_}; + adf::dimensions(focusing_diffSVKernel2.out[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_squareVKernel1.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_squareVKernel1.out[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_squareVKernel2.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_squareVKernel2.out[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sumVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sumVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sumVVKernel.out[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sqrtVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(focusing_sqrtVKernel.out[0]) = {DIM_VECTOR_}; + + // runtime ratio + adf::runtime(focusing_diffSVKernel1) = kernel_ratio; + adf::runtime(focusing_diffSVKernel2) = kernel_ratio; + adf::runtime(focusing_squareVKernel1) = kernel_ratio; + adf::runtime(focusing_squareVKernel2) = kernel_ratio; + adf::runtime(focusing_sumVVKernel) = kernel_ratio; + adf::runtime(focusing_sqrtVKernel) = kernel_ratio; + } + + private: + adf::kernel focusing_diffSVKernel1; + adf::kernel focusing_diffSVKernel2; + adf::kernel focusing_squareVKernel1; + adf::kernel focusing_squareVKernel2; + adf::kernel focusing_sumVVKernel; + adf::kernel focusing_sqrtVKernel; +}; + +} // namespace L2 +} // namespace us + +#endif \ No newline at end of file diff --git a/ultrasound/L2/include/imagePoints.hpp b/ultrasound/L2/include/imagePoints.hpp new file mode 100644 index 0000000000..da6093bc4c --- /dev/null +++ b/ultrasound/L2/include/imagePoints.hpp @@ -0,0 +1,91 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _IMAGE_POINTS_HPP_ +#define _IMAGE_POINTS_HPP_ + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class imagePoints_graph : public adf::graph { + public: + // input and output port + adf::port start_positions; + adf::port directions; + adf::port samples_arange; + adf::port image_points; + + imagePoints_graph(double kernel_ratio = KERNEL_RATIO) { + // kernel definition + onesKernel = adf::kernel::create(L1::ones); + outer1Kernel = adf::kernel::create(L1::outer); + outer2Kernel = adf::kernel::create(L1::outer); + sumMMKernel = adf::kernel::create(L1::sumMM); + + adf::source(onesKernel) = "ones/ones.cpp"; + adf::source(outer1Kernel) = "outer/outer.cpp"; + adf::source(outer2Kernel) = "outer/outer.cpp"; + adf::source(sumMMKernel) = "sumMM/sumMM.cpp"; + + // outer1 + adf::connect<>(onesKernel.out[0], outer1Kernel.in[0]); + adf::connect<>(start_positions, outer1Kernel.in[1]); + + adf::dimensions(onesKernel.out[0]) = {LENGTH_}; + adf::dimensions(outer1Kernel.in[0]) = {LENGTH_}; + adf::dimensions(outer1Kernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(outer1Kernel.out[0]) = {LENGTH_ * SPACE_DIMENSION_}; + + // outer2 + adf::connect<>(samples_arange, outer2Kernel.in[0]); + adf::connect<>(directions, outer2Kernel.in[1]); + + adf::dimensions(outer2Kernel.in[0]) = {LENGTH_}; + adf::dimensions(outer2Kernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(outer2Kernel.out[0]) = {LENGTH_ * SPACE_DIMENSION_}; + + // sumMM + adf::connect<>(outer1Kernel.out[0], sumMMKernel.in[0]); + adf::connect<>(outer2Kernel.out[0], sumMMKernel.in[1]); + adf::connect<>(sumMMKernel.out[0], image_points); + + adf::dimensions(sumMMKernel.in[0]) = {LENGTH_ * SPACE_DIMENSION_}; + adf::dimensions(sumMMKernel.in[1]) = {LENGTH_ * SPACE_DIMENSION_}; + adf::dimensions(sumMMKernel.out[0]) = {LENGTH_ * SPACE_DIMENSION_}; + + // config + adf::runtime(onesKernel) = kernel_ratio; + adf::runtime(outer1Kernel) = kernel_ratio; + adf::runtime(outer2Kernel) = kernel_ratio; + adf::runtime(sumMMKernel) = kernel_ratio; + } + + private: + adf::kernel onesKernel; + adf::kernel outer1Kernel; + adf::kernel outer2Kernel; + adf::kernel sumMMKernel; +}; + +} // namespace L2 +} // namespace us + +#endif \ No newline at end of file diff --git a/ultrasound/L2/include/samples.hpp b/ultrasound/L2/include/samples.hpp new file mode 100644 index 0000000000..b04153822d --- /dev/null +++ b/ultrasound/L2/include/samples.hpp @@ -0,0 +1,123 @@ +/* + * Copyright 2022 Xilinx, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _SAMPLES_HPP_ +#define _SAMPLES_HPP_ + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class samples_graph : public adf::graph { + public: + // input and output port + adf::port image_points_from_PL; + adf::port delay_from_PL; + adf::port xdc_def_positions; + adf::port sampling_frequency; + adf::port samples_to_PL; + + samples_graph(double kernel_ratio = KERNEL_RATIO) { + // kernels + samples_diffMVKernel = adf::kernel::create(us::L1::diffMV); + samples_divVSKernel = + adf::kernel::create(us::L1::divVSSpeedOfSound); + samples_mulVSKernel = + adf::kernel::create(us::L1::mulVS); // sampling frequency + samples_normAxis1Kernel = adf::kernel::create(us::L1::norm_axis_1); + samples_sumVSKernel = adf::kernel::create(us::L1::sumVOne); + samples_sumVVKernel = adf::kernel::create(us::L1::sumVVStreamIn1); + + // source kernel + adf::source(samples_diffMVKernel) = "diffMV/diffMV.cpp"; + adf::source(samples_divVSKernel) = "divVS/divVS.cpp"; + adf::source(samples_mulVSKernel) = "mulVS/mulVS.cpp"; + adf::source(samples_normAxis1Kernel) = "norm_axis_1/norm_axis_1.cpp"; + adf::source(samples_sumVSKernel) = "sumVS/sumVS.cpp"; + adf::source(samples_sumVVKernel) = "sumVV/sumVV.cpp"; + + // diffMV + adf::connect<>(image_points_from_PL, samples_diffMVKernel.in[0]); + adf::connect<>(xdc_def_positions, samples_diffMVKernel.in[1]); + + adf::dimensions(samples_diffMVKernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(samples_diffMVKernel.in[1]) = {SPACE_DIMENSION_}; + adf::dimensions(samples_diffMVKernel.out[0]) = {DIM_MATRIX_}; + + // normAxis1 + adf::connect<>(samples_diffMVKernel.out[0], samples_normAxis1Kernel.in[0]); + + adf::dimensions(samples_normAxis1Kernel.in[0]) = {DIM_MATRIX_}; + adf::dimensions(samples_normAxis1Kernel.out[0]) = {DIM_VECTOR_}; + + /// divVS + adf::connect<>(samples_normAxis1Kernel.out[0], samples_divVSKernel.in[0]); + + adf::dimensions(samples_divVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(samples_divVSKernel.out[0]) = {DIM_VECTOR_}; + + // sumVV + adf::connect<>(samples_divVSKernel.out[0], samples_sumVVKernel.in[1]); + adf::connect<>(delay_from_PL, samples_sumVVKernel.in[0]); + + adf::dimensions(samples_sumVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(samples_sumVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(samples_sumVVKernel.out[0]) = {DIM_VECTOR_}; + + // mulVS + adf::connect<>(samples_sumVVKernel.out[0], samples_mulVSKernel.in[0]); + adf::connect<>(sampling_frequency, samples_mulVSKernel.in[1]); + + adf::dimensions(samples_mulVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(samples_mulVSKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(samples_mulVSKernel.out[0]) = {DIM_VECTOR_}; + + // sumVS + adf::connect<>(samples_mulVSKernel.out[0], samples_sumVSKernel.in[0]); + adf::connect<>(samples_sumVSKernel.out[0], samples_to_PL); + + adf::dimensions(samples_sumVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(samples_sumVSKernel.out[0]) = {DIM_VECTOR_}; + + // kernel runtime + adf::runtime(samples_diffMVKernel) = kernel_ratio; + adf::runtime(samples_divVSKernel) = kernel_ratio; + adf::runtime(samples_mulVSKernel) = kernel_ratio; + adf::runtime(samples_normAxis1Kernel) = kernel_ratio; + adf::runtime(samples_sumVSKernel) = kernel_ratio; + adf::runtime(samples_sumVVKernel) = kernel_ratio; + } + + private: + adf::kernel samples_diffMVKernel; + adf::kernel samples_divVSKernel; + adf::kernel samples_mulVSKernel; + adf::kernel samples_normAxis1Kernel; + adf::kernel samples_sumVSKernel; + adf::kernel samples_sumVVKernel; +}; + +} // namespace L2 +} // namespace us + +#endif \ No newline at end of file diff --git a/ultrasound/L2/meta/api.json b/ultrasound/L2/meta/api.json new file mode 100644 index 0000000000..dfc610c7f2 --- /dev/null +++ b/ultrasound/L2/meta/api.json @@ -0,0 +1,695 @@ +{ + "schema": "vitis_libraries_api_list_schema-1.0", + "api_list": [ + { + "api_name": "us::L2::imagePoints", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::imagePoints", + "display_name": "imagePoints", + "brief": "", + "target_domain": "", + "header_file_name": [ + "imagePoints.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "SPACE_DIMENSION_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_MATRIX_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "start_positions", + "direction": "adf:: input", + "type": "adf::port us::L2::imagePoints< T, LENGTH_, SPACE_DIMENSION_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::start_positions" + }, + { + "name": "samples_arange", + "direction": "adf:: input", + "type": "adf::port us::L2::imagePoints< T, LENGTH_, SPACE_DIMENSION_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::samples_arange" + }, + { + "name": "directions", + "direction": "adf:: input", + "type": "adf::port us::L2::imagePoints< T, LENGTH_, SPACE_DIMENSION_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::directions" + }, + { + "name": "image_points", + "direction": "adf:: output", + "type": "adf::port us::L2::imagePoints< T, LENGTH_, SPACE_DIMENSION_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::image_points" + } + ] + } + }, + { + "api_name": "us::L2::samples", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::samples", + "display_name": "samples", + "brief": "", + "target_domain": "", + "header_file_name": [ + "samples.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_VECTOR_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_MATRIX_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "image_points_from_PL_2", + "direction": "adf:: input", + "type": "adf::port us::L2::samples< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::image_points_from_PL_2" + }, + { + "name": "xdc_def_positions", + "direction": "adf:: input", + "type": "adf::port us::L2::samples< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::xdc_def_positions" + }, + { + "name": "samplingFrequency", + "direction": "adf:: input", + "type": "adf::port us::L2::samples< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::samplingFrequency" + }, + { + "name": "delay_from_PL", + "direction": "adf:: input", + "type": "adf::port us::L2::samples< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::delay_from_PL" + }, + { + "name": "samples_to_PL", + "direction": "adf:: output", + "type": "adf::port us::L2::samples< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, SIMD_DEPTH_, FIFO_DEPTH_ >::samples_to_PL" + } + ] + } + }, + { + "api_name": "us::L2::focusing", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::focusing", + "display_name": "focusing", + "brief": "", + "target_domain": "", + "header_file_name": [ + "focusing.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_VECTOR_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "apo_ref_0", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing< T, LENGTH_, INCREMENT_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::apo_ref_0" + }, + { + "name": "xdc_def_0", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing< T, LENGTH_, INCREMENT_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::xdc_def_0" + }, + { + "name": "apo_ref_1", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing< T, LENGTH_, INCREMENT_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::apo_ref_1" + }, + { + "name": "xdc_def_1", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing< T, LENGTH_, INCREMENT_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::xdc_def_1" + }, + { + "name": "focusing_output", + "direction": "adf:: output", + "type": "adf::port us::L2::focusing< T, LENGTH_, INCREMENT_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::focusing_output" + } + ] + } + }, + { + "api_name": "us::L2::focusing_sa", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::focusing_sa", + "display_name": "focusing_sa", + "brief": "", + "target_domain": "", + "header_file_name": [ + "focusing_sa.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_VECTOR_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_VECTOR_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "apo_ref_0", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing_sa< T, LENGTH_, INCREMENT_VECTOR_, WIN_SIZE_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::apo_ref_0" + }, + { + "name": "img_points_0", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing_sa< T, LENGTH_, INCREMENT_VECTOR_, WIN_SIZE_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::img_points_0" + }, + { + "name": "apo_ref_1", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing_sa< T, LENGTH_, INCREMENT_VECTOR_, WIN_SIZE_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::apo_ref_1" + }, + { + "name": "img_points_1", + "direction": "adf:: input", + "type": "adf::port us::L2::focusing_sa< T, LENGTH_, INCREMENT_VECTOR_, WIN_SIZE_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::img_points_1" + }, + { + "name": "focusing_output", + "direction": "adf:: output", + "type": "adf::port us::L2::focusing_sa< T, LENGTH_, INCREMENT_VECTOR_, WIN_SIZE_VECTOR_, SIMD_DEPTH_, FIFO_DEPTH_ >::focusing_output" + } + ] + } + }, + { + "api_name": "us::L2::delay", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::delay", + "display_name": "delay", + "brief": "", + "target_domain": "", + "header_file_name": [ + "delay.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_VECTOR_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_MATRIX_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_VECTOR_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_MATRIX_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "SPACE_DIMENSION_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "image_points_from_PL", + "direction": "adf:: input", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::image_points_from_PL" + }, + { + "name": "image_points_from_PL_", + "direction": "adf:: input", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::image_points_from_PL_" + }, + { + "name": "tx_def_reference_point", + "direction": "adf:: input", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::tx_def_reference_point" + }, + { + "name": "tx_def_delay_distance", + "direction": "adf:: input", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::tx_def_delay_distance" + }, + { + "name": "tx_def_delay_distance_", + "direction": "adf:: input", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::tx_def_delay_distance_" + }, + { + "name": "tx_def_focal_point", + "direction": "adf:: input", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::tx_def_focal_point" + }, + { + "name": "t_start", + "direction": "adf:: input", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::t_start" + }, + { + "name": "delay_to_PL", + "direction": "adf:: output", + "type": "adf::port us::L2::delay< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::delay_to_PL" + } + ] + } + }, + { + "api_name": "us::L2::delay_pw", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::delay_pw", + "display_name": "delay_pw", + "brief": "", + "target_domain": "", + "header_file_name": [ + "delay_pw.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_VECTOR_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_MATRIX_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_VECTOR_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_MATRIX_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "SPACE_DIMENSION_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "image_points_from_PL", + "direction": "adf:: input", + "type": "adf::port us::L2::delay_pw< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::image_points_from_PL" + }, + { + "name": "tx_def_reference_point", + "direction": "adf:: input", + "type": "adf::port us::L2::delay_pw< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::tx_def_reference_point" + }, + { + "name": "t_start", + "direction": "adf:: input", + "type": "adf::port us::L2::delay_pw< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::t_start" + }, + { + "name": "delay_to_PL", + "direction": "adf:: output", + "type": "adf::port us::L2::delay_pw< T, LENGTH_, INCREMENT_VECTOR_, INCREMENT_MATRIX_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, SIMD_DEPTH_, SPACE_DIMENSION_, FIFO_DEPTH_ >::delay_to_PL" + } + ] + } + }, + { + "api_name": "us::L2::bSpline", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::bSpline", + "display_name": "bSpline", + "brief": "", + "target_domain": "", + "header_file_name": [ + "bSpline.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "POINTS_PER_ITERATION_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_INTERPOLATOR_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "P1", + "direction": "adf:: input", + "type": "adf::port us::L2::bSpline< T, LENGTH_, POINTS_PER_ITERATION_, SIMD_DEPTH_, WIN_SIZE_INTERPOLATOR_, FIFO_DEPTH_ >::P1" + }, + { + "name": "P2", + "direction": "adf:: input", + "type": "adf::port us::L2::bSpline< T, LENGTH_, POINTS_PER_ITERATION_, SIMD_DEPTH_, WIN_SIZE_INTERPOLATOR_, FIFO_DEPTH_ >::P2" + }, + { + "name": "P3", + "direction": "adf:: input", + "type": "adf::port us::L2::bSpline< T, LENGTH_, POINTS_PER_ITERATION_, SIMD_DEPTH_, WIN_SIZE_INTERPOLATOR_, FIFO_DEPTH_ >::P3" + }, + { + "name": "P4", + "direction": "adf:: input", + "type": "adf::port us::L2::bSpline< T, LENGTH_, POINTS_PER_ITERATION_, SIMD_DEPTH_, WIN_SIZE_INTERPOLATOR_, FIFO_DEPTH_ >::P4" + }, + { + "name": "P5", + "direction": "adf:: input", + "type": "adf::port us::L2::bSpline< T, LENGTH_, POINTS_PER_ITERATION_, SIMD_DEPTH_, WIN_SIZE_INTERPOLATOR_, FIFO_DEPTH_ >::P5" + }, + { + "name": "P6", + "direction": "adf:: input", + "type": "adf::port us::L2::bSpline< T, LENGTH_, POINTS_PER_ITERATION_, SIMD_DEPTH_, WIN_SIZE_INTERPOLATOR_, FIFO_DEPTH_ >::P6" + }, + { + "name": "C", + "direction": "adf:: output", + "type": "adf::port us::L2::bSpline< T, LENGTH_, POINTS_PER_ITERATION_, SIMD_DEPTH_, WIN_SIZE_INTERPOLATOR_, FIFO_DEPTH_ >::C" + } + ] + } + }, + { + "api_name": "us::L2::apodization", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::apodization", + "display_name": "apodization", + "brief": "", + "target_domain": "", + "header_file_name": [ + "apodization.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_MATRIX_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_VECTOR_", + "type": "unsigned int" + }, + { + "name": "SPACE_DIMENSION_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_VECTOR_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_MATRIX_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "image_points", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::image_points" + }, + { + "name": "apodization_reference_i", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::apodization_reference_i" + }, + { + "name": "apo_distance_k", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::apo_distance_k" + }, + { + "name": "F_number", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::F_number" + }, + { + "name": "apodization_output", + "direction": "adf:: output", + "type": "adf::port us::L2::apodization< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::apodization_output" + } + ] + } + }, + { + "api_name": "us::L2::apodization_sa", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L2::apodization_sa", + "display_name": "apodization_sa", + "brief": "", + "target_domain": "", + "header_file_name": [ + "apodization_sa.hpp" + ], + "search_paths": [ + "L2/include" + ], + "instance": "class", + "parameters": [ + { + "name": "T", + "type": "typename" + }, + { + "name": "LENGTH_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_MATRIX_", + "type": "unsigned int" + }, + { + "name": "INCREMENT_VECTOR_", + "type": "unsigned int" + }, + { + "name": "SPACE_DIMENSION_", + "type": "unsigned int" + }, + { + "name": "SIMD_DEPTH_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_VECTOR_", + "type": "unsigned int" + }, + { + "name": "WIN_SIZE_MATRIX_", + "type": "unsigned int" + }, + { + "name": "FIFO_DEPTH_", + "type": "unsigned int" + } + ], + "ports": [ + { + "name": "image_points", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization_sa< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::image_points" + }, + { + "name": "apodization_reference_i", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization_sa< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::apodization_reference_i" + }, + { + "name": "apo_distance_k", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization_sa< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::apo_distance_k" + }, + { + "name": "F_number", + "direction": "adf:: input", + "type": "adf::port us::L2::apodization_sa< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::F_number" + }, + { + "name": "apodization_output", + "direction": "adf:: output", + "type": "adf::port us::L2::apodization_sa< T, LENGTH_, INCREMENT_MATRIX_, INCREMENT_VECTOR_, SPACE_DIMENSION_, SIMD_DEPTH_, WIN_SIZE_VECTOR_, WIN_SIZE_MATRIX_, FIFO_DEPTH_ >::apodization_output" + } + ] + } + } + ], + "target_domain": "" +} \ No newline at end of file diff --git a/ultrasound/L2/tests/README.md b/ultrasound/L2/tests/README.md new file mode 100644 index 0000000000..e5d38337b7 --- /dev/null +++ b/ultrasound/L2/tests/README.md @@ -0,0 +1,42 @@ +## Ultrasound Library - Level 2 (L2) + +### Setup Environment +```bash +#!/bin/bash +# setup vitis_22.2 env +source /Vitis/2022.2/settings64.sh +source /opt/xilinx/xrt/setup.sh +export PLATFORM_REPO_PATHS= +export DEVICE=xilinx_vck190_base_202220_1 +# set up your SYSROOT, ROOTFS and K_IMAGE PATH +export SYSROOT=/sw/versal/xilinx-versal-common-v2022.2/sysroots/aarch64-xilinx-linux/ +export ROOTFS=/sw/versal/xilinx-versal-common-v2022.2/rootfs.ext4 +export K_IMAGE=/sw/versal/xilinx-versal-common-v2022.2/Image +``` + +### Run a L2 Example +```bash +#!/bin/bash +cd L2/tests/apodization # scanline is an example case. Please change directory to any other cases in L3/tests if interested. +make help # show available make command +make run TARGET=x86sim # run aie x86sim flow +make run TARGET=aiesim # run aie aiesim flow +make run TARGET=sw_emu # run vitis sw_emu flow +make run TRAGET=hw_emu # run vitis hw_emu flow +make all TARGET=hw # build the entire program for hw_run +``` + +## License +Copyright 2022 AMD, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/ultrasound/L2/tests/absV/Makefile b/ultrasound/L2/tests/absV/Makefile new file mode 100644 index 0000000000..220e6f5906 --- /dev/null +++ b/ultrasound/L2/tests/absV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/absV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/absV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/absV/data/absV_golden b/ultrasound/L2/tests/absV/data/absV_golden new file mode 100644 index 0000000000..7f2e96ed30 --- /dev/null +++ b/ultrasound/L2/tests/absV/data/absV_golden @@ -0,0 +1,32 @@ +1.000000000e+00 +2.000000000e+00 +3.000000000e+00 +4.000000000e+00 +5.000000000e+00 +6.000000000e+00 +7.000000000e+00 +8.000000000e+00 +9.000000000e+00 +1.000000000e+01 +1.100000000e+01 +1.200000000e+01 +1.300000000e+01 +1.400000000e+01 +1.500000000e+01 +1.600000000e+01 +1.000000000e+00 +2.000000000e+00 +3.000000000e+00 +4.000000000e+00 +5.000000000e+00 +6.000000000e+00 +7.000000000e+00 +8.000000000e+00 +9.000000000e+00 +1.000000000e+01 +1.100000000e+01 +1.200000000e+01 +1.300000000e+01 +1.400000000e+01 +1.500000000e+01 +1.600000000e+01 diff --git a/ultrasound/L2/tests/absV/data/input.txt b/ultrasound/L2/tests/absV/data/input.txt new file mode 100644 index 0000000000..31bad7f7b6 --- /dev/null +++ b/ultrasound/L2/tests/absV/data/input.txt @@ -0,0 +1,256 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/absV/description.json b/ultrasound/L2/tests/absV/description.json new file mode 100644 index 0000000000..5594d79caa --- /dev/null +++ b/ultrasound/L2/tests/absV/description.json @@ -0,0 +1,63 @@ +{ + "name": "L1 absV Test", + "description": "absV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/absV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/absV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": { + "vitis_aie_sim": 470, + "vitis_aie_x86sim": 300 + } + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/absV/test.cpp b/ultrasound/L2/tests/absV/test.cpp new file mode 100644 index 0000000000..b36c33f6a9 --- /dev/null +++ b/ultrasound/L2/tests/absV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::absV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/absV/test.hpp b/ultrasound/L2/tests/absV/test.hpp new file mode 100644 index 0000000000..9f543ab724 --- /dev/null +++ b/ultrasound/L2/tests/absV/test.hpp @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +#define FRAME_LENGTH 32 + +namespace us { +namespace L2 { + +class absV : public adf::graph { + public: + // Input and output ports + adf::input_plio input_absV; + adf::output_plio output_absV; + + absV() { + // input & output plio + input_absV = adf::input_plio::create("input_absV", adf::plio_32_bits, "data/input.txt"); + output_absV = adf::output_plio::create("output_absV", adf::plio_32_bits, "data/output.txt"); + + // kernel definition + absVKernel = adf::kernel::create(L1::absV); + adf::source(absVKernel) = "absV/absV.cpp"; + + // connections + adf::connect(input_absV.out[0], absVKernel.in[0]); + adf::connect(absVKernel.out[0], output_absV.in[0]); + + // config + adf::runtime(absVKernel) = KERNEL_RATIO; + adf::dimensions(absVKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(absVKernel.out[0]) = {FRAME_LENGTH}; + } + + private: + adf::kernel absVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/absV/utils.mk b/ultrasound/L2/tests/absV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/absV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/apodization/Makefile b/ultrasound/L2/tests/apodization/Makefile new file mode 100644 index 0000000000..58196b2284 --- /dev/null +++ b/ultrasound/L2/tests/apodization/Makefile @@ -0,0 +1,439 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= aarch64 + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := xilinx_vck190_base_202310_1 +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/apodization/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/apodization/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/apodization/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/apodization/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin apodization.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/apodization.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/apodization.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/apodization_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/apodization.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/apodization/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/apodization.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L2/tests/apodization/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/apodization/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/apodization/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/apodization/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/apodization/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/apodization/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/apodization/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization/PL_kernels/mm2s4.cpp b/ultrasound/L2/tests/apodization/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L2/tests/apodization/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/apodization/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/apodization/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/apodization/PS_host/host.cpp b/ultrasound/L2/tests/apodization/PS_host/host.cpp new file mode 100644 index 0000000000..a2365f24e5 --- /dev/null +++ b/ultrasound/L2/tests/apodization/PS_host/host.cpp @@ -0,0 +1,324 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 4 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int& size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "input file is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Input: image-points + file_set[0] = data_path + "image_points.txt"; + file_set[1] = data_path + "apodization_reference.txt"; + file_set[2] = data_path + "apo_distance_k.txt"; + file_set[3] = data_path + "F_number.txt"; + + // input & output mem size + sizeIn[0] = 128; + sizeIn[1] = 4; + sizeIn[2] = 32; + sizeIn[3] = 4; + sizeOut[0] = 32; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[1]; + float* out_bomapped_set[1]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + g.init(); + + std::cout << "graph run" << std::endl; + g.run(1); + + g.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "apodization_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + golden_sizeOut[0] = 32; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = golden_buf_mem[k][i]; + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + if (result_tmp != result_golden) err_cnt++; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + ////////////////////////////////////////// + // End + ////////////////////////////////////////// + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} diff --git a/ultrasound/L2/tests/apodization/PS_host/host.hpp b/ultrasound/L2/tests/apodization/PS_host/host.hpp new file mode 100644 index 0000000000..8ff813672f --- /dev/null +++ b/ultrasound/L2/tests/apodization/PS_host/host.hpp @@ -0,0 +1,36 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/apodization/aie_graph/graph.cpp b/ultrasound/L2/tests/apodization/aie_graph/graph.cpp new file mode 100644 index 0000000000..01097a9ab4 --- /dev/null +++ b/ultrasound/L2/tests/apodization/aie_graph/graph.cpp @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "apodization.hpp" + +class apodization : public adf::graph { + public: + // input and output port + adf::input_plio image_points; + adf::input_plio apodization_reference_i; + adf::input_plio apo_distance_k; + adf::input_plio F_number; + adf::output_plio apodization_output; + + // apodization graph + us::L2::apodization_graph<> apo; + + apodization() { + // input + image_points = adf::input_plio::create("image_points", adf::plio_32_bits, "data/image_points.txt"); + apodization_reference_i = + adf::input_plio::create("apodization_reference", adf::plio_32_bits, "data/apodization_reference.txt"); + apo_distance_k = adf::input_plio::create("apo_distance_k", adf::plio_32_bits, "data/apo_distance_k.txt"); + F_number = adf::input_plio::create("F_number", adf::plio_32_bits, "data/apo_distance_k.txt"); + apodization_output = adf::output_plio::create("apodization", adf::plio_32_bits, "data/apodization.txt"); + + adf::connect<>(image_points.out[0], apo.image_points); + adf::connect<>(apodization_reference_i.out[0], apo.apodization_reference_i); + adf::connect<>(apo_distance_k.out[0], apo.apo_distance_k); + adf::connect<>(F_number.out[0], apo.F_number); + adf::connect<>(apo.apodization_output, apodization_output.in[0]); + } +}; + +apodization g; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/apodization/data/F_number.txt b/ultrasound/L2/tests/apodization/data/F_number.txt new file mode 100644 index 0000000000..cff962c938 --- /dev/null +++ b/ultrasound/L2/tests/apodization/data/F_number.txt @@ -0,0 +1,472 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 diff --git a/ultrasound/L2/tests/apodization/data/apo_distance_k.txt b/ultrasound/L2/tests/apodization/data/apo_distance_k.txt new file mode 100644 index 0000000000..5f635d0373 --- /dev/null +++ b/ultrasound/L2/tests/apodization/data/apo_distance_k.txt @@ -0,0 +1,2048 @@ +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 diff --git a/ultrasound/L2/tests/apodization/data/apodization_golden.txt b/ultrasound/L2/tests/apodization/data/apodization_golden.txt new file mode 100644 index 0000000000..2173e7405b --- /dev/null +++ b/ultrasound/L2/tests/apodization/data/apodization_golden.txt @@ -0,0 +1,32 @@ +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 +0.9999994040 diff --git a/ultrasound/L2/tests/apodization/data/apodization_reference.txt b/ultrasound/L2/tests/apodization/data/apodization_reference.txt new file mode 100644 index 0000000000..d3ff438bcc --- /dev/null +++ b/ultrasound/L2/tests/apodization/data/apodization_reference.txt @@ -0,0 +1,2048 @@ +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 diff --git a/ultrasound/L2/tests/apodization/data/image_points.txt b/ultrasound/L2/tests/apodization/data/image_points.txt new file mode 100644 index 0000000000..67fbcc3c56 --- /dev/null +++ b/ultrasound/L2/tests/apodization/data/image_points.txt @@ -0,0 +1,2048 @@ +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 diff --git a/ultrasound/L2/tests/apodization/description.json b/ultrasound/L2/tests/apodization/description.json new file mode 100644 index 0000000000..515885da5e --- /dev/null +++ b/ultrasound/L2/tests/apodization/description.json @@ -0,0 +1,143 @@ +{ + "name": "L2 apodization Test", + "description": "apodization Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin apodization.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/apodization.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/apodization/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/apodization/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/apodization/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/apodization/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/apodization/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/apodization/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/apodization/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L2/tests/apodization/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "apodization" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/apodization/system.cfg b/ultrasound/L2/tests/apodization/system.cfg new file mode 100644 index 0000000000..c3af85e104 --- /dev/null +++ b/ultrasound/L2/tests/apodization/system.cfg @@ -0,0 +1,8 @@ +[connectivity] + +stream_connect=mm2s1_1.s:ai_engine_0.image_points +stream_connect=mm2s2_1.s:ai_engine_0.apodization_reference +stream_connect=mm2s3_1.s:ai_engine_0.apo_distance_k +stream_connect=mm2s4_1.s:ai_engine_0.F_number + +stream_connect=ai_engine_0.apodization:s2mm1_1.s diff --git a/ultrasound/L2/tests/apodization/utils.mk b/ultrasound/L2/tests/apodization/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/apodization/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/apodization_sa/Makefile b/ultrasound/L2/tests/apodization_sa/Makefile new file mode 100644 index 0000000000..13cfbf0fd9 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/Makefile @@ -0,0 +1,433 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/apodization_sa/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/apodization_sa/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/apodization_sa/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/apodization_sa/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin apodization_sa.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/apodization_sa.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/apodization_sa.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/apodization_sa_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/apodization_sa.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/apodization_sa/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp Work/reports/dma_lock_report.json ./ + cp Work/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/apodization_sa.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) + +clean: cleanh diff --git a/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s4.cpp b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/apodization_sa/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/apodization_sa/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/apodization_sa/PS_host/host.cpp b/ultrasound/L2/tests/apodization_sa/PS_host/host.cpp new file mode 100644 index 0000000000..db41f5bddb --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/PS_host/host.cpp @@ -0,0 +1,335 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include "graph.cpp" +#include "host.hpp" + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define POINT_SIZE 256 +#define ITERATIONS 1 +#define SPACE_DIMENSION 4 + +#define INPUT_SIZE_1 ((POINT_SIZE * SPACE_DIMENSION) * ITERATIONS) +#define INPUT_SIZE_2 (POINT_SIZE * ITERATIONS) +#define OUTPUT_SIZE (POINT_SIZE * ITERATIONS) + +#define INPUT_RANGE 4 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int& size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "direction input is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[4]; + int sizeOut[1]; + float* buf_mem[4]; + std::string file_set[4]; + + // Input: image-points + file_set[0] = data_path + "image_points.txt"; + file_set[1] = data_path + "apodization_reference.txt"; + file_set[2] = data_path + "apo_distance_k.txt"; + file_set[3] = data_path + "F_number.txt"; + + sizeIn[0] = 128; + sizeIn[1] = 4; + sizeIn[2] = 32; + sizeIn[3] = 4; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + // mem data output length define + sizeOut[0] = 32; // apodization_sa + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[1]; + float* out_bomapped_set[1]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[4]; + xrtRunHandle mm2s_rhdl_set[4]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[6]; + xrtRunHandle s2mm_rhdl_set[6]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + g.init(); + + g.run(1); + std::cout << "graph run" << std::endl; + + g.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + // wait for run kernel done + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + ////////////////////////////////////////// + // wait for s2mm done + ////////////////////////////////////////// + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "apodization_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + + golden_sizeOut[0] = 32; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = golden_buf_mem[k][i]; + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + if (result_tmp != result_golden) err_cnt++; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + // End + if (!err_cnt) + printf("Test Pass\n"); + else + printf("Test Fail\n"); + + return 0; +} diff --git a/ultrasound/L2/tests/apodization_sa/PS_host/host.hpp b/ultrasound/L2/tests/apodization_sa/PS_host/host.hpp new file mode 100644 index 0000000000..8ff813672f --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/PS_host/host.hpp @@ -0,0 +1,36 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/apodization_sa/aie_graph/graph.cpp b/ultrasound/L2/tests/apodization_sa/aie_graph/graph.cpp new file mode 100644 index 0000000000..e77adbeef5 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/aie_graph/graph.cpp @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "apodization_sa.hpp" + +class apodization_sa : public adf::graph { + public: + // input and output port + adf::input_plio image_points; + adf::input_plio apodization_reference; + adf::input_plio apo_distance_k; + adf::input_plio F_number; + adf::output_plio apodization_output; + + us::L2::apodization_sa_graph<> g; + + apodization_sa() { + image_points = adf::input_plio::create("image_points", adf::plio_32_bits, "data/image_points.txt"); + apodization_reference = + adf::input_plio::create("apodization_reference_tx", adf::plio_32_bits, "data/apodization_reference.txt"); + apo_distance_k = adf::input_plio::create("apo_distance_k_tx", adf::plio_32_bits, "data/apo_distance_k.txt"); + F_number = adf::input_plio::create("F_number", adf::plio_32_bits, "data/apo_distance_k.txt"); + apodization_output = adf::output_plio::create("apodization", adf::plio_32_bits, "data/apodization.txt"); + + adf::connect<>(image_points.out[0], g.image_points); + adf::connect<>(apodization_reference.out[0], g.apodization_reference); + adf::connect<>(apo_distance_k.out[0], g.apo_distance_k); + adf::connect<>(F_number.out[0], g.F_number); + adf::connect<>(g.apodization_output, apodization_output.in[0]); + } +}; + +apodization_sa g; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/apodization_sa/data/F_number.txt b/ultrasound/L2/tests/apodization_sa/data/F_number.txt new file mode 100644 index 0000000000..cff962c938 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/data/F_number.txt @@ -0,0 +1,472 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 diff --git a/ultrasound/L2/tests/apodization_sa/data/apo_distance_k.txt b/ultrasound/L2/tests/apodization_sa/data/apo_distance_k.txt new file mode 100644 index 0000000000..5f635d0373 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/data/apo_distance_k.txt @@ -0,0 +1,2048 @@ +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 +6e-6 diff --git a/ultrasound/L2/tests/apodization_sa/data/apodization_golden.txt b/ultrasound/L2/tests/apodization_sa/data/apodization_golden.txt new file mode 100644 index 0000000000..ff68b7c877 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/data/apodization_golden.txt @@ -0,0 +1,32 @@ +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 +9.999994040e-01 diff --git a/ultrasound/L2/tests/apodization_sa/data/apodization_reference.txt b/ultrasound/L2/tests/apodization_sa/data/apodization_reference.txt new file mode 100644 index 0000000000..d3ff438bcc --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/data/apodization_reference.txt @@ -0,0 +1,2048 @@ +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 +36 diff --git a/ultrasound/L2/tests/apodization_sa/data/image_points.txt b/ultrasound/L2/tests/apodization_sa/data/image_points.txt new file mode 100644 index 0000000000..67fbcc3c56 --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/data/image_points.txt @@ -0,0 +1,2048 @@ +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 +20 diff --git a/ultrasound/L2/tests/apodization_sa/description.json b/ultrasound/L2/tests/apodization_sa/description.json new file mode 100644 index 0000000000..b0c820419d --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/description.json @@ -0,0 +1,143 @@ +{ + "name": "L2 apodization_sa Test", + "description": "apodization_sa Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin apodization_sa.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/apodization_sa.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/apodization_sa/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/apodization_sa/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/apodization_sa/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/apodization_sa/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/apodization_sa/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/apodization_sa/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/apodization_sa/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L2/tests/apodization_sa/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "apodization_sa" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/apodization_sa/system.cfg b/ultrasound/L2/tests/apodization_sa/system.cfg new file mode 100644 index 0000000000..c67aa7f58a --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/system.cfg @@ -0,0 +1,8 @@ +[connectivity] + +stream_connect=mm2s1_1.s:ai_engine_0.image_points +stream_connect=mm2s2_1.s:ai_engine_0.apodization_reference_tx +stream_connect=mm2s3_1.s:ai_engine_0.apo_distance_k_tx +stream_connect=mm2s4_1.s:ai_engine_0.F_number + +stream_connect=ai_engine_0.apodization:s2mm1_1.s diff --git a/ultrasound/L2/tests/apodization_sa/utils.mk b/ultrasound/L2/tests/apodization_sa/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/apodization_sa/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/cosV/Makefile b/ultrasound/L2/tests/cosV/Makefile new file mode 100644 index 0000000000..2a4b445571 --- /dev/null +++ b/ultrasound/L2/tests/cosV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/cosV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/cosV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/cosV/data/cosV_golden b/ultrasound/L2/tests/cosV/data/cosV_golden new file mode 100644 index 0000000000..dde02b4867 --- /dev/null +++ b/ultrasound/L2/tests/cosV/data/cosV_golden @@ -0,0 +1,128 @@ +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +-9.999987483e-01 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/cosV/data/input.txt b/ultrasound/L2/tests/cosV/data/input.txt new file mode 100644 index 0000000000..a0f9f601be --- /dev/null +++ b/ultrasound/L2/tests/cosV/data/input.txt @@ -0,0 +1,256 @@ +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 \ No newline at end of file diff --git a/ultrasound/L2/tests/cosV/description.json b/ultrasound/L2/tests/cosV/description.json new file mode 100644 index 0000000000..71f05d4080 --- /dev/null +++ b/ultrasound/L2/tests/cosV/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 cosV Test", + "description": "cosV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/cosV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/cosV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/cosV/test.cpp b/ultrasound/L2/tests/cosV/test.cpp new file mode 100644 index 0000000000..3761abad1d --- /dev/null +++ b/ultrasound/L2/tests/cosV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::cosV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/cosV/test.hpp b/ultrasound/L2/tests/cosV/test.hpp new file mode 100644 index 0000000000..4c30569404 --- /dev/null +++ b/ultrasound/L2/tests/cosV/test.hpp @@ -0,0 +1,55 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +#define FRAME_LENGTH 32 + +namespace us { +namespace L2 { + +class cosV : public adf::graph { + public: + // Input and output ports + adf::input_plio input_cosV; + adf::output_plio output_cosV; + + cosV() { + // Input and output plio port + input_cosV = adf::input_plio::create("input_cosV", adf::plio_32_bits, "data/input.txt"); + output_cosV = adf::output_plio::create("output_cosV", adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + cosVKernel = adf::kernel::create(L1::cosV); + adf::source(cosVKernel) = "cosV/cosV.cpp"; + + // connections + adf::connect(input_cosV.out[0], cosVKernel.in[0]); + adf::connect(cosVKernel.out[0], output_cosV.in[0]); + + // config + adf::runtime(cosVKernel) = KERNEL_RATIO; + adf::dimensions(cosVKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(cosVKernel.out[0]) = {FRAME_LENGTH}; + } + + private: + adf::kernel cosVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/cosV/utils.mk b/ultrasound/L2/tests/cosV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/cosV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/dataMover/Makefile b/ultrasound/L2/tests/dataMover/Makefile new file mode 100644 index 0000000000..3b973d8e88 --- /dev/null +++ b/ultrasound/L2/tests/dataMover/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/dataMover/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/dataMover/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/dataMover/data/dataMover_golden b/ultrasound/L2/tests/dataMover/data/dataMover_golden new file mode 100644 index 0000000000..1b71827286 --- /dev/null +++ b/ultrasound/L2/tests/dataMover/data/dataMover_golden @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +-4.000000000e+00 +-4.000000000e+00 +-4.000000000e+00 +-4.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +-9.000000000e+00 +-9.000000000e+00 +-9.000000000e+00 +-9.000000000e+00 +-1.000000000e+01 +-1.000000000e+01 +-1.000000000e+01 +-1.000000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +-1.200000000e+01 +-1.200000000e+01 +-1.200000000e+01 +-1.200000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +-1.600000000e+01 +-1.600000000e+01 +-1.600000000e+01 +-1.600000000e+01 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +-4.000000000e+00 +-4.000000000e+00 +-4.000000000e+00 +-4.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +-9.000000000e+00 +-9.000000000e+00 +-9.000000000e+00 +-9.000000000e+00 +-1.000000000e+01 +-1.000000000e+01 +-1.000000000e+01 +-1.000000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +-1.200000000e+01 +-1.200000000e+01 +-1.200000000e+01 +-1.200000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +-1.600000000e+01 +-1.600000000e+01 +-1.600000000e+01 +-1.600000000e+01 \ No newline at end of file diff --git a/ultrasound/L2/tests/dataMover/data/input.txt b/ultrasound/L2/tests/dataMover/data/input.txt new file mode 100644 index 0000000000..f30563b07a --- /dev/null +++ b/ultrasound/L2/tests/dataMover/data/input.txt @@ -0,0 +1,32 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/dataMover/description.json b/ultrasound/L2/tests/dataMover/description.json new file mode 100644 index 0000000000..b6befdbc8d --- /dev/null +++ b/ultrasound/L2/tests/dataMover/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 dataMover Test", + "description": "dataMover Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/dataMover/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/dataMover/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/dataMover/test.cpp b/ultrasound/L2/tests/dataMover/test.cpp new file mode 100644 index 0000000000..d16e43b414 --- /dev/null +++ b/ultrasound/L2/tests/dataMover/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::dataMover g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/dataMover/test.hpp b/ultrasound/L2/tests/dataMover/test.hpp new file mode 100644 index 0000000000..90e990b2da --- /dev/null +++ b/ultrasound/L2/tests/dataMover/test.hpp @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +#define FRAME_LENGTH 32 + +namespace us { +namespace L2 { + +class dataMover : public adf::graph { + public: + // Input and output ports + adf::input_plio input_dataMover; + adf::output_plio output_dataMover; + + dataMover() { + // input & output plio + input_dataMover = adf::input_plio::create("input_dataMover", adf::plio_32_bits, "data/input.txt"); + output_dataMover = adf::output_plio::create("output_dataMover", adf::plio_32_bits, "data/output.txt"); + + // kernel definition + dataMoverKernel = adf::kernel::create(L1::dataMover); + adf::source(dataMoverKernel) = "dataMover/dataMover.cpp"; + + // connections + adf::connect(input_dataMover.out[0], dataMoverKernel.in[0]); + adf::connect(dataMoverKernel.out[0], output_dataMover.in[0]); + + // config + adf::runtime(dataMoverKernel) = KERNEL_RATIO; + adf::dimensions(dataMoverKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(dataMoverKernel.out[0]) = {FRAME_LENGTH * SIMD_DEPTH}; + } + + private: + adf::kernel dataMoverKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/dataMover/utils.mk b/ultrasound/L2/tests/dataMover/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/dataMover/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/delay/Makefile b/ultrasound/L2/tests/delay/Makefile new file mode 100644 index 0000000000..6218e2ed98 --- /dev/null +++ b/ultrasound/L2/tests/delay/Makefile @@ -0,0 +1,460 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/delay/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/delay/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/delay/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/delay/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin delay.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/delay.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_mm2s5 += +VPP_FLAGS_mm2s5 += --hls.clock 100000000:mm2s5 +VPP_FLAGS_mm2s6 += +VPP_FLAGS_mm2s6 += --hls.clock 100000000:mm2s6 +VPP_FLAGS_mm2s7 += +VPP_FLAGS_mm2s7 += --hls.clock 100000000:mm2s7 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/delay.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/delay_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/delay.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/delay/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/delay.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/delay/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/delay/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/delay/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/delay/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay/PL_kernels/mm2s4.cpp b/ultrasound/L2/tests/delay/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay/PL_kernels/mm2s5.cpp b/ultrasound/L2/tests/delay/PL_kernels/mm2s5.cpp new file mode 100644 index 0000000000..583828c713 --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/mm2s5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay/PL_kernels/mm2s6.cpp b/ultrasound/L2/tests/delay/PL_kernels/mm2s6.cpp new file mode 100644 index 0000000000..172d9d16b5 --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/mm2s6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay/PL_kernels/mm2s7.cpp b/ultrasound/L2/tests/delay/PL_kernels/mm2s7.cpp new file mode 100644 index 0000000000..b0a4a405aa --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/mm2s7.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s7(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/delay/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/delay/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/delay/PS_host/host.cpp b/ultrasound/L2/tests/delay/PS_host/host.cpp new file mode 100644 index 0000000000..55dc7d7e9c --- /dev/null +++ b/ultrasound/L2/tests/delay/PS_host/host.cpp @@ -0,0 +1,330 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 7 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "input file is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Input: image-points + file_set[0] = data_path + "image_points.txt"; + file_set[1] = data_path + "image_points.txt"; + file_set[2] = data_path + "tx_def_ref_point.txt"; + file_set[3] = data_path + "tx_def_ref_point.txt"; + file_set[4] = data_path + "tx_def_ref_point.txt"; + file_set[5] = data_path + "tx_def_ref_point.txt"; + file_set[6] = data_path + "t_start.txt"; + + sizeIn[0] = 128; // image_points_from_PL + sizeIn[1] = 128; // image_points_from_PL2 + sizeIn[2] = 4; // tx_def_ref_point + sizeIn[3] = 4; // tx_def_delay_distance + sizeIn[4] = 32; // tx_def_delay_distance2 + sizeIn[5] = 4; // tx_def_focal_point + sizeIn[6] = 4; // t_start + sizeOut[0] = 32; // delay_to_PL + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + b.init(); + + std::cout << "graph run" << std::endl; + b.run(1); + + b.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "delay_to_PL_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = (float)golden_buf_mem[k][i]; + if (result_tmp != result_golden) { + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + err_cnt++; + } + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + ////////////////////////////////////////// + // End + ////////////////////////////////////////// + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} \ No newline at end of file diff --git a/ultrasound/L2/tests/delay/PS_host/host.hpp b/ultrasound/L2/tests/delay/PS_host/host.hpp new file mode 100644 index 0000000000..9370e74e16 --- /dev/null +++ b/ultrasound/L2/tests/delay/PS_host/host.hpp @@ -0,0 +1,33 @@ +/********** +© Copyright 2022 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/delay/aie_graph/graph.cpp b/ultrasound/L2/tests/delay/aie_graph/graph.cpp new file mode 100644 index 0000000000..8ef1350fee --- /dev/null +++ b/ultrasound/L2/tests/delay/aie_graph/graph.cpp @@ -0,0 +1,74 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "delay.hpp" + +class delay : public adf::graph { + public: + // input and output port + adf::input_plio image_points_from_PL; + adf::input_plio image_points_from_PL_; + adf::input_plio tx_def_ref_point; + adf::input_plio tx_def_delay_distance; + adf::input_plio tx_def_delay_distance2; + adf::input_plio tx_def_focal_point; + adf::input_plio t_start; + adf::output_plio delay_to_PL; + + // L2 graph + us::L2::delay_graph<> d; + + delay() { + // input & output plio + image_points_from_PL = + adf::input_plio::create("image_points_from_PL", adf::plio_32_bits, "data/image_points.txt"); + image_points_from_PL_ = + adf::input_plio::create("image_points_from_PL2", adf::plio_32_bits, "data/image_points.txt"); + tx_def_ref_point = adf::input_plio::create("tx_def_ref_point", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + tx_def_delay_distance = + adf::input_plio::create("tx_def_delay_distance", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + tx_def_delay_distance2 = + adf::input_plio::create("tx_def_delay_distance2", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + tx_def_focal_point = + adf::input_plio::create("tx_def_focal_point", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + t_start = adf::input_plio::create("t_start", adf::plio_32_bits, "data/t_start.txt"); + delay_to_PL = adf::output_plio::create("delay_to_PL", adf::plio_32_bits, "data/delay_to_PL.txt"); + + // connections + adf::connect<>(image_points_from_PL.out[0], d.image_points_from_PL); + adf::connect<>(image_points_from_PL_.out[0], d.image_points_from_PL_); + adf::connect<>(tx_def_ref_point.out[0], d.tx_def_ref_point); + adf::connect<>(tx_def_delay_distance.out[0], d.tx_def_delay_distance); + adf::connect<>(tx_def_delay_distance2.out[0], d.tx_def_delay_distance2); + adf::connect<>(tx_def_focal_point.out[0], d.tx_def_focal_point); + adf::connect<>(t_start.out[0], d.t_start); + adf::connect<>(d.delay_to_PL, delay_to_PL.in[0]); + } +}; + +delay b; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + b.init(); + + b.run(1); + + b.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/delay/data/delay_to_PL_golden.txt b/ultrasound/L2/tests/delay/data/delay_to_PL_golden.txt new file mode 100644 index 0000000000..211decbb51 --- /dev/null +++ b/ultrasound/L2/tests/delay/data/delay_to_PL_golden.txt @@ -0,0 +1,32 @@ +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 +-6.000000000e+00 diff --git a/ultrasound/L2/tests/delay/data/image_points.txt b/ultrasound/L2/tests/delay/data/image_points.txt new file mode 100644 index 0000000000..8ade315b57 --- /dev/null +++ b/ultrasound/L2/tests/delay/data/image_points.txt @@ -0,0 +1,2048 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/delay/data/t_start.txt b/ultrasound/L2/tests/delay/data/t_start.txt new file mode 100644 index 0000000000..24b7651a8c --- /dev/null +++ b/ultrasound/L2/tests/delay/data/t_start.txt @@ -0,0 +1,1376 @@ +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 diff --git a/ultrasound/L2/tests/delay/data/tx_def_ref_point.txt b/ultrasound/L2/tests/delay/data/tx_def_ref_point.txt new file mode 100644 index 0000000000..9dcfe2f403 --- /dev/null +++ b/ultrasound/L2/tests/delay/data/tx_def_ref_point.txt @@ -0,0 +1,1408 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 diff --git a/ultrasound/L2/tests/delay/description.json b/ultrasound/L2/tests/delay/description.json new file mode 100644 index 0000000000..46f008d3ea --- /dev/null +++ b/ultrasound/L2/tests/delay/description.json @@ -0,0 +1,167 @@ +{ + "name": "L2 delay Test", + "description": "delay Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin delay.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/delay.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/delay/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/delay/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/delay/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/mm2s5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s5" + }, + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/mm2s6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s6" + }, + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/mm2s7.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s7" + }, + { + "location": "LIB_DIR/L2/tests/delay/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "delay" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": { + "vitis_aie_sim": 32768, + "vitis_aie_x86sim": 32768, + "vitis_sw_emu": 32768, + "vitis_hw_emu": 32768, + "vitis_hw_build": 40960 + }, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/delay/system.cfg b/ultrasound/L2/tests/delay/system.cfg new file mode 100644 index 0000000000..9f2e78b5c8 --- /dev/null +++ b/ultrasound/L2/tests/delay/system.cfg @@ -0,0 +1,10 @@ +[connectivity] + +stream_connect=mm2s1_1.s:ai_engine_0.image_points_from_PL +stream_connect=mm2s2_1.s:ai_engine_0.image_points_from_PL2 +stream_connect=mm2s3_1.s:ai_engine_0.tx_def_ref_point +stream_connect=mm2s4_1.s:ai_engine_0.tx_def_delay_distance +stream_connect=mm2s5_1.s:ai_engine_0.tx_def_delay_distance2 +stream_connect=mm2s6_1.s:ai_engine_0.tx_def_focal_point +stream_connect=mm2s7_1.s:ai_engine_0.t_start +stream_connect=ai_engine_0.delay_to_PL:s2mm1_1.s diff --git a/ultrasound/L2/tests/delay/utils.mk b/ultrasound/L2/tests/delay/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/delay/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/delay_pw/Makefile b/ultrasound/L2/tests/delay_pw/Makefile new file mode 100644 index 0000000000..c79f8c713a --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/Makefile @@ -0,0 +1,432 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= aarch64 + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := xilinx_vck190_base_202310_1 +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/delay_pw/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/delay_pw/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/delay_pw/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/delay_pw/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin delay_pw.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/delay_pw.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/delay_pw.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/delay_pw_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/delay_pw.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/delay_pw/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/delay_pw.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/delay_pw/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/delay_pw/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/delay_pw/PS_host/host.cpp b/ultrasound/L2/tests/delay_pw/PS_host/host.cpp new file mode 100644 index 0000000000..290098b087 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/PS_host/host.cpp @@ -0,0 +1,325 @@ +/********** +© Copyright 2022 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 3 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int& size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + std::string line; + // for (size = 0; std::getline(infile, line); ++size) + // ; + + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "input file is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Input: image-points + file_set[0] = data_path + "image_points.txt"; // 399 + file_set[1] = data_path + "tx_def_ref_point.txt"; // 104 + file_set[2] = data_path + "t_start.txt"; // 88 + + // input & output mem size + sizeIn[0] = 128; + sizeIn[1] = 4; + sizeIn[2] = 32; + sizeOut[0] = 32; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + b.init(); + + std::cout << "graph run" << std::endl; + b.run(1); + + b.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + // wait for run kernel done + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "delay_to_PL_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + golden_sizeOut[0] = 32; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = golden_buf_mem[k][i]; + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + if (result_tmp != result_golden) err_cnt++; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + ////////////////////////////////////////// + // End + ////////////////////////////////////////// + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} diff --git a/ultrasound/L2/tests/delay_pw/PS_host/host.hpp b/ultrasound/L2/tests/delay_pw/PS_host/host.hpp new file mode 100644 index 0000000000..9370e74e16 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/PS_host/host.hpp @@ -0,0 +1,33 @@ +/********** +© Copyright 2022 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/delay_pw/aie_graph/graph.cpp b/ultrasound/L2/tests/delay_pw/aie_graph/graph.cpp new file mode 100644 index 0000000000..3a09b59b5f --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/aie_graph/graph.cpp @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "delay_pw.hpp" + +class delay_pw : public adf::graph { + public: + // input and output ports + adf::input_plio image_points_from_PL; + adf::input_plio tx_def_reference_point; + adf::input_plio t_start; + adf::output_plio delay_to_PL; + + // delay_pw graph + us::L2::delay_pw_graph<> d; + + delay_pw() { + // input & output plio + image_points_from_PL = + adf::input_plio::create("image_points_from_PL", adf::plio_32_bits, "data/image_points.txt"); + tx_def_reference_point = + adf::input_plio::create("tx_def_reference_point", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + t_start = adf::input_plio::create("t_start", adf::plio_32_bits, "data/t_start.txt"); + delay_to_PL = adf::output_plio::create("delay_to_PL", adf::plio_32_bits, "data/delay_to_PL.txt"); + + adf::connect<>(image_points_from_PL.out[0], d.image_points_from_PL); + adf::connect<>(tx_def_reference_point.out[0], d.tx_def_reference_point); + adf::connect<>(t_start.out[0], d.t_start); + adf::connect<>(d.delay_to_PL, delay_to_PL.in[0]); + } +}; + +delay_pw b; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + b.init(); + + b.run(1); + + b.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/delay_pw/data/delay_to_PL_golden.txt b/ultrasound/L2/tests/delay_pw/data/delay_to_PL_golden.txt new file mode 100644 index 0000000000..463e4ec21a --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/data/delay_to_PL_golden.txt @@ -0,0 +1,32 @@ +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 +-6.001298904e+00 diff --git a/ultrasound/L2/tests/delay_pw/data/image_points.txt b/ultrasound/L2/tests/delay_pw/data/image_points.txt new file mode 100644 index 0000000000..8ade315b57 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/data/image_points.txt @@ -0,0 +1,2048 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/delay_pw/data/t_start.txt b/ultrasound/L2/tests/delay_pw/data/t_start.txt new file mode 100644 index 0000000000..24b7651a8c --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/data/t_start.txt @@ -0,0 +1,1376 @@ +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 diff --git a/ultrasound/L2/tests/delay_pw/data/tx_def_ref_point.txt b/ultrasound/L2/tests/delay_pw/data/tx_def_ref_point.txt new file mode 100644 index 0000000000..9dcfe2f403 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/data/tx_def_ref_point.txt @@ -0,0 +1,1408 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 diff --git a/ultrasound/L2/tests/delay_pw/description.json b/ultrasound/L2/tests/delay_pw/description.json new file mode 100644 index 0000000000..b1d16244b7 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/description.json @@ -0,0 +1,137 @@ +{ + "name": "L2 delay_pw Test", + "description": "delay_pw Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin delay_pw.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/delay_pw.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/delay_pw/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/delay_pw/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/delay_pw/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/delay_pw/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/delay_pw/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/delay_pw/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/delay_pw/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "delay_pw" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/delay_pw/system.cfg b/ultrasound/L2/tests/delay_pw/system.cfg new file mode 100644 index 0000000000..47347fd3c3 --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/system.cfg @@ -0,0 +1,6 @@ +[connectivity] +stream_connect=mm2s1_1.s:ai_engine_0.image_points_from_PL +stream_connect=mm2s2_1.s:ai_engine_0.tx_def_reference_point +stream_connect=mm2s3_1.s:ai_engine_0.t_start +stream_connect=ai_engine_0.delay_to_PL:s2mm1_1.s + diff --git a/ultrasound/L2/tests/delay_pw/utils.mk b/ultrasound/L2/tests/delay_pw/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/delay_pw/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/diffMV/Makefile b/ultrasound/L2/tests/diffMV/Makefile new file mode 100644 index 0000000000..260822d08c --- /dev/null +++ b/ultrasound/L2/tests/diffMV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/diffMV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/diffMV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/diffMV/data/diffMV_golden b/ultrasound/L2/tests/diffMV/data/diffMV_golden new file mode 100644 index 0000000000..c012b18584 --- /dev/null +++ b/ultrasound/L2/tests/diffMV/data/diffMV_golden @@ -0,0 +1,128 @@ +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/diffMV/data/input1.txt b/ultrasound/L2/tests/diffMV/data/input1.txt new file mode 100644 index 0000000000..5878299dd0 --- /dev/null +++ b/ultrasound/L2/tests/diffMV/data/input1.txt @@ -0,0 +1,1024 @@ +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 \ No newline at end of file diff --git a/ultrasound/L2/tests/diffMV/data/input2.txt b/ultrasound/L2/tests/diffMV/data/input2.txt new file mode 100644 index 0000000000..5878299dd0 --- /dev/null +++ b/ultrasound/L2/tests/diffMV/data/input2.txt @@ -0,0 +1,1024 @@ +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 \ No newline at end of file diff --git a/ultrasound/L2/tests/diffMV/description.json b/ultrasound/L2/tests/diffMV/description.json new file mode 100644 index 0000000000..3ddd0b0c4d --- /dev/null +++ b/ultrasound/L2/tests/diffMV/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 diffMV Test", + "description": "diffMV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/diffMV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/diffMV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/diffMV/test.cpp b/ultrasound/L2/tests/diffMV/test.cpp new file mode 100644 index 0000000000..350a1960e4 --- /dev/null +++ b/ultrasound/L2/tests/diffMV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::diffMV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/diffMV/test.hpp b/ultrasound/L2/tests/diffMV/test.hpp new file mode 100644 index 0000000000..c1f28c9941 --- /dev/null +++ b/ultrasound/L2/tests/diffMV/test.hpp @@ -0,0 +1,62 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +class diffMV : public adf::graph { + public: + adf::input_plio input1_diffMV; + adf::input_plio input2_diffMV; + adf::output_plio output_diffMV; + + diffMV() { + + // input and output port + input1_diffMV = adf::input_plio::create("input1_diffMV", adf::plio_32_bits, "data/input1.txt"); + input2_diffMV = adf::input_plio::create("input2_diffMV", adf::plio_32_bits, "data/input2.txt"); + output_diffMV = adf::output_plio::create("output_diffMV", adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + diffMVKernel = adf::kernel::create(L1::diffMV); + adf::source(diffMVKernel) = "diffMV/diffMV.cpp"; + + // connections + adf::connect(input1_diffMV.out[0], diffMVKernel.in[0]); + adf::connect(input2_diffMV.out[0], diffMVKernel.in[1]); + adf::connect(diffMVKernel.out[0], output_diffMV.in[0]); + + // Setting kernel ratio + adf::runtime(diffMVKernel) = KERNEL_RATIO; + + // Setting FIFO depth + adf::dimensions(diffMVKernel.in[0]) = {1024}; + adf::dimensions(diffMVKernel.in[1]) = {1024}; + adf::dimensions(diffMVKernel.out[0]) = {128}; + } + + + + private: + // Kernel declaration + adf::kernel diffMVKernel; +}; +} // namespace L2 +} // namespace us \ No newline at end of file diff --git a/ultrasound/L2/tests/diffMV/utils.mk b/ultrasound/L2/tests/diffMV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/diffMV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/diffSV/Makefile b/ultrasound/L2/tests/diffSV/Makefile new file mode 100644 index 0000000000..2cb233a9d2 --- /dev/null +++ b/ultrasound/L2/tests/diffSV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/diffSV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/diffSV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/diffSV/data/diffSV_golden b/ultrasound/L2/tests/diffSV/data/diffSV_golden new file mode 100644 index 0000000000..c012b18584 --- /dev/null +++ b/ultrasound/L2/tests/diffSV/data/diffSV_golden @@ -0,0 +1,128 @@ +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/diffSV/data/input1.txt b/ultrasound/L2/tests/diffSV/data/input1.txt new file mode 100644 index 0000000000..a0f9f601be --- /dev/null +++ b/ultrasound/L2/tests/diffSV/data/input1.txt @@ -0,0 +1,256 @@ +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 +3.141592654 \ No newline at end of file diff --git a/ultrasound/L2/tests/diffSV/description.json b/ultrasound/L2/tests/diffSV/description.json new file mode 100644 index 0000000000..47fd9a4459 --- /dev/null +++ b/ultrasound/L2/tests/diffSV/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 diffSV Test", + "description": "diffSV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/diffSV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/diffSV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/diffSV/test.cpp b/ultrasound/L2/tests/diffSV/test.cpp new file mode 100644 index 0000000000..7a334c65f5 --- /dev/null +++ b/ultrasound/L2/tests/diffSV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::diffSV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/diffSV/test.hpp b/ultrasound/L2/tests/diffSV/test.hpp new file mode 100644 index 0000000000..0144dd2a5e --- /dev/null +++ b/ultrasound/L2/tests/diffSV/test.hpp @@ -0,0 +1,61 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +class diffSV : public adf::graph { + public: + diffSV() { + // Kernel definition + diffSVKernel = adf::kernel::create(L1::diffSV); + + // input and output port + input1_diffSV = adf::input_plio::create("input1_diffSV", adf::plio_32_bits, "data/input1.txt"); + input2_diffSV = adf::input_plio::create("input2_diffSV", adf::plio_32_bits, "data/input1.txt"); + output_diffSV = adf::output_plio::create("output_diffSV", adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_diffSV.out[0], diffSVKernel.in[0]); + adf::connect(input2_diffSV.out[0], diffSVKernel.in[1]); + adf::connect(diffSVKernel.out[0], output_diffSV.in[0]); + + // source kernel + adf::source(diffSVKernel) = "diffSV/diffSV.cpp"; + + // Setting kernel ratio + adf::runtime(diffSVKernel) = KERNEL_RATIO; + + // Setting FIFO depth + adf::dimensions(diffSVKernel.in[0]) = {256}; + adf::dimensions(diffSVKernel.in[1]) = {256}; + adf::dimensions(diffSVKernel.out[0]) = {128}; + } + + adf::input_plio input1_diffSV; + adf::input_plio input2_diffSV; + adf::output_plio output_diffSV; + + private: + // Kernel declaration + adf::kernel diffSVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/diffSV/utils.mk b/ultrasound/L2/tests/diffSV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/diffSV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/diffVS/Makefile b/ultrasound/L2/tests/diffVS/Makefile new file mode 100644 index 0000000000..52a81bc24f --- /dev/null +++ b/ultrasound/L2/tests/diffVS/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/diffVS/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/diffVS/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/diffVS/data/diffVS_golden b/ultrasound/L2/tests/diffVS/data/diffVS_golden new file mode 100644 index 0000000000..c012b18584 --- /dev/null +++ b/ultrasound/L2/tests/diffVS/data/diffVS_golden @@ -0,0 +1,128 @@ +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/diffVS/data/input1.txt b/ultrasound/L2/tests/diffVS/data/input1.txt new file mode 100644 index 0000000000..a0e05797df --- /dev/null +++ b/ultrasound/L2/tests/diffVS/data/input1.txt @@ -0,0 +1,256 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 \ No newline at end of file diff --git a/ultrasound/L2/tests/diffVS/data/input2.txt b/ultrasound/L2/tests/diffVS/data/input2.txt new file mode 100644 index 0000000000..ef529012e5 --- /dev/null +++ b/ultrasound/L2/tests/diffVS/data/input2.txt @@ -0,0 +1,4 @@ +1 +1 +1 +1 \ No newline at end of file diff --git a/ultrasound/L2/tests/diffVS/description.json b/ultrasound/L2/tests/diffVS/description.json new file mode 100644 index 0000000000..281e5bbe4a --- /dev/null +++ b/ultrasound/L2/tests/diffVS/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 diffVS Test", + "description": "diffVS Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/diffVS/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/diffVS/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/diffVS/test.cpp b/ultrasound/L2/tests/diffVS/test.cpp new file mode 100644 index 0000000000..77f3d37559 --- /dev/null +++ b/ultrasound/L2/tests/diffVS/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::diffVS g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/diffVS/test.hpp b/ultrasound/L2/tests/diffVS/test.hpp new file mode 100644 index 0000000000..a16cd40842 --- /dev/null +++ b/ultrasound/L2/tests/diffVS/test.hpp @@ -0,0 +1,61 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +class diffVS : public adf::graph { + public: + diffVS() { + // Kernel definition + diffVSKernel = adf::kernel::create(L1::diffVS); + + // input and output port + input1_diffVS = adf::input_plio::create("input1_diffVS", adf::plio_32_bits, "data/input1.txt"); + input2_diffVS = adf::input_plio::create("input2_diffVS", adf::plio_32_bits, "data/input2.txt"); + output_diffVS = adf::output_plio::create("output_diffVS", adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_diffVS.out[0], diffVSKernel.in[0]); + adf::connect(input2_diffVS.out[0], diffVSKernel.in[1]); + adf::connect(diffVSKernel.out[0], output_diffVS.in[0]); + + // source kernel + adf::source(diffVSKernel) = "diffVS/diffVS.cpp"; + + // Setting kernel ratio + adf::runtime(diffVSKernel) = KERNEL_RATIO; + + // Setting FIFO depth + adf::dimensions(diffVSKernel.in[0]) = {256}; + adf::dimensions(diffVSKernel.in[1]) = {4}; + adf::dimensions(diffVSKernel.out[0]) = {128}; + } + + adf::input_plio input1_diffVS; + adf::input_plio input2_diffVS; + adf::output_plio output_diffVS; + + private: + // Kernel declaration + adf::kernel diffVSKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/diffVS/utils.mk b/ultrasound/L2/tests/diffVS/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/diffVS/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/divVS/Makefile b/ultrasound/L2/tests/divVS/Makefile new file mode 100644 index 0000000000..b0fd316260 --- /dev/null +++ b/ultrasound/L2/tests/divVS/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/divVS/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/divVS/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/divVS/data/divVS_golden b/ultrasound/L2/tests/divVS/data/divVS_golden new file mode 100644 index 0000000000..f9dcfad60e --- /dev/null +++ b/ultrasound/L2/tests/divVS/data/divVS_golden @@ -0,0 +1,128 @@ +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +6.493506371e-04 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/divVS/data/input1.txt b/ultrasound/L2/tests/divVS/data/input1.txt new file mode 100644 index 0000000000..a0e05797df --- /dev/null +++ b/ultrasound/L2/tests/divVS/data/input1.txt @@ -0,0 +1,256 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 \ No newline at end of file diff --git a/ultrasound/L2/tests/divVS/description.json b/ultrasound/L2/tests/divVS/description.json new file mode 100644 index 0000000000..9ed08f20a6 --- /dev/null +++ b/ultrasound/L2/tests/divVS/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 divVS Test", + "description": "divVS Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/divVS/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/divVS/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/divVS/test.cpp b/ultrasound/L2/tests/divVS/test.cpp new file mode 100644 index 0000000000..91b71e6ccd --- /dev/null +++ b/ultrasound/L2/tests/divVS/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::divVS g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/divVS/test.hpp b/ultrasound/L2/tests/divVS/test.hpp new file mode 100644 index 0000000000..24997edb33 --- /dev/null +++ b/ultrasound/L2/tests/divVS/test.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +namespace us { +namespace L2 { + +template +class divVS : public adf::graph { + public: + adf::input_plio input1_divVS; + adf::output_plio output_divVS; + + divVS() { + // input and output port + input1_divVS = adf::input_plio::create("input1_divVS", adf::plio_32_bits, "data/input1.txt"); + output_divVS = adf::output_plio::create("output_divVS", adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + divVSKernel = adf::kernel::create(L1::divVSSpeedOfSound); + adf::source(divVSKernel) = "divVS/divVS.cpp"; + + // connections + adf::connect(input1_divVS.out[0], divVSKernel.in[0]); + adf::connect(divVSKernel.out[0], output_divVS.in[0]); + + // Setting kernel ratio + adf::runtime(divVSKernel) = KERNEL_RATIO; + adf::dimensions(divVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(divVSKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + adf::kernel divVSKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/divVS/utils.mk b/ultrasound/L2/tests/divVS/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/divVS/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/equalS/Makefile b/ultrasound/L2/tests/equalS/Makefile new file mode 100644 index 0000000000..804b27ccf7 --- /dev/null +++ b/ultrasound/L2/tests/equalS/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/equalS/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/equalS/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/equalS/data/equalS_golden b/ultrasound/L2/tests/equalS/data/equalS_golden new file mode 100644 index 0000000000..1829e44825 --- /dev/null +++ b/ultrasound/L2/tests/equalS/data/equalS_golden @@ -0,0 +1,32 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 diff --git a/ultrasound/L2/tests/equalS/data/input1.txt b/ultrasound/L2/tests/equalS/data/input1.txt new file mode 100644 index 0000000000..a0e05797df --- /dev/null +++ b/ultrasound/L2/tests/equalS/data/input1.txt @@ -0,0 +1,256 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 \ No newline at end of file diff --git a/ultrasound/L2/tests/equalS/description.json b/ultrasound/L2/tests/equalS/description.json new file mode 100644 index 0000000000..2d93950497 --- /dev/null +++ b/ultrasound/L2/tests/equalS/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 equalS Test", + "description": "equalS Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/equalS/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/equalS/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/equalS/test.cpp b/ultrasound/L2/tests/equalS/test.cpp new file mode 100644 index 0000000000..2343dcded5 --- /dev/null +++ b/ultrasound/L2/tests/equalS/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::equalS g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/equalS/test.hpp b/ultrasound/L2/tests/equalS/test.hpp new file mode 100644 index 0000000000..9e176aed65 --- /dev/null +++ b/ultrasound/L2/tests/equalS/test.hpp @@ -0,0 +1,60 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class equalS : public adf::graph { + public: + // Input and output ports + adf::input_plio input_equalS; + adf::output_plio output_equalS; + + equalS() { + // Kernel definition + equalSKernel = adf::kernel::create(L1::equalS); + + // input and output port + input_equalS = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + output_equalS = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input_equalS.out[0], equalSKernel.in[0]); + adf::connect(equalSKernel.out[0], output_equalS.in[0]); + + // source kernel + adf::source(equalSKernel) = "equalS/equalS.cpp"; + + // Setting kernel ratio + adf::runtime(equalSKernel) = KERNEL_RATIO; + + // Config + adf::dimensions(equalSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(equalSKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel equalSKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/equalS/utils.mk b/ultrasound/L2/tests/equalS/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/equalS/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/focusing/Makefile b/ultrasound/L2/tests/focusing/Makefile new file mode 100644 index 0000000000..8d856f4294 --- /dev/null +++ b/ultrasound/L2/tests/focusing/Makefile @@ -0,0 +1,439 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= aarch64 + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := xilinx_vck190_base_202310_1 +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/focusing/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/focusing/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/focusing/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/focusing/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin focusing.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/focusing.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/focusing.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/focusing_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/focusing.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/focusing/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/focusing.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L2/tests/focusing/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/focusing/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/focusing/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/focusing/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/focusing/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/focusing/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/focusing/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing/PL_kernels/mm2s4.cpp b/ultrasound/L2/tests/focusing/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L2/tests/focusing/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/focusing/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/focusing/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/focusing/PS_host/host.cpp b/ultrasound/L2/tests/focusing/PS_host/host.cpp new file mode 100644 index 0000000000..ce02d935bc --- /dev/null +++ b/ultrasound/L2/tests/focusing/PS_host/host.cpp @@ -0,0 +1,324 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 4 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "input file is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Input: image-points + file_set[0] = data_path + "apo_ref_0.txt"; + file_set[1] = data_path + "xdc_def_0.txt"; + file_set[2] = data_path + "apo_ref_1.txt"; + file_set[3] = data_path + "xdc_def_1.txt"; + + // mem data output length define + sizeIn[0] = 32; + sizeIn[1] = 32; + sizeIn[2] = 32; + sizeIn[3] = 32; + sizeOut[0] = 32; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + b.init(); + + std::cout << "graph run" << std::endl; + b.run(1); + + b.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "focusing_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = (float)golden_buf_mem[k][i]; + if (result_tmp != result_golden) { + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + err_cnt++; + } + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + ////////////////////////////////////////// + // End + ////////////////////////////////////////// + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing/PS_host/host.hpp b/ultrasound/L2/tests/focusing/PS_host/host.hpp new file mode 100644 index 0000000000..8ff813672f --- /dev/null +++ b/ultrasound/L2/tests/focusing/PS_host/host.hpp @@ -0,0 +1,36 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/focusing/aie_graph/graph.cpp b/ultrasound/L2/tests/focusing/aie_graph/graph.cpp new file mode 100644 index 0000000000..1a796731af --- /dev/null +++ b/ultrasound/L2/tests/focusing/aie_graph/graph.cpp @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "focusing.hpp" + +class focusing : public adf::graph { + public: + // input and output port + adf::input_plio apo_ref_0; + adf::input_plio xdc_def_0; + adf::input_plio apo_ref_1; + adf::input_plio xdc_def_1; + adf::output_plio focusing_output; + + // focusing graph + us::L2::focusing_graph<> foc; + + focusing() { + // INPUTS + apo_ref_0 = adf::input_plio::create("apo_ref_0", adf::plio_32_bits, "data/apo_ref_0.txt"); + xdc_def_0 = adf::input_plio::create("xdc_def_0", adf::plio_32_bits, "data/xdc_def_0.txt"); + apo_ref_1 = adf::input_plio::create("apo_ref_1", adf::plio_32_bits, "data/apo_ref_1.txt"); + xdc_def_1 = adf::input_plio::create("xdc_def_1", adf::plio_32_bits, "data/xdc_def_1.txt"); + + // OUTPUTS + focusing_output = adf::output_plio::create("focusing_output", adf::plio_32_bits, "data/focusing_output.txt"); + + // connections + adf::connect<>(apo_ref_0.out[0], foc.apo_ref_0); + adf::connect<>(xdc_def_0.out[0], foc.xdc_def_0); + adf::connect<>(apo_ref_1.out[0], foc.apo_ref_1); + adf::connect<>(xdc_def_1.out[0], foc.xdc_def_1); + adf::connect<>(foc.focusing_output, focusing_output.in[0]); + } +}; + +focusing b; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + b.init(); + + b.run(1); + + b.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/focusing/data/apo_ref_0.txt b/ultrasound/L2/tests/focusing/data/apo_ref_0.txt new file mode 100644 index 0000000000..3e33d22b8f --- /dev/null +++ b/ultrasound/L2/tests/focusing/data/apo_ref_0.txt @@ -0,0 +1,256 @@ +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing/data/apo_ref_1.txt b/ultrasound/L2/tests/focusing/data/apo_ref_1.txt new file mode 100644 index 0000000000..5aacccfcad --- /dev/null +++ b/ultrasound/L2/tests/focusing/data/apo_ref_1.txt @@ -0,0 +1,256 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing/data/focusing_golden.txt b/ultrasound/L2/tests/focusing/data/focusing_golden.txt new file mode 100644 index 0000000000..c8402ddf3a --- /dev/null +++ b/ultrasound/L2/tests/focusing/data/focusing_golden.txt @@ -0,0 +1,32 @@ +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 diff --git a/ultrasound/L2/tests/focusing/data/xdc_def_0.txt b/ultrasound/L2/tests/focusing/data/xdc_def_0.txt new file mode 100644 index 0000000000..492a69e086 --- /dev/null +++ b/ultrasound/L2/tests/focusing/data/xdc_def_0.txt @@ -0,0 +1,256 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing/data/xdc_def_1.txt b/ultrasound/L2/tests/focusing/data/xdc_def_1.txt new file mode 100644 index 0000000000..5aacccfcad --- /dev/null +++ b/ultrasound/L2/tests/focusing/data/xdc_def_1.txt @@ -0,0 +1,256 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing/description.json b/ultrasound/L2/tests/focusing/description.json new file mode 100644 index 0000000000..18acdbb38c --- /dev/null +++ b/ultrasound/L2/tests/focusing/description.json @@ -0,0 +1,143 @@ +{ + "name": "L2 focusing Test", + "description": "focusing Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin focusing.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/focusing.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/focusing/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/focusing/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/focusing/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/focusing/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/focusing/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/focusing/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/focusing/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L2/tests/focusing/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "focusing" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing/system.cfg b/ultrasound/L2/tests/focusing/system.cfg new file mode 100644 index 0000000000..a7187805a6 --- /dev/null +++ b/ultrasound/L2/tests/focusing/system.cfg @@ -0,0 +1,8 @@ +[connectivity] + +stream_connect=mm2s1_1.s:ai_engine_0.apo_ref_0 +stream_connect=mm2s2_1.s:ai_engine_0.xdc_def_0 +stream_connect=mm2s3_1.s:ai_engine_0.apo_ref_1 +stream_connect=mm2s4_1.s:ai_engine_0.xdc_def_1 +stream_connect=ai_engine_0.focusing_output:s2mm1_1.s + diff --git a/ultrasound/L2/tests/focusing/utils.mk b/ultrasound/L2/tests/focusing/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/focusing/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/focusing_sa/Makefile b/ultrasound/L2/tests/focusing_sa/Makefile new file mode 100644 index 0000000000..37bddbff71 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/Makefile @@ -0,0 +1,439 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/focusing_sa/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/focusing_sa/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/focusing_sa/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/focusing_sa/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin focusing_sa.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/focusing_sa.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/focusing_sa.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/focusing_sa_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/focusing_sa.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/focusing_sa/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/focusing_sa.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s4.cpp b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/focusing_sa/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/focusing_sa/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/focusing_sa/PS_host/host.cpp b/ultrasound/L2/tests/focusing_sa/PS_host/host.cpp new file mode 100644 index 0000000000..6e2bf6d14c --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/PS_host/host.cpp @@ -0,0 +1,338 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include +#include + +#include "graph.cpp" +#include "host.hpp" + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +// aie +#define LENGTH 32 +#define SPACE_DIMENSION 4 + +// +#define INPUT_SIZE_VECTOR 256 +#define INPUT_SIZE_MATRIX INPUT_SIZE_VECTOR* SPACE_DIMENSION +#define OUTPUT_SIZE INPUT_SIZE_VECTOR + +//#define INPUT_SIZE_DISTANCES INPUT_SIZE_VECTOR +#define INPUT_SIZE_DISTANCES (INPUT_SIZE_VECTOR / LENGTH) * SPACE_DIMENSION + +#define INPUT_RANGE 4 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int& size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "direction input is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[4]; + int sizeOut[1]; + float* buf_mem[4]; + std::string file_set[4]; + + // Input: image-points + file_set[0] = data_path + "apo_ref_0.txt"; + file_set[1] = data_path + "xdc_def_0.txt"; + file_set[2] = data_path + "apo_ref_1.txt"; + file_set[3] = data_path + "xdc_def_1.txt"; + + sizeIn[0] = 32; + sizeIn[1] = 32; + sizeIn[2] = 32; + sizeIn[3] = 32; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + // mem data output length define + sizeOut[0] = 32; // focusing_sa + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[1]; + float* out_bomapped_set[1]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[4]; + xrtRunHandle mm2s_rhdl_set[4]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[6]; + xrtRunHandle s2mm_rhdl_set[6]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + b.init(); + + b.run(1); + std::cout << "graph run" << std::endl; + + b.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + // wait for run kernel done + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + ////////////////////////////////////////// + // wait for s2mm done + ////////////////////////////////////////// + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "focusing_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + + golden_sizeOut[0] = 32; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = golden_buf_mem[k][i]; + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + if (result_tmp != result_golden) err_cnt++; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + // End + if (!err_cnt) + printf("Test Pass\n"); + else + printf("Test Fail\n"); + + return 0; +} diff --git a/ultrasound/L2/tests/focusing_sa/PS_host/host.hpp b/ultrasound/L2/tests/focusing_sa/PS_host/host.hpp new file mode 100644 index 0000000000..8ff813672f --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/PS_host/host.hpp @@ -0,0 +1,36 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/focusing_sa/aie_graph/graph.cpp b/ultrasound/L2/tests/focusing_sa/aie_graph/graph.cpp new file mode 100644 index 0000000000..8faeb8ab30 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/aie_graph/graph.cpp @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "focusing_sa.hpp" + +class focusing_sa : public adf::graph { + public: + // input and output port + adf::input_plio apo_ref_0; + adf::input_plio img_points_0; + adf::input_plio apo_ref_1; + adf::input_plio img_points_1; + adf::output_plio focusing_output; + + us::L2::focusing_sa_graph<> b; + + focusing_sa() { + // input & output io + apo_ref_0 = adf::input_plio::create("apo_ref_0", adf::plio_32_bits, "data/apo_ref_0.txt"); + img_points_0 = adf::input_plio::create("img_points_0", adf::plio_32_bits, "data/xdc_def_0.txt"); + apo_ref_1 = adf::input_plio::create("apo_ref_1", adf::plio_32_bits, "data/apo_ref_1.txt"); + img_points_1 = adf::input_plio::create("img_points_1", adf::plio_32_bits, "data/xdc_def_1.txt"); + focusing_output = adf::output_plio::create("focusing_output", adf::plio_32_bits, "data/focusing_output.txt"); + + // connections + adf::connect<> input_apo_0(apo_ref_0.out[0], b.apo_ref_0); + adf::connect<> input_xdc_0(img_points_0.out[0], b.img_points_0); + adf::connect<> input_apo_1(apo_ref_1.out[0], b.apo_ref_1); + adf::connect<> input_xdc_1(img_points_1.out[0], b.img_points_1); + adf::connect<> output_vector(b.focusing_output, focusing_output.in[0]); + } +}; + +focusing_sa b; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + b.init(); + + b.run(1); + + b.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/focusing_sa/data/apo_ref_0.txt b/ultrasound/L2/tests/focusing_sa/data/apo_ref_0.txt new file mode 100644 index 0000000000..3e33d22b8f --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/data/apo_ref_0.txt @@ -0,0 +1,256 @@ +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing_sa/data/apo_ref_1.txt b/ultrasound/L2/tests/focusing_sa/data/apo_ref_1.txt new file mode 100644 index 0000000000..5aacccfcad --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/data/apo_ref_1.txt @@ -0,0 +1,256 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing_sa/data/focusing_golden.txt b/ultrasound/L2/tests/focusing_sa/data/focusing_golden.txt new file mode 100644 index 0000000000..c8402ddf3a --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/data/focusing_golden.txt @@ -0,0 +1,32 @@ +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 diff --git a/ultrasound/L2/tests/focusing_sa/data/xdc_def_0.txt b/ultrasound/L2/tests/focusing_sa/data/xdc_def_0.txt new file mode 100644 index 0000000000..492a69e086 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/data/xdc_def_0.txt @@ -0,0 +1,256 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing_sa/data/xdc_def_1.txt b/ultrasound/L2/tests/focusing_sa/data/xdc_def_1.txt new file mode 100644 index 0000000000..5aacccfcad --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/data/xdc_def_1.txt @@ -0,0 +1,256 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing_sa/description.json b/ultrasound/L2/tests/focusing_sa/description.json new file mode 100644 index 0000000000..a349806e54 --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/description.json @@ -0,0 +1,143 @@ +{ + "name": "L2 focusing_sa Test", + "description": "focusing_sa Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin focusing_sa.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/focusing_sa.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/focusing_sa/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/focusing_sa/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/focusing_sa/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/focusing_sa/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/focusing_sa/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/focusing_sa/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/focusing_sa/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L2/tests/focusing_sa/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "focusing_sa" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/focusing_sa/system.cfg b/ultrasound/L2/tests/focusing_sa/system.cfg new file mode 100644 index 0000000000..3588a74dda --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/system.cfg @@ -0,0 +1,8 @@ +[connectivity] + +stream_connect=mm2s1_1.s:ai_engine_0.apo_ref_0 +stream_connect=mm2s2_1.s:ai_engine_0.img_points_0 +stream_connect=mm2s3_1.s:ai_engine_0.apo_ref_1 +stream_connect=mm2s4_1.s:ai_engine_0.img_points_1 +stream_connect=ai_engine_0.focusing_output:s2mm1_1.s + diff --git a/ultrasound/L2/tests/focusing_sa/utils.mk b/ultrasound/L2/tests/focusing_sa/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/focusing_sa/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/image-points/Makefile b/ultrasound/L2/tests/image-points/Makefile new file mode 100644 index 0000000000..7e0efb64c1 --- /dev/null +++ b/ultrasound/L2/tests/image-points/Makefile @@ -0,0 +1,432 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/image-points/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/image-points/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/image-points/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/image-points/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin image-points.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/image-points.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/image-points.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/image-points_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/image-points.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/image-points/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/image-points.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L2/tests/image-points/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/image-points/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/image-points/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/image-points/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/image-points/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/image-points/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/image-points/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/image-points/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/image-points/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/image-points/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/image-points/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/image-points/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/image-points/PS_host/host.cpp b/ultrasound/L2/tests/image-points/PS_host/host.cpp new file mode 100644 index 0000000000..298f23cd5d --- /dev/null +++ b/ultrasound/L2/tests/image-points/PS_host/host.cpp @@ -0,0 +1,321 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 3 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "input file is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Input: image-points + file_set[0] = data_path + "start_positions.txt"; + file_set[1] = data_path + "directions.txt"; + file_set[2] = data_path + "samples_arange.txt"; + + // mem size + sizeIn[0] = 4; // start_positions + sizeIn[1] = 4; // directions + sizeIn[2] = 32; // samples_arrange + sizeOut[0] = 128; // image_points + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + d.init(); + + std::cout << "graph run" << std::endl; + d.run(1); + + d.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "image_points_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + golden_sizeOut[0] = 128; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = golden_buf_mem[k][i]; + if (result_tmp != result_golden) { + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + err_cnt++; + } + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + ////////////////////////////////////////// + // End + ////////////////////////////////////////// + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} \ No newline at end of file diff --git a/ultrasound/L2/tests/image-points/PS_host/host.hpp b/ultrasound/L2/tests/image-points/PS_host/host.hpp new file mode 100644 index 0000000000..e3f25f1d23 --- /dev/null +++ b/ultrasound/L2/tests/image-points/PS_host/host.hpp @@ -0,0 +1,33 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/image-points/aie_graph/graph.cpp b/ultrasound/L2/tests/image-points/aie_graph/graph.cpp new file mode 100644 index 0000000000..19a76450a6 --- /dev/null +++ b/ultrasound/L2/tests/image-points/aie_graph/graph.cpp @@ -0,0 +1,55 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "imagePoints.hpp" + +class imagePoints : public adf::graph { + public: + // input and output port + adf::input_plio start_positions; + adf::input_plio samples_arange; + adf::input_plio directions; + adf::output_plio image_points; + + us::L2::imagePoints_graph<> img; + + imagePoints() { + // input & output + start_positions = adf::input_plio::create("start_positions", adf::plio_32_bits, "data/start_positions.txt"); + samples_arange = adf::input_plio::create("samples_arange", adf::plio_32_bits, "data/samples_arange.txt"); + directions = adf::input_plio::create("directions", adf::plio_32_bits, "data/directions.txt"); + image_points = adf::output_plio::create("image_points", adf::plio_32_bits, "data/image_points.txt"); + + adf::connect<>(start_positions.out[0], img.start_positions); + adf::connect<>(samples_arange.out[0], img.samples_arange); + adf::connect<>(directions.out[0], img.directions); + adf::connect<>(img.image_points, image_points.in[0]); + } +}; + +imagePoints d; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + d.init(); + + d.run(1); + + d.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/image-points/data/directions.txt b/ultrasound/L2/tests/image-points/data/directions.txt new file mode 100644 index 0000000000..8ade315b57 --- /dev/null +++ b/ultrasound/L2/tests/image-points/data/directions.txt @@ -0,0 +1,2048 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/image-points/data/image_points_golden.txt b/ultrasound/L2/tests/image-points/data/image_points_golden.txt new file mode 100644 index 0000000000..78c39f01e9 --- /dev/null +++ b/ultrasound/L2/tests/image-points/data/image_points_golden.txt @@ -0,0 +1,128 @@ +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 diff --git a/ultrasound/L2/tests/image-points/data/samples_arange.txt b/ultrasound/L2/tests/image-points/data/samples_arange.txt new file mode 100644 index 0000000000..8ade315b57 --- /dev/null +++ b/ultrasound/L2/tests/image-points/data/samples_arange.txt @@ -0,0 +1,2048 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/image-points/data/start_positions.txt b/ultrasound/L2/tests/image-points/data/start_positions.txt new file mode 100644 index 0000000000..8ade315b57 --- /dev/null +++ b/ultrasound/L2/tests/image-points/data/start_positions.txt @@ -0,0 +1,2048 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/image-points/description.json b/ultrasound/L2/tests/image-points/description.json new file mode 100644 index 0000000000..26aee5f07f --- /dev/null +++ b/ultrasound/L2/tests/image-points/description.json @@ -0,0 +1,149 @@ +{ + "name": "L2 image-points Test", + "description": "image-points Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin image-points.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/image-points.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/image-points/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/image-points/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/image-points/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/image-points/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/image-points/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/image-points/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/image-points/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "image-points" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": { + "vitis_aie_sim": 32768, + "vitis_aie_x86sim": 32768, + "vitis_sw_emu": 32768, + "vitis_hw_emu": 32768, + "vitis_hw_build": 40960 + }, + "max_time_min": { + "vitis_aie_sim": 600, + "vitis_aie_x86sim": 300, + "vitis_sw_emu": 300, + "vitis_hw_emu": 300, + "vitis_hw_build": 300 + } + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/image-points/system.cfg b/ultrasound/L2/tests/image-points/system.cfg new file mode 100644 index 0000000000..e3a56314c6 --- /dev/null +++ b/ultrasound/L2/tests/image-points/system.cfg @@ -0,0 +1,5 @@ +[connectivity] +stream_connect=mm2s1_1.s:ai_engine_0.start_positions +stream_connect=mm2s2_1.s:ai_engine_0.directions +stream_connect=mm2s3_1.s:ai_engine_0.samples_arange +stream_connect=ai_engine_0.image_points:s2mm1_1.s \ No newline at end of file diff --git a/ultrasound/L2/tests/image-points/utils.mk b/ultrasound/L2/tests/image-points/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/image-points/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/interpolator/Makefile b/ultrasound/L2/tests/interpolator/Makefile new file mode 100644 index 0000000000..70d69e2c8c --- /dev/null +++ b/ultrasound/L2/tests/interpolator/Makefile @@ -0,0 +1,453 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= aarch64 + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := xilinx_vck190_base_202310_1 +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/interpolator/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/interpolator/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/interpolator/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/interpolator/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin interpolator.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/interpolator.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_mm2s5 += +VPP_FLAGS_mm2s5 += --hls.clock 100000000:mm2s5 +VPP_FLAGS_mm2s6 += +VPP_FLAGS_mm2s6 += --hls.clock 100000000:mm2s6 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/interpolator.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/interpolator_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/interpolator.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/interpolator/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/interpolator.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L2/tests/interpolator/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/interpolator/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/interpolator/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/interpolator/PL_kernels/mm2s4.cpp b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/interpolator/PL_kernels/mm2s5.cpp b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s5.cpp new file mode 100644 index 0000000000..583828c713 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/interpolator/PL_kernels/mm2s6.cpp b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s6.cpp new file mode 100644 index 0000000000..172d9d16b5 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PL_kernels/mm2s6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/interpolator/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/interpolator/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/interpolator/PS_host/host.cpp b/ultrasound/L2/tests/interpolator/PS_host/host.cpp new file mode 100644 index 0000000000..ce9e9cb25d --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PS_host/host.cpp @@ -0,0 +1,328 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 6 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int& size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + std::string line; + // for (size = 0; std::getline(infile, line); ++size) + // ; + + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "input file is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Input: image-points + file_set[0] = data_path + "P0.txt"; + file_set[1] = data_path + "P0.txt"; + file_set[2] = data_path + "P0.txt"; + file_set[3] = data_path + "P0.txt"; + file_set[4] = data_path + "P0.txt"; + file_set[5] = data_path + "P0.txt"; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + sizeIn[i] = 128; + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + // mem outputSize define + sizeOut[0] = 128; // c + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + + std::cout << "graph init" << std::endl; + b.init(); + + std::cout << "graph run" << std::endl; + b.run(1); + + b.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "C.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + golden_sizeOut[0] = 128; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = golden_buf_mem[k][i]; + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + if (result_tmp != result_golden) err_cnt++; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + ////////////////////////////////////////// + // End + ////////////////////////////////////////// + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} diff --git a/ultrasound/L2/tests/interpolator/PS_host/host.hpp b/ultrasound/L2/tests/interpolator/PS_host/host.hpp new file mode 100644 index 0000000000..8ff813672f --- /dev/null +++ b/ultrasound/L2/tests/interpolator/PS_host/host.hpp @@ -0,0 +1,36 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/interpolator/aie_graph/graph.cpp b/ultrasound/L2/tests/interpolator/aie_graph/graph.cpp new file mode 100644 index 0000000000..c6d5bf2171 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/aie_graph/graph.cpp @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "bSpline.hpp" + +class bSpline : public adf::graph { + public: + // interpolator + adf::input_plio P1; + adf::input_plio P2; + adf::input_plio P3; + adf::input_plio P4; + adf::input_plio P5; + adf::input_plio P6; + adf::output_plio C; + + us::L2::bSpline_graph<> inter; + + bSpline() { + // INPUTS + // interpolation + P1 = adf::input_plio::create("P1", adf::plio_32_bits, "data/P0.txt"); + P2 = adf::input_plio::create("P2", adf::plio_32_bits, "data/P0.txt"); + P3 = adf::input_plio::create("P3", adf::plio_32_bits, "data/P0.txt"); + P4 = adf::input_plio::create("P4", adf::plio_32_bits, "data/P0.txt"); + P5 = adf::input_plio::create("P5", adf::plio_32_bits, "data/P0.txt"); + P6 = adf::input_plio::create("P6", adf::plio_32_bits, "data/P0.txt"); + C = adf::output_plio::create("C", adf::plio_32_bits, "data/C.txt"); + + ///////////// CONNECTIONS ///////////////////////////////////////////////////////////////////////////////////// + adf::connect<>(P1.out[0], inter.P1); + adf::connect<>(P2.out[0], inter.P2); + adf::connect<>(P3.out[0], inter.P3); + adf::connect<>(P4.out[0], inter.P4); + adf::connect<>(P5.out[0], inter.P5); + adf::connect<>(P6.out[0], inter.P6); + adf::connect<>(inter.C, C.in[0]); + } +}; + +bSpline b; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + b.init(); + + b.run(1); + + b.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/interpolator/data/C.txt b/ultrasound/L2/tests/interpolator/data/C.txt new file mode 100644 index 0000000000..a7f6e27133 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/data/C.txt @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 diff --git a/ultrasound/L2/tests/interpolator/data/P0.txt b/ultrasound/L2/tests/interpolator/data/P0.txt new file mode 100644 index 0000000000..022fb64dc8 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/data/P0.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 \ No newline at end of file diff --git a/ultrasound/L2/tests/interpolator/description.json b/ultrasound/L2/tests/interpolator/description.json new file mode 100644 index 0000000000..7c90e357c9 --- /dev/null +++ b/ultrasound/L2/tests/interpolator/description.json @@ -0,0 +1,161 @@ +{ + "name": "L2 interpolator Test", + "description": "interpolator Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin interpolator.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/interpolator.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/interpolator/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/interpolator/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/interpolator/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/interpolator/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/interpolator/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/interpolator/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/interpolator/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L2/tests/interpolator/PL_kernels/mm2s5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s5" + }, + { + "location": "LIB_DIR/L2/tests/interpolator/PL_kernels/mm2s6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s6" + }, + { + "location": "LIB_DIR/L2/tests/interpolator/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "interpolator" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": { + "vitis_aie_sim": 32768, + "vitis_aie_x86sim": 32768, + "vitis_sw_emu": 32768, + "vitis_hw_emu": 32768, + "vitis_hw_build": 40960 + }, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/interpolator/system.cfg b/ultrasound/L2/tests/interpolator/system.cfg new file mode 100644 index 0000000000..1b75ecc52d --- /dev/null +++ b/ultrasound/L2/tests/interpolator/system.cfg @@ -0,0 +1,10 @@ +[connectivity] + +stream_connect=mm2s1_1.s:ai_engine_0.P1 +stream_connect=mm2s2_1.s:ai_engine_0.P2 +stream_connect=mm2s3_1.s:ai_engine_0.P3 +stream_connect=mm2s4_1.s:ai_engine_0.P4 +stream_connect=mm2s5_1.s:ai_engine_0.P5 +stream_connect=mm2s6_1.s:ai_engine_0.P6 + +stream_connect=ai_engine_0.C:s2mm1_1.s diff --git a/ultrasound/L2/tests/interpolator/utils.mk b/ultrasound/L2/tests/interpolator/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/interpolator/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/lessOrEqualThanS/Makefile b/ultrasound/L2/tests/lessOrEqualThanS/Makefile new file mode 100644 index 0000000000..7119d507ef --- /dev/null +++ b/ultrasound/L2/tests/lessOrEqualThanS/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/lessOrEqualThanS/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/lessOrEqualThanS/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/lessOrEqualThanS/data/input1.txt b/ultrasound/L2/tests/lessOrEqualThanS/data/input1.txt new file mode 100644 index 0000000000..a0e05797df --- /dev/null +++ b/ultrasound/L2/tests/lessOrEqualThanS/data/input1.txt @@ -0,0 +1,256 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 \ No newline at end of file diff --git a/ultrasound/L2/tests/lessOrEqualThanS/data/lessOrEqualThanS_golden b/ultrasound/L2/tests/lessOrEqualThanS/data/lessOrEqualThanS_golden new file mode 100644 index 0000000000..49b78f7aff --- /dev/null +++ b/ultrasound/L2/tests/lessOrEqualThanS/data/lessOrEqualThanS_golden @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/lessOrEqualThanS/description.json b/ultrasound/L2/tests/lessOrEqualThanS/description.json new file mode 100644 index 0000000000..5dbaa5687a --- /dev/null +++ b/ultrasound/L2/tests/lessOrEqualThanS/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 lessOrEqualThanS Test", + "description": "lessOrEqualThanS Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/lessOrEqualThanS/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/lessOrEqualThanS/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/lessOrEqualThanS/test.cpp b/ultrasound/L2/tests/lessOrEqualThanS/test.cpp new file mode 100644 index 0000000000..94554d2a7c --- /dev/null +++ b/ultrasound/L2/tests/lessOrEqualThanS/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::lessOrEqualThanS g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/lessOrEqualThanS/test.hpp b/ultrasound/L2/tests/lessOrEqualThanS/test.hpp new file mode 100644 index 0000000000..3c582da497 --- /dev/null +++ b/ultrasound/L2/tests/lessOrEqualThanS/test.hpp @@ -0,0 +1,63 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include "kernels.hpp" + +namespace us { +namespace L2 { + +#define SCALAR_ 1 + +template +class lessOrEqualThanS : public adf::graph { + public: + // Input and output ports + adf::input_plio input_lessOrEqualThanS; + adf::output_plio output_lessOrEqualThanS; + + lessOrEqualThanS() { + // Kernel definition + lessOrEqualThanSKernel = + adf::kernel::create(L1::lessOrEqualThanS); + + // input and output port + input_lessOrEqualThanS = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + output_lessOrEqualThanS = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input_lessOrEqualThanS.out[0], lessOrEqualThanSKernel.in[0]); + adf::connect(lessOrEqualThanSKernel.out[0], output_lessOrEqualThanS.in[0]); + + // source kernels + adf::source(lessOrEqualThanSKernel) = "lessOrEqualThanS/lessOrEqualThanS.cpp"; + + // Setting kernel ratio + adf::runtime(lessOrEqualThanSKernel) = KERNEL_RATIO; + + // Config + adf::dimensions(lessOrEqualThanSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(lessOrEqualThanSKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel lessOrEqualThanSKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/lessOrEqualThanS/utils.mk b/ultrasound/L2/tests/lessOrEqualThanS/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/lessOrEqualThanS/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/mulMM/Makefile b/ultrasound/L2/tests/mulMM/Makefile new file mode 100644 index 0000000000..c978ab0c64 --- /dev/null +++ b/ultrasound/L2/tests/mulMM/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/mulMM/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/mulMM/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/mulMM/data/input1.txt b/ultrasound/L2/tests/mulMM/data/input1.txt new file mode 100644 index 0000000000..4050eacc28 --- /dev/null +++ b/ultrasound/L2/tests/mulMM/data/input1.txt @@ -0,0 +1,1024 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/mulMM/data/input2.txt b/ultrasound/L2/tests/mulMM/data/input2.txt new file mode 100644 index 0000000000..4050eacc28 --- /dev/null +++ b/ultrasound/L2/tests/mulMM/data/input2.txt @@ -0,0 +1,1024 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/mulMM/data/mulMM_golden b/ultrasound/L2/tests/mulMM/data/mulMM_golden new file mode 100644 index 0000000000..5437955f0a --- /dev/null +++ b/ultrasound/L2/tests/mulMM/data/mulMM_golden @@ -0,0 +1,128 @@ +1.000000000e+00 +4.000000000e+00 +9.000000000e+00 +1.600000000e+01 +2.500000000e+01 +3.600000000e+01 +4.900000000e+01 +6.400000000e+01 +8.100000000e+01 +1.000000000e+02 +1.210000000e+02 +1.440000000e+02 +1.690000000e+02 +1.960000000e+02 +2.250000000e+02 +2.560000000e+02 +1.000000000e+00 +4.000000000e+00 +9.000000000e+00 +1.600000000e+01 +2.500000000e+01 +3.600000000e+01 +4.900000000e+01 +6.400000000e+01 +8.100000000e+01 +1.000000000e+02 +1.210000000e+02 +1.440000000e+02 +1.690000000e+02 +1.960000000e+02 +2.250000000e+02 +2.560000000e+02 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/mulMM/description.json b/ultrasound/L2/tests/mulMM/description.json new file mode 100644 index 0000000000..ef66a2b30a --- /dev/null +++ b/ultrasound/L2/tests/mulMM/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 mulMM Test", + "description": "mulMM Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/mulMM/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/mulMM/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/mulMM/test.cpp b/ultrasound/L2/tests/mulMM/test.cpp new file mode 100644 index 0000000000..dcf30987a3 --- /dev/null +++ b/ultrasound/L2/tests/mulMM/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::mulMM g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/mulMM/test.hpp b/ultrasound/L2/tests/mulMM/test.hpp new file mode 100644 index 0000000000..851b45e60f --- /dev/null +++ b/ultrasound/L2/tests/mulMM/test.hpp @@ -0,0 +1,66 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include "kernels.hpp" + +#define FREME_LINGTH FRAME_LENGTH + +namespace us { +namespace L2 { + +template +class mulMM : public adf::graph { + public: + // input and output ports + adf::input_plio input1_mulMM; + adf::input_plio input2_mulMM; + adf::output_plio output_mulMM; + + mulMM() { + // Kernel definition + mulMMKernel = adf::kernel::create(L1::mulMM); + + // input and output ports + input1_mulMM = adf::input_plio::create("input1_mulMM", adf::plio_32_bits, "data/input1.txt"); + input2_mulMM = adf::input_plio::create("input2_mulMM", adf::plio_32_bits, "data/input2.txt"); + output_mulMM = adf::output_plio::create("output_mulMM", adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_mulMM.out[0], mulMMKernel.in[0]); + adf::connect(input2_mulMM.out[0], mulMMKernel.in[1]); + adf::connect(mulMMKernel.out[0], output_mulMM.in[0]); + + // source kernel + adf::source(mulMMKernel) = "mulMM/mulMM.cpp"; + + // Setting kernel ratio + adf::runtime(mulMMKernel) = KERNEL_RATIO; + + // config + adf::dimensions(mulMMKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulMMKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulMMKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel mulMMKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/mulMM/utils.mk b/ultrasound/L2/tests/mulMM/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/mulMM/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/mulVS/Makefile b/ultrasound/L2/tests/mulVS/Makefile new file mode 100644 index 0000000000..7f9ac1748f --- /dev/null +++ b/ultrasound/L2/tests/mulVS/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/mulVS/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/mulVS/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/mulVS/data/input1.txt b/ultrasound/L2/tests/mulVS/data/input1.txt new file mode 100644 index 0000000000..a0e05797df --- /dev/null +++ b/ultrasound/L2/tests/mulVS/data/input1.txt @@ -0,0 +1,256 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 \ No newline at end of file diff --git a/ultrasound/L2/tests/mulVS/data/mulVS_golden b/ultrasound/L2/tests/mulVS/data/mulVS_golden new file mode 100644 index 0000000000..49b78f7aff --- /dev/null +++ b/ultrasound/L2/tests/mulVS/data/mulVS_golden @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/mulVS/description.json b/ultrasound/L2/tests/mulVS/description.json new file mode 100644 index 0000000000..01baf6c4ff --- /dev/null +++ b/ultrasound/L2/tests/mulVS/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 mulVS Test", + "description": "mulVS Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/mulVS/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/mulVS/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/mulVS/test.cpp b/ultrasound/L2/tests/mulVS/test.cpp new file mode 100644 index 0000000000..5afd2db4f6 --- /dev/null +++ b/ultrasound/L2/tests/mulVS/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::mulVS g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/mulVS/test.hpp b/ultrasound/L2/tests/mulVS/test.hpp new file mode 100644 index 0000000000..5d8a213d67 --- /dev/null +++ b/ultrasound/L2/tests/mulVS/test.hpp @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class mulVS : public adf::graph { + public: + // input and output ports + adf::input_plio input1_mulVS; + adf::input_plio input2_mulVS; + adf::output_plio output_mulVS; + + mulVS() { + // Kernel definition + mulVSKernel = adf::kernel::create(L1::mulVS); + + // input and output port + input1_mulVS = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + input2_mulVS = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + output_mulVS = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_mulVS.out[0], mulVSKernel.in[0]); + adf::connect(input2_mulVS.out[0], mulVSKernel.in[1]); + adf::connect(mulVSKernel.out[0], output_mulVS.in[0]); + + // source kernel + adf::source(mulVSKernel) = "mulVS/mulVS.cpp"; + + // Setting kernel ratio + adf::runtime(mulVSKernel) = KERNEL_RATIO; + + // config + adf::dimensions(mulVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVSKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulVSKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel mulVSKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/mulVS/utils.mk b/ultrasound/L2/tests/mulVS/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/mulVS/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/mulVV/Makefile b/ultrasound/L2/tests/mulVV/Makefile new file mode 100644 index 0000000000..c3b1a9a4e5 --- /dev/null +++ b/ultrasound/L2/tests/mulVV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/mulVV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/mulVV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/mulVV/data/input1.txt b/ultrasound/L2/tests/mulVV/data/input1.txt new file mode 100644 index 0000000000..1626c78a54 --- /dev/null +++ b/ultrasound/L2/tests/mulVV/data/input1.txt @@ -0,0 +1,256 @@ +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 \ No newline at end of file diff --git a/ultrasound/L2/tests/mulVV/data/input2.txt b/ultrasound/L2/tests/mulVV/data/input2.txt new file mode 100644 index 0000000000..1626c78a54 --- /dev/null +++ b/ultrasound/L2/tests/mulVV/data/input2.txt @@ -0,0 +1,256 @@ +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 \ No newline at end of file diff --git a/ultrasound/L2/tests/mulVV/data/mulVV_golden b/ultrasound/L2/tests/mulVV/data/mulVV_golden new file mode 100644 index 0000000000..03a3f27630 --- /dev/null +++ b/ultrasound/L2/tests/mulVV/data/mulVV_golden @@ -0,0 +1,128 @@ +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/mulVV/description.json b/ultrasound/L2/tests/mulVV/description.json new file mode 100644 index 0000000000..44a6b3d636 --- /dev/null +++ b/ultrasound/L2/tests/mulVV/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 mulVV Test", + "description": "mulVV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/mulVV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/mulVV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/mulVV/test.cpp b/ultrasound/L2/tests/mulVV/test.cpp new file mode 100644 index 0000000000..15a84d8600 --- /dev/null +++ b/ultrasound/L2/tests/mulVV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::mulVV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/mulVV/test.hpp b/ultrasound/L2/tests/mulVV/test.hpp new file mode 100644 index 0000000000..e637b5f133 --- /dev/null +++ b/ultrasound/L2/tests/mulVV/test.hpp @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class mulVV : public adf::graph { + public: + // Input and output ports + adf::input_plio input1_mulVV; + adf::input_plio input2_mulVV; + adf::output_plio output_mulVV; + + mulVV() { + // Kernel definition + mulVVKernel = adf::kernel::create(L1::mulVV); + + // input and output port + input1_mulVV = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + input2_mulVV = adf::input_plio::create(adf::plio_32_bits, "data/input2.txt"); + output_mulVV = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_mulVV.out[0], mulVVKernel.in[0]); + adf::connect(input2_mulVV.out[0], mulVVKernel.in[1]); + adf::connect(mulVVKernel.out[0], output_mulVV.in[0]); + + // source kernel + adf::source(mulVVKernel) = "mulVV/mulVV.cpp"; + + // Setting kernel ratio + adf::runtime(mulVVKernel) = KERNEL_RATIO; + + // Config + adf::dimensions(mulVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(mulVVKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel mulVVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/mulVV/utils.mk b/ultrasound/L2/tests/mulVV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/mulVV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/norm_axis_1/Makefile b/ultrasound/L2/tests/norm_axis_1/Makefile new file mode 100644 index 0000000000..464ac40845 --- /dev/null +++ b/ultrasound/L2/tests/norm_axis_1/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/norm_axis_1/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/norm_axis_1/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/norm_axis_1/data/input1.txt b/ultrasound/L2/tests/norm_axis_1/data/input1.txt new file mode 100644 index 0000000000..2a148c8e2d --- /dev/null +++ b/ultrasound/L2/tests/norm_axis_1/data/input1.txt @@ -0,0 +1,1024 @@ +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/norm_axis_1/data/norm_axis_1_golden b/ultrasound/L2/tests/norm_axis_1/data/norm_axis_1_golden new file mode 100644 index 0000000000..f9c81d3517 --- /dev/null +++ b/ultrasound/L2/tests/norm_axis_1/data/norm_axis_1_golden @@ -0,0 +1,128 @@ +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +5.477225780e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/norm_axis_1/description.json b/ultrasound/L2/tests/norm_axis_1/description.json new file mode 100644 index 0000000000..5a0f9e5226 --- /dev/null +++ b/ultrasound/L2/tests/norm_axis_1/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 norm_axis_1 Test", + "description": "norm_axis_1 Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/norm_axis_1/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/norm_axis_1/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/norm_axis_1/test.cpp b/ultrasound/L2/tests/norm_axis_1/test.cpp new file mode 100644 index 0000000000..3ff6393fea --- /dev/null +++ b/ultrasound/L2/tests/norm_axis_1/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::normAxis1 g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/norm_axis_1/test.hpp b/ultrasound/L2/tests/norm_axis_1/test.hpp new file mode 100644 index 0000000000..72a34ae577 --- /dev/null +++ b/ultrasound/L2/tests/norm_axis_1/test.hpp @@ -0,0 +1,60 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +#define FRAME_LENGTH 128 + +namespace us { +namespace L2 { + +class normAxis1 : public adf::graph { + public: + normAxis1() { + // Kernel definition + normAxis1Kernel = adf::kernel::create(L1::norm_axis_1); + + // input and output ports + input1_normAxis1 = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + output_normAxis1 = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_normAxis1.out[0], normAxis1Kernel.in[0]); + adf::connect(normAxis1Kernel.out[0], output_normAxis1.in[0]); + + // source kernels + adf::source(normAxis1Kernel) = "norm_axis_1/norm_axis_1.cpp"; + + // Setting kernel ratio + adf::runtime(normAxis1Kernel) = KERNEL_RATIO; + + // config + adf::dimensions(normAxis1Kernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(normAxis1Kernel.out[0]) = {FRAME_LENGTH}; + } + + adf::input_plio input1_normAxis1; + adf::output_plio output_normAxis1; + + private: + // Kernel declaration + adf::kernel normAxis1Kernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/norm_axis_1/utils.mk b/ultrasound/L2/tests/norm_axis_1/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/norm_axis_1/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/ones/Makefile b/ultrasound/L2/tests/ones/Makefile new file mode 100644 index 0000000000..7fd47a3c74 --- /dev/null +++ b/ultrasound/L2/tests/ones/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/ones/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/ones/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/ones/data/ones_golden b/ultrasound/L2/tests/ones/data/ones_golden new file mode 100644 index 0000000000..49b78f7aff --- /dev/null +++ b/ultrasound/L2/tests/ones/data/ones_golden @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/ones/description.json b/ultrasound/L2/tests/ones/description.json new file mode 100644 index 0000000000..28b99b2239 --- /dev/null +++ b/ultrasound/L2/tests/ones/description.json @@ -0,0 +1,63 @@ +{ + "name": "L1 ones Test", + "description": "ones Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/ones/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/ones/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": { + "vitis_aie_sim": 600, + "vitis_aie_x86sim": 300 + } + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/ones/test.cpp b/ultrasound/L2/tests/ones/test.cpp new file mode 100644 index 0000000000..61e1688ca9 --- /dev/null +++ b/ultrasound/L2/tests/ones/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::ones g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/ones/test.hpp b/ultrasound/L2/tests/ones/test.hpp new file mode 100644 index 0000000000..97d8a3688c --- /dev/null +++ b/ultrasound/L2/tests/ones/test.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +#define FRAME_LENGTH 128 + +namespace us { +namespace L2 { + +class ones : public adf::graph { + public: + // output ports + adf::output_plio output_ones; + + ones() { + // input and output port + output_ones = adf::output_plio::create("output_ones", adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + onesKernel = adf::kernel::create(L1::ones); + + // source kernel + adf::source(onesKernel) = "ones/ones.cpp"; + + // result + adf::connect(onesKernel.out[0], output_ones.in[0]); + + // Setting kernel ratio + adf::runtime(onesKernel) = KERNEL_RATIO; + adf::dimensions(onesKernel.out[0]) = {FRAME_LENGTH}; + } + + private: + // Kernel declaration + adf::kernel onesKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/ones/utils.mk b/ultrasound/L2/tests/ones/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/ones/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/outer/Makefile b/ultrasound/L2/tests/outer/Makefile new file mode 100644 index 0000000000..a9d0b876ad --- /dev/null +++ b/ultrasound/L2/tests/outer/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/outer/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/outer/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/outer/data/input1.txt b/ultrasound/L2/tests/outer/data/input1.txt new file mode 100644 index 0000000000..31bad7f7b6 --- /dev/null +++ b/ultrasound/L2/tests/outer/data/input1.txt @@ -0,0 +1,256 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/outer/data/input2.txt b/ultrasound/L2/tests/outer/data/input2.txt new file mode 100644 index 0000000000..31bad7f7b6 --- /dev/null +++ b/ultrasound/L2/tests/outer/data/input2.txt @@ -0,0 +1,256 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/outer/data/outer_golden b/ultrasound/L2/tests/outer/data/outer_golden new file mode 100644 index 0000000000..bb015a0b5e --- /dev/null +++ b/ultrasound/L2/tests/outer/data/outer_golden @@ -0,0 +1,128 @@ +1.000000000e+00 +2.000000000e+00 +3.000000000e+00 +-4.000000000e+00 +2.000000000e+00 +4.000000000e+00 +6.000000000e+00 +-8.000000000e+00 +3.000000000e+00 +6.000000000e+00 +9.000000000e+00 +-1.200000000e+01 +-4.000000000e+00 +-8.000000000e+00 +-1.200000000e+01 +1.600000000e+01 +5.000000000e+00 +1.000000000e+01 +1.500000000e+01 +-2.000000000e+01 +6.000000000e+00 +1.200000000e+01 +1.800000000e+01 +-2.400000000e+01 +7.000000000e+00 +1.400000000e+01 +2.100000000e+01 +-2.800000000e+01 +8.000000000e+00 +1.600000000e+01 +2.400000000e+01 +-3.200000000e+01 +-9.000000000e+00 +-1.800000000e+01 +-2.700000000e+01 +3.600000000e+01 +-1.000000000e+01 +-2.000000000e+01 +-3.000000000e+01 +4.000000000e+01 +1.100000000e+01 +2.200000000e+01 +3.300000000e+01 +-4.400000000e+01 +-1.200000000e+01 +-2.400000000e+01 +-3.600000000e+01 +4.800000000e+01 +1.300000000e+01 +2.600000000e+01 +3.900000000e+01 +-5.200000000e+01 +1.400000000e+01 +2.800000000e+01 +4.200000000e+01 +-5.600000000e+01 +1.500000000e+01 +3.000000000e+01 +4.500000000e+01 +-6.000000000e+01 +-1.600000000e+01 +-3.200000000e+01 +-4.800000000e+01 +6.400000000e+01 +1.000000000e+00 +2.000000000e+00 +3.000000000e+00 +-4.000000000e+00 +2.000000000e+00 +4.000000000e+00 +6.000000000e+00 +-8.000000000e+00 +3.000000000e+00 +6.000000000e+00 +9.000000000e+00 +-1.200000000e+01 +-4.000000000e+00 +-8.000000000e+00 +-1.200000000e+01 +1.600000000e+01 +5.000000000e+00 +1.000000000e+01 +1.500000000e+01 +-2.000000000e+01 +6.000000000e+00 +1.200000000e+01 +1.800000000e+01 +-2.400000000e+01 +7.000000000e+00 +1.400000000e+01 +2.100000000e+01 +-2.800000000e+01 +8.000000000e+00 +1.600000000e+01 +2.400000000e+01 +-3.200000000e+01 +-9.000000000e+00 +-1.800000000e+01 +-2.700000000e+01 +3.600000000e+01 +-1.000000000e+01 +-2.000000000e+01 +-3.000000000e+01 +4.000000000e+01 +1.100000000e+01 +2.200000000e+01 +3.300000000e+01 +-4.400000000e+01 +-1.200000000e+01 +-2.400000000e+01 +-3.600000000e+01 +4.800000000e+01 +1.300000000e+01 +2.600000000e+01 +3.900000000e+01 +-5.200000000e+01 +1.400000000e+01 +2.800000000e+01 +4.200000000e+01 +-5.600000000e+01 +1.500000000e+01 +3.000000000e+01 +4.500000000e+01 +-6.000000000e+01 +-1.600000000e+01 +-3.200000000e+01 +-4.800000000e+01 +6.400000000e+01 diff --git a/ultrasound/L2/tests/outer/description.json b/ultrasound/L2/tests/outer/description.json new file mode 100644 index 0000000000..663f5656da --- /dev/null +++ b/ultrasound/L2/tests/outer/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 outer Test", + "description": "outer Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/outer/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/outer/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/outer/test.cpp b/ultrasound/L2/tests/outer/test.cpp new file mode 100644 index 0000000000..f4ea0ba063 --- /dev/null +++ b/ultrasound/L2/tests/outer/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::outer g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/outer/test.hpp b/ultrasound/L2/tests/outer/test.hpp new file mode 100644 index 0000000000..7386a30736 --- /dev/null +++ b/ultrasound/L2/tests/outer/test.hpp @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +#define FRAME_LENGTH 128 + +namespace us { +namespace L2 { + +class outer : public adf::graph { + public: + // input and output ports + adf::input_plio input1_outer; + adf::input_plio input2_outer; + adf::output_plio output_outer; + + outer() { + // Input and output port + input1_outer = adf::input_plio::create("input1_outer", adf::plio_32_bits, "data/input1.txt"); + input2_outer = adf::input_plio::create("input2_outer", adf::plio_32_bits, "data/input2.txt"); + output_outer = adf::output_plio::create("output_outer", adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + outerKernel = adf::kernel::create(L1::outer); + + // Source kernel + adf::source(outerKernel) = "outer/outer.cpp"; + + // Connections + adf::connect(input1_outer.out[0], outerKernel.in[0]); + adf::connect(input2_outer.out[0], outerKernel.in[1]); + adf::connect(outerKernel.out[0], output_outer.in[0]); + + // Setting kernel ratio + adf::runtime(outerKernel) = KERNEL_RATIO; + + // Setting FIFO depth + adf::dimensions(outerKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(outerKernel.in[1]) = {FRAME_LENGTH}; + adf::dimensions(outerKernel.out[0]) = {FRAME_LENGTH}; + } + + private: + // Kernel declaration + adf::kernel outerKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/outer/utils.mk b/ultrasound/L2/tests/outer/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/outer/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/reciprocalV/Makefile b/ultrasound/L2/tests/reciprocalV/Makefile new file mode 100644 index 0000000000..76e90b7d8e --- /dev/null +++ b/ultrasound/L2/tests/reciprocalV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/reciprocalV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/reciprocalV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/reciprocalV/data/input1.txt b/ultrasound/L2/tests/reciprocalV/data/input1.txt new file mode 100644 index 0000000000..548b044d7a --- /dev/null +++ b/ultrasound/L2/tests/reciprocalV/data/input1.txt @@ -0,0 +1,256 @@ +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 +0.5 \ No newline at end of file diff --git a/ultrasound/L2/tests/reciprocalV/data/reciprocalV_golden b/ultrasound/L2/tests/reciprocalV/data/reciprocalV_golden new file mode 100644 index 0000000000..9c3302cfee --- /dev/null +++ b/ultrasound/L2/tests/reciprocalV/data/reciprocalV_golden @@ -0,0 +1,128 @@ +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/reciprocalV/description.json b/ultrasound/L2/tests/reciprocalV/description.json new file mode 100644 index 0000000000..615918836a --- /dev/null +++ b/ultrasound/L2/tests/reciprocalV/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 reciprocalV Test", + "description": "reciprocalV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/reciprocalV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/reciprocalV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/reciprocalV/test.cpp b/ultrasound/L2/tests/reciprocalV/test.cpp new file mode 100644 index 0000000000..c671880dff --- /dev/null +++ b/ultrasound/L2/tests/reciprocalV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::reciprocalV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/reciprocalV/test.hpp b/ultrasound/L2/tests/reciprocalV/test.hpp new file mode 100644 index 0000000000..707c16c050 --- /dev/null +++ b/ultrasound/L2/tests/reciprocalV/test.hpp @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +#define FRAME_LENGTH 128 + +namespace us { +namespace L2 { + +class reciprocalV : public adf::graph { + public: + // Input and output ports + adf::input_plio input_reciprocalV; + adf::output_plio output_reciprocalV; + + reciprocalV() { + // input and output port + input_reciprocalV = adf::input_plio::create("input_reciprocalV", adf::plio_32_bits, "data/input1.txt"); + output_reciprocalV = adf::output_plio::create("output_reciprocalV", adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + reciprocalVKernel = adf::kernel::create(L1::reciprocalV); + adf::source(reciprocalVKernel) = "reciprocalV/reciprocalV.cpp"; + + // connections + adf::connect(input_reciprocalV.out[0], reciprocalVKernel.in[0]); + adf::connect(reciprocalVKernel.out[0], output_reciprocalV.in[0]); + + // setting kernel ratio + adf::runtime(reciprocalVKernel) = KERNEL_RATIO; + adf::dimensions(reciprocalVKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(reciprocalVKernel.out[0]) = {FRAME_LENGTH}; + } + + private: + adf::kernel reciprocalVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/reciprocalV/utils.mk b/ultrasound/L2/tests/reciprocalV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/reciprocalV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/samples/Makefile b/ultrasound/L2/tests/samples/Makefile new file mode 100644 index 0000000000..aa017b64c3 --- /dev/null +++ b/ultrasound/L2/tests/samples/Makefile @@ -0,0 +1,439 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L2/tests/samples/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/samples/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L2/tests/samples/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L2/tests/samples/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin samples.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/samples.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/samples.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/samples_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/samples.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L2/tests/samples/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/samples.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L2/tests/samples/PL_kernels/mm2s1.cpp b/ultrasound/L2/tests/samples/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L2/tests/samples/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/samples/PL_kernels/mm2s2.cpp b/ultrasound/L2/tests/samples/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L2/tests/samples/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/samples/PL_kernels/mm2s3.cpp b/ultrasound/L2/tests/samples/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L2/tests/samples/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/samples/PL_kernels/mm2s4.cpp b/ultrasound/L2/tests/samples/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L2/tests/samples/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L2/tests/samples/PL_kernels/s2mm1.cpp b/ultrasound/L2/tests/samples/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L2/tests/samples/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L2/tests/samples/PS_host/host.cpp b/ultrasound/L2/tests/samples/PS_host/host.cpp new file mode 100644 index 0000000000..deca48497d --- /dev/null +++ b/ultrasound/L2/tests/samples/PS_host/host.cpp @@ -0,0 +1,324 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 4 +#define OUTPUT_RANGE 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "input file is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Inputs + file_set[0] = data_path + "image_points_from_PL.txt"; + file_set[1] = data_path + "delay_from_PL.txt"; + file_set[2] = data_path + "xdc_def_positions.txt"; + file_set[3] = data_path + "sampling_frequency.txt"; + + // mem inputSize & outSize define + sizeIn[0] = 128; + sizeIn[1] = 32; + sizeIn[2] = 4; + sizeIn[3] = 32; + sizeOut[0] = 32; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + std::cout << "graph init" << std::endl; + b.init(); + + std::cout << "graph run" << std::endl; + b.run(1); + + b.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "samples_to_PL_golden.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < sizeOut[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + float result_golden = (float)golden_buf_mem[k][i]; + if (result_tmp != result_golden) { + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + err_cnt++; + } + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); + + ////////////////////////////////////////// + // End + ////////////////////////////////////////// + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} \ No newline at end of file diff --git a/ultrasound/L2/tests/samples/PS_host/host.hpp b/ultrasound/L2/tests/samples/PS_host/host.hpp new file mode 100644 index 0000000000..e3f25f1d23 --- /dev/null +++ b/ultrasound/L2/tests/samples/PS_host/host.hpp @@ -0,0 +1,33 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L2/tests/samples/aie_graph/graph.cpp b/ultrasound/L2/tests/samples/aie_graph/graph.cpp new file mode 100644 index 0000000000..4ffa554faa --- /dev/null +++ b/ultrasound/L2/tests/samples/aie_graph/graph.cpp @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "samples.hpp" + +class samples : public adf::graph { + public: + // input and output port + adf::input_plio image_points_from_PL; + adf::input_plio delay_from_PL; + adf::input_plio xdc_def_positions; + adf::input_plio sampling_frequency; + adf::output_plio samples_to_PL; + + us::L2::samples_graph<> sam; + + samples() { + // input & output port + image_points_from_PL = + adf::input_plio::create("image_points_from_PL", adf::plio_32_bits, "data/image_points_from_PL.txt"); + delay_from_PL = adf::input_plio::create("delay_from_PL", adf::plio_32_bits, "data/delay_from_PL.txt"); + xdc_def_positions = + adf::input_plio::create("xdc_def_positions", adf::plio_32_bits, "data/xdc_def_positions.txt"); + sampling_frequency = + adf::input_plio::create("sampling_frequency", adf::plio_32_bits, "data/sampling_frequency.txt"); + samples_to_PL = adf::output_plio::create("samples_to_PL", adf::plio_32_bits, "data/samples_to_PL.txt"); + + // connections + adf::connect<>(image_points_from_PL.out[0], sam.image_points_from_PL); + adf::connect<>(delay_from_PL.out[0], sam.delay_from_PL); + adf::connect<>(xdc_def_positions.out[0], sam.xdc_def_positions); + adf::connect<>(sampling_frequency.out[0], sam.sampling_frequency); + adf::connect<>(sam.samples_to_PL, samples_to_PL.in[0]); + } +}; + +samples b; + +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + b.init(); + + b.run(1); + + b.end(); + + return 0; +} +#endif diff --git a/ultrasound/L2/tests/samples/data/delay_from_PL.txt b/ultrasound/L2/tests/samples/data/delay_from_PL.txt new file mode 100644 index 0000000000..3e33d22b8f --- /dev/null +++ b/ultrasound/L2/tests/samples/data/delay_from_PL.txt @@ -0,0 +1,256 @@ +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 \ No newline at end of file diff --git a/ultrasound/L2/tests/samples/data/image_points_from_PL.txt b/ultrasound/L2/tests/samples/data/image_points_from_PL.txt new file mode 100644 index 0000000000..8ade315b57 --- /dev/null +++ b/ultrasound/L2/tests/samples/data/image_points_from_PL.txt @@ -0,0 +1,2048 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/samples/data/samples_to_PL_golden.txt b/ultrasound/L2/tests/samples/data/samples_to_PL_golden.txt new file mode 100644 index 0000000000..c4e5bfde95 --- /dev/null +++ b/ultrasound/L2/tests/samples/data/samples_to_PL_golden.txt @@ -0,0 +1,32 @@ +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 diff --git a/ultrasound/L2/tests/samples/data/sampling_frequency.txt b/ultrasound/L2/tests/samples/data/sampling_frequency.txt new file mode 100644 index 0000000000..492a69e086 --- /dev/null +++ b/ultrasound/L2/tests/samples/data/sampling_frequency.txt @@ -0,0 +1,256 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/samples/data/xdc_def_positions.txt b/ultrasound/L2/tests/samples/data/xdc_def_positions.txt new file mode 100644 index 0000000000..8ade315b57 --- /dev/null +++ b/ultrasound/L2/tests/samples/data/xdc_def_positions.txt @@ -0,0 +1,2048 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 \ No newline at end of file diff --git a/ultrasound/L2/tests/samples/description.json b/ultrasound/L2/tests/samples/description.json new file mode 100644 index 0000000000..bea86854ce --- /dev/null +++ b/ultrasound/L2/tests/samples/description.json @@ -0,0 +1,149 @@ +{ + "name": "L2 samples Test", + "description": "samples Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin samples.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/samples.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L2/tests/samples/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L2/tests/samples/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/samples/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/samples/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L2/tests/samples/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L2/tests/samples/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L2/tests/samples/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L2/tests/samples/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + } + ], + "name": "samples" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": { + "vitis_aie_sim": 32768, + "vitis_aie_x86sim": 32768, + "vitis_sw_emu": 32768, + "vitis_hw_emu": 32768, + "vitis_hw_build": 40960 + }, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/samples/system.cfg b/ultrasound/L2/tests/samples/system.cfg new file mode 100644 index 0000000000..d19ebfe0cb --- /dev/null +++ b/ultrasound/L2/tests/samples/system.cfg @@ -0,0 +1,8 @@ +[connectivity] + +stream_connect=mm2s1_1.s:ai_engine_0.image_points_from_PL +stream_connect=mm2s2_1.s:ai_engine_0.delay_from_PL +stream_connect=mm2s3_1.s:ai_engine_0.xdc_def_positions +stream_connect=mm2s4_1.s:ai_engine_0.sampling_frequency +stream_connect=ai_engine_0.samples_to_PL:s2mm1_1.s + diff --git a/ultrasound/L2/tests/samples/utils.mk b/ultrasound/L2/tests/samples/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/samples/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/sign/Makefile b/ultrasound/L2/tests/sign/Makefile new file mode 100644 index 0000000000..72d1c156f7 --- /dev/null +++ b/ultrasound/L2/tests/sign/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/sign/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/sign/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/sign/data/input.txt b/ultrasound/L2/tests/sign/data/input.txt new file mode 100644 index 0000000000..f30563b07a --- /dev/null +++ b/ultrasound/L2/tests/sign/data/input.txt @@ -0,0 +1,32 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/sign/data/sign_golden b/ultrasound/L2/tests/sign/data/sign_golden new file mode 100644 index 0000000000..8c953e0dff --- /dev/null +++ b/ultrasound/L2/tests/sign/data/sign_golden @@ -0,0 +1,32 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 +-1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 +-1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +-1.000000000e+00 \ No newline at end of file diff --git a/ultrasound/L2/tests/sign/description.json b/ultrasound/L2/tests/sign/description.json new file mode 100644 index 0000000000..c26e933e88 --- /dev/null +++ b/ultrasound/L2/tests/sign/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 sign Test", + "description": "sign Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/sign/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/sign/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/sign/test.cpp b/ultrasound/L2/tests/sign/test.cpp new file mode 100644 index 0000000000..4bca8158d4 --- /dev/null +++ b/ultrasound/L2/tests/sign/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::sign g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/sign/test.hpp b/ultrasound/L2/tests/sign/test.hpp new file mode 100644 index 0000000000..9d53b6b900 --- /dev/null +++ b/ultrasound/L2/tests/sign/test.hpp @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +#define FRAME_LENGTH 32 + +namespace us { +namespace L2 { + +class sign : public adf::graph { + public: + // Input and output ports + adf::input_plio input_sign; + adf::output_plio output_sign; + + sign() { + // input & output plio + input_sign = adf::input_plio::create("input_sign", adf::plio_32_bits, "data/input.txt"); + output_sign = adf::output_plio::create("output_sign", adf::plio_32_bits, "data/output.txt"); + + // kernel definition + signKernel = adf::kernel::create(L1::sign); + adf::source(signKernel) = "sign/sign.cpp"; + + // connections + adf::connect(input_sign.out[0], signKernel.in[0]); + adf::connect(signKernel.out[0], output_sign.in[0]); + + // config + adf::runtime(signKernel) = KERNEL_RATIO; + adf::dimensions(signKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(signKernel.out[0]) = {FRAME_LENGTH}; + } + + private: + adf::kernel signKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/sign/utils.mk b/ultrasound/L2/tests/sign/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/sign/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/sqrtV/Makefile b/ultrasound/L2/tests/sqrtV/Makefile new file mode 100644 index 0000000000..d48b3e6660 --- /dev/null +++ b/ultrasound/L2/tests/sqrtV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/sqrtV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/sqrtV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/sqrtV/data/input1.txt b/ultrasound/L2/tests/sqrtV/data/input1.txt new file mode 100644 index 0000000000..492a69e086 --- /dev/null +++ b/ultrasound/L2/tests/sqrtV/data/input1.txt @@ -0,0 +1,256 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/sqrtV/data/sqrtV_golden b/ultrasound/L2/tests/sqrtV/data/sqrtV_golden new file mode 100644 index 0000000000..c8402ddf3a --- /dev/null +++ b/ultrasound/L2/tests/sqrtV/data/sqrtV_golden @@ -0,0 +1,32 @@ +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 diff --git a/ultrasound/L2/tests/sqrtV/description.json b/ultrasound/L2/tests/sqrtV/description.json new file mode 100644 index 0000000000..9a9de928a6 --- /dev/null +++ b/ultrasound/L2/tests/sqrtV/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 sqrtV Test", + "description": "sqrtV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/sqrtV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/sqrtV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/sqrtV/test.cpp b/ultrasound/L2/tests/sqrtV/test.cpp new file mode 100644 index 0000000000..678ba0eb8b --- /dev/null +++ b/ultrasound/L2/tests/sqrtV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::sqrtV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/sqrtV/test.hpp b/ultrasound/L2/tests/sqrtV/test.hpp new file mode 100644 index 0000000000..8de77ef7a9 --- /dev/null +++ b/ultrasound/L2/tests/sqrtV/test.hpp @@ -0,0 +1,60 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +#define FRAME_LENGTH 32 + +namespace us { +namespace L2 { + +class sqrtV : public adf::graph { + public: + sqrtV() { + // Kernel definition + sqrtVKernel = adf::kernel::create(L1::sqrtV); + + // input and output port + input1_sqrtV = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + output_sqrtV = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_sqrtV.out[0], sqrtVKernel.in[0]); + adf::connect(sqrtVKernel.out[0], output_sqrtV.in[0]); + + // source kernel + adf::source(sqrtVKernel) = "sqrtV/sqrtV.cpp"; + + // setting kernel ratio + adf::runtime(sqrtVKernel) = KERNEL_RATIO; + + // config + adf::dimensions(sqrtVKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(sqrtVKernel.out[0]) = {FRAME_LENGTH}; + } + + adf::input_plio input1_sqrtV; + adf::output_plio output_sqrtV; + + private: + // kernel declaration + adf::kernel sqrtVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/sqrtV/utils.mk b/ultrasound/L2/tests/sqrtV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/sqrtV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/squareV/Makefile b/ultrasound/L2/tests/squareV/Makefile new file mode 100644 index 0000000000..b9580f68e9 --- /dev/null +++ b/ultrasound/L2/tests/squareV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/squareV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/squareV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/squareV/data/input1.txt b/ultrasound/L2/tests/squareV/data/input1.txt new file mode 100644 index 0000000000..492a69e086 --- /dev/null +++ b/ultrasound/L2/tests/squareV/data/input1.txt @@ -0,0 +1,256 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/squareV/data/squareV_golden b/ultrasound/L2/tests/squareV/data/squareV_golden new file mode 100644 index 0000000000..019a863bc6 --- /dev/null +++ b/ultrasound/L2/tests/squareV/data/squareV_golden @@ -0,0 +1,128 @@ +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/squareV/description.json b/ultrasound/L2/tests/squareV/description.json new file mode 100644 index 0000000000..c8641e0263 --- /dev/null +++ b/ultrasound/L2/tests/squareV/description.json @@ -0,0 +1,63 @@ +{ + "name": "L1 squareV Test", + "description": "squareV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/squareV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/squareV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": { + "vitis_aie_sim": 470, + "vitis_aie_x86sim": 300 + } + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/squareV/test.cpp b/ultrasound/L2/tests/squareV/test.cpp new file mode 100644 index 0000000000..7863f944ea --- /dev/null +++ b/ultrasound/L2/tests/squareV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::squareV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/squareV/test.hpp b/ultrasound/L2/tests/squareV/test.hpp new file mode 100644 index 0000000000..730fe74890 --- /dev/null +++ b/ultrasound/L2/tests/squareV/test.hpp @@ -0,0 +1,60 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#include + +#define FRAME_LENGTH 128 + +namespace us { +namespace L2 { + +class squareV : public adf::graph { + public: + squareV() { + // Kernel definition + squareVKernel = adf::kernel::create(L1::squareV); + + // input and output port + input1_squareV = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + output_squareV = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // connections + adf::connect(input1_squareV.out[0], squareVKernel.in[0]); + adf::connect(squareVKernel.out[0], output_squareV.in[0]); + + // source kernel + adf::source(squareVKernel) = "squareV/squareV.cpp"; + + // setting kernel ratio + adf::runtime(squareVKernel) = KERNEL_RATIO; + + // setting FIFO depth + adf::dimensions(squareVKernel.in[0]) = {FRAME_LENGTH}; + adf::dimensions(squareVKernel.out[0]) = {FRAME_LENGTH}; + } + + adf::input_plio input1_squareV; + adf::output_plio output_squareV; + + private: + // Kernel declaration + adf::kernel squareVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/squareV/utils.mk b/ultrasound/L2/tests/squareV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/squareV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/sumMM/Makefile b/ultrasound/L2/tests/sumMM/Makefile new file mode 100644 index 0000000000..bf18de26d8 --- /dev/null +++ b/ultrasound/L2/tests/sumMM/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/sumMM/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/sumMM/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/sumMM/data/input1.txt b/ultrasound/L2/tests/sumMM/data/input1.txt new file mode 100644 index 0000000000..4050eacc28 --- /dev/null +++ b/ultrasound/L2/tests/sumMM/data/input1.txt @@ -0,0 +1,1024 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/sumMM/data/input2.txt b/ultrasound/L2/tests/sumMM/data/input2.txt new file mode 100644 index 0000000000..4050eacc28 --- /dev/null +++ b/ultrasound/L2/tests/sumMM/data/input2.txt @@ -0,0 +1,1024 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/sumMM/data/sumMM_golden b/ultrasound/L2/tests/sumMM/data/sumMM_golden new file mode 100644 index 0000000000..f379e6c8f4 --- /dev/null +++ b/ultrasound/L2/tests/sumMM/data/sumMM_golden @@ -0,0 +1,32 @@ +2.000000000e+00 +4.000000000e+00 +6.000000000e+00 +-8.000000000e+00 +1.000000000e+01 +1.200000000e+01 +1.400000000e+01 +1.600000000e+01 +-1.800000000e+01 +-2.000000000e+01 +2.200000000e+01 +-2.400000000e+01 +2.600000000e+01 +2.800000000e+01 +3.000000000e+01 +-3.200000000e+01 +2.000000000e+00 +4.000000000e+00 +6.000000000e+00 +-8.000000000e+00 +1.000000000e+01 +1.200000000e+01 +1.400000000e+01 +1.600000000e+01 +-1.800000000e+01 +-2.000000000e+01 +2.200000000e+01 +-2.400000000e+01 +2.600000000e+01 +2.800000000e+01 +3.000000000e+01 +-3.200000000e+01 diff --git a/ultrasound/L2/tests/sumMM/description.json b/ultrasound/L2/tests/sumMM/description.json new file mode 100644 index 0000000000..b43f4250ce --- /dev/null +++ b/ultrasound/L2/tests/sumMM/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 sumMM Test", + "description": "sumMM Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/sumMM/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/sumMM/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/sumMM/test.cpp b/ultrasound/L2/tests/sumMM/test.cpp new file mode 100644 index 0000000000..b79674b084 --- /dev/null +++ b/ultrasound/L2/tests/sumMM/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::sumMM g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/sumMM/test.hpp b/ultrasound/L2/tests/sumMM/test.hpp new file mode 100644 index 0000000000..c26bfe1d2b --- /dev/null +++ b/ultrasound/L2/tests/sumMM/test.hpp @@ -0,0 +1,70 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +#define sumMM_DIM 32 + +namespace us { +namespace L2 { + +class sumMM : public adf::graph { + public: + + adf::input_plio input1_sumMM; + adf::input_plio input2_sumMM; + adf::output_plio output_sumMM; + + + sumMM() { + + // input and output port + input1_sumMM = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + input2_sumMM = adf::input_plio::create(adf::plio_32_bits, "data/input2.txt"); + output_sumMM = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + + + // Kernel definition + sumMMKernel = adf::kernel::create(L1::sumMM); + + // source kernel + adf::source(sumMMKernel) = "sumMM/sumMM.cpp"; + + + // connections + adf::connect(input1_sumMM.out[0], sumMMKernel.in[0]); + adf::connect(input2_sumMM.out[0], sumMMKernel.in[1]); + adf::connect(sumMMKernel.out[0], output_sumMM.in[0]); + + + // setting kernel ratio + adf::runtime(sumMMKernel) = KERNEL_RATIO; + + + // Config + adf::dimensions(sumMMKernel.in[0]) = {sumMM_DIM}; + adf::dimensions(sumMMKernel.in[1]) = {sumMM_DIM}; + adf::dimensions(sumMMKernel.out[0]) = {sumMM_DIM}; + } + + private: + // Kernel declaration + adf::kernel sumMMKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/sumMM/utils.mk b/ultrasound/L2/tests/sumMM/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/sumMM/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/sumVS/Makefile b/ultrasound/L2/tests/sumVS/Makefile new file mode 100644 index 0000000000..738c95fbe1 --- /dev/null +++ b/ultrasound/L2/tests/sumVS/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/sumVS/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/sumVS/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/sumVS/data/input1.txt b/ultrasound/L2/tests/sumVS/data/input1.txt new file mode 100644 index 0000000000..a0e05797df --- /dev/null +++ b/ultrasound/L2/tests/sumVS/data/input1.txt @@ -0,0 +1,256 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 \ No newline at end of file diff --git a/ultrasound/L2/tests/sumVS/data/sumVS_golden b/ultrasound/L2/tests/sumVS/data/sumVS_golden new file mode 100644 index 0000000000..9c3302cfee --- /dev/null +++ b/ultrasound/L2/tests/sumVS/data/sumVS_golden @@ -0,0 +1,128 @@ +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/sumVS/description.json b/ultrasound/L2/tests/sumVS/description.json new file mode 100644 index 0000000000..c87de3cb80 --- /dev/null +++ b/ultrasound/L2/tests/sumVS/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 sumVS Test", + "description": "sumVS Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/sumVS/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/sumVS/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/sumVS/test.cpp b/ultrasound/L2/tests/sumVS/test.cpp new file mode 100644 index 0000000000..9b1c2868a5 --- /dev/null +++ b/ultrasound/L2/tests/sumVS/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::sumVS g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/sumVS/test.hpp b/ultrasound/L2/tests/sumVS/test.hpp new file mode 100644 index 0000000000..73cf03342a --- /dev/null +++ b/ultrasound/L2/tests/sumVS/test.hpp @@ -0,0 +1,62 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class sumVS : public adf::graph { + public: + adf::input_plio input1_sumVS; + adf::input_plio input2_sumVS; + adf::output_plio output_sumVS; + + sumVS() { + // input & output plio + input1_sumVS = adf::input_plio::create("input1_sumVS", adf::plio_32_bits, "data/input1.txt"); + input2_sumVS = adf::input_plio::create("input2_sumVS", adf::plio_32_bits, "data/input1.txt"); + output_sumVS = adf::output_plio::create("output_sumVS", adf::plio_32_bits, "data/output.txt"); + + // kernel definition + sumVSKernel = adf::kernel::create(L1::sumVSStream); + + // source kernel + adf::source(sumVSKernel) = "sumVS/sumVS.cpp"; + + // connections + adf::connect(input1_sumVS.out[0], sumVSKernel.in[0]); + adf::connect(input2_sumVS.out[0], sumVSKernel.in[1]); + adf::connect(sumVSKernel.out[0], output_sumVS.in[0]); + + // setting kernel ratio + adf::runtime(sumVSKernel) = KERNEL_RATIO; + + // Config + adf::dimensions(sumVSKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumVSKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(sumVSKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel sumVSKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/sumVS/utils.mk b/ultrasound/L2/tests/sumVS/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/sumVS/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/sumVV/Makefile b/ultrasound/L2/tests/sumVV/Makefile new file mode 100644 index 0000000000..ddb06623e6 --- /dev/null +++ b/ultrasound/L2/tests/sumVV/Makefile @@ -0,0 +1,336 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b. User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= aarch64 + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := xilinx_vck190_base_202220_1 +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS ?= +XILINX_VITIS_AIELIBS ?= +ifneq ($(wildcard $(XILINX_VITIS)/aietools/.*),) +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +XILINX_VITIS_AIELIBS := -L$(XILINX_VITIS_AIETOOLS)/lib/lnx64.o -ladf_api_xrt +else +XILINX_VITIS_AIELIBS := -L$(XILINX_VITIS_AIETOOLS)/lib/aarch64.o -ladf_api_xrt +endif +else +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/cardano +XILINX_VITIS_AIELIBS:= -lcardano_api_xrt -lxaiengine -lxrt_core +endif +CXXFLAGS += -I$(XILINX_VITIS_AIETOOLS)/include +LDFLAGS += $(XILINX_VITIS_AIELIBS) +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += -I $(XILINX_VITIS_AIETOOLS)/include +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +########################## Setting up Host Variables ########################## +ifeq ($(TARGET),sw_emu) +CXXFLAGS += -D SW_EMU_TEST +endif +ifeq ($(TARGET),hw_emu) +CXXFLAGS += -D HW_EMU_TEST +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/sumVV/test.cpp + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := +DATA_DIR := $(XFLIB_DIR)/L2/tests/sumVV/data +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +#3. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=./Work + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=./Work --profile + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS $(CUR_DIR)/Work $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/sumVV/data/input1.txt b/ultrasound/L2/tests/sumVV/data/input1.txt new file mode 100644 index 0000000000..31bad7f7b6 --- /dev/null +++ b/ultrasound/L2/tests/sumVV/data/input1.txt @@ -0,0 +1,256 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/sumVV/data/input2.txt b/ultrasound/L2/tests/sumVV/data/input2.txt new file mode 100644 index 0000000000..31bad7f7b6 --- /dev/null +++ b/ultrasound/L2/tests/sumVV/data/input2.txt @@ -0,0 +1,256 @@ +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 +1 +2 +3 +-4 +5 +6 +7 +8 +-9 +-10 +11 +-12 +13 +14 +15 +-16 \ No newline at end of file diff --git a/ultrasound/L2/tests/sumVV/data/sumVV_golden b/ultrasound/L2/tests/sumVV/data/sumVV_golden new file mode 100644 index 0000000000..169b3217b3 --- /dev/null +++ b/ultrasound/L2/tests/sumVV/data/sumVV_golden @@ -0,0 +1,128 @@ +2.000000000e+00 +4.000000000e+00 +6.000000000e+00 +-8.000000000e+00 +1.000000000e+01 +1.200000000e+01 +1.400000000e+01 +1.600000000e+01 +-1.800000000e+01 +-2.000000000e+01 +2.200000000e+01 +-2.400000000e+01 +2.600000000e+01 +2.800000000e+01 +3.000000000e+01 +-3.200000000e+01 +2.000000000e+00 +4.000000000e+00 +6.000000000e+00 +-8.000000000e+00 +1.000000000e+01 +1.200000000e+01 +1.400000000e+01 +1.600000000e+01 +-1.800000000e+01 +-2.000000000e+01 +2.200000000e+01 +-2.400000000e+01 +2.600000000e+01 +2.800000000e+01 +3.000000000e+01 +-3.200000000e+01 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/sumVV/description.json b/ultrasound/L2/tests/sumVV/description.json new file mode 100644 index 0000000000..e4ccb70ad9 --- /dev/null +++ b/ultrasound/L2/tests/sumVV/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 sumVV Test", + "description": "sumVV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/sumVV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/sumVV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/sumVV/test.cpp b/ultrasound/L2/tests/sumVV/test.cpp new file mode 100644 index 0000000000..a6005b28a1 --- /dev/null +++ b/ultrasound/L2/tests/sumVV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::sumVV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/sumVV/test.hpp b/ultrasound/L2/tests/sumVV/test.hpp new file mode 100644 index 0000000000..7f8394f4d3 --- /dev/null +++ b/ultrasound/L2/tests/sumVV/test.hpp @@ -0,0 +1,59 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" +namespace us { +namespace L2 { + +template +class sumVV : public adf::graph { + public: + adf::input_plio input1_sumVV; + adf::input_plio input2_sumVV; + adf::output_plio output_sumVV; + + sumVV() { + // input & output plio + input1_sumVV = adf::input_plio::create("input1_sumVV", adf::plio_32_bits, "data/input1.txt"); + input2_sumVV = adf::input_plio::create("input2_sumVV", adf::plio_32_bits, "data/input2.txt"); + output_sumVV = adf::output_plio::create("output_sumVV", adf::plio_32_bits, "data/output.txt"); + + // kernel definition + sumVVKernel = adf::kernel::create(L1::sumVV); + adf::source(sumVVKernel) = "sumVV/sumVV.cpp"; + + // connections + adf::connect(input1_sumVV.out[0], sumVVKernel.in[0]); + adf::connect(input2_sumVV.out[0], sumVVKernel.in[1]); + adf::connect(sumVVKernel.out[0], output_sumVV.in[0]); + + // setting kernel ratio + adf::runtime(sumVVKernel) = KERNEL_RATIO; + + // Config + adf::dimensions(sumVVKernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumVVKernel.in[1]) = {DIM_VECTOR_}; + adf::dimensions(sumVVKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel sumVVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/sumVV/utils.mk b/ultrasound/L2/tests/sumVV/utils.mk new file mode 100644 index 0000000000..49ad0db7ef --- /dev/null +++ b/ultrasound/L2/tests/sumVV/utils.mk @@ -0,0 +1,328 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +# 1) for versal flow from 2022.1 +DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(DEVICE_TYPE), versal) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# device2xsa - create a filesystem friendly name from device name +# $(1) - full name of device +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/sum_axis_1/Makefile b/ultrasound/L2/tests/sum_axis_1/Makefile new file mode 100644 index 0000000000..c05b641fbf --- /dev/null +++ b/ultrasound/L2/tests/sum_axis_1/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/sum_axis_1/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/sum_axis_1/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/sum_axis_1/data/input1.txt b/ultrasound/L2/tests/sum_axis_1/data/input1.txt new file mode 100644 index 0000000000..2a148c8e2d --- /dev/null +++ b/ultrasound/L2/tests/sum_axis_1/data/input1.txt @@ -0,0 +1,1024 @@ +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 +1 +2 +3 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/sum_axis_1/data/sum_axis_1_golden b/ultrasound/L2/tests/sum_axis_1/data/sum_axis_1_golden new file mode 100644 index 0000000000..c79eef4929 --- /dev/null +++ b/ultrasound/L2/tests/sum_axis_1/data/sum_axis_1_golden @@ -0,0 +1,32 @@ +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 diff --git a/ultrasound/L2/tests/sum_axis_1/description.json b/ultrasound/L2/tests/sum_axis_1/description.json new file mode 100644 index 0000000000..a7440a5f6d --- /dev/null +++ b/ultrasound/L2/tests/sum_axis_1/description.json @@ -0,0 +1,60 @@ +{ + "name": "L1 sum_axis_1 Test", + "description": "sum_axis_1 Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/sum_axis_1/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/sum_axis_1/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": 300 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} \ No newline at end of file diff --git a/ultrasound/L2/tests/sum_axis_1/test.cpp b/ultrasound/L2/tests/sum_axis_1/test.cpp new file mode 100644 index 0000000000..62cbd11677 --- /dev/null +++ b/ultrasound/L2/tests/sum_axis_1/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::sumAxis1 g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/sum_axis_1/test.hpp b/ultrasound/L2/tests/sum_axis_1/test.hpp new file mode 100644 index 0000000000..444462a361 --- /dev/null +++ b/ultrasound/L2/tests/sum_axis_1/test.hpp @@ -0,0 +1,58 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class sumAxis1 : public adf::graph { + public: + adf::input_plio input1_sumAxis1; + adf::output_plio output_sumAxis1; + + sumAxis1() { + // input and output port + input1_sumAxis1 = adf::input_plio::create(adf::plio_32_bits, "data/input1.txt"); + output_sumAxis1 = adf::output_plio::create(adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + sumAxis1Kernel = adf::kernel::create(L1::sum_axis_1); + + // connections + adf::connect(input1_sumAxis1.out[0], sumAxis1Kernel.in[0]); + adf::connect(sumAxis1Kernel.out[0], output_sumAxis1.in[0]); + + // source kernel + adf::source(sumAxis1Kernel) = "sum_axis_1/sum_axis_1.cpp"; + + // setting kernel ratio + adf::runtime(sumAxis1Kernel) = KERNEL_RATIO; + + // Config + adf::dimensions(sumAxis1Kernel.in[0]) = {DIM_VECTOR_}; + adf::dimensions(sumAxis1Kernel.out[0]) = {DIM_MATRIX_}; + } + + private: + // Kernel declaration + adf::kernel sumAxis1Kernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/sum_axis_1/utils.mk b/ultrasound/L2/tests/sum_axis_1/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/sum_axis_1/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L2/tests/tileV/Makefile b/ultrasound/L2/tests/tileV/Makefile new file mode 100644 index 0000000000..318cd409c1 --- /dev/null +++ b/ultrasound/L2/tests/tileV/Makefile @@ -0,0 +1,355 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L2/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += + +else + +endif + +######################### binary container global settings ########################## + +############################## Setting Rules for AIE (Building Kernels) ################## +$(AIE_CONTAINER): $(XFLIB_DIR)/L2/tests/tileV/test.cpp $(INST_FILES) + $(ECHO) "Compiling: libadf.a" + mkdir -p $(dir $@) + $(AIECXX) $(AIE_CXXFLAGS) $^ + mv ./libadf.a $(AIE_CONTAINER) + +############################## Setting Rules for Host (Building Host Executable) ############################## +$(EXE_FILE): $(EXE_FILE_DEPS) + mkdir -p $(BUILD_DIR) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) + +$(EMCONFIG): + emconfigutil --platform $(XPLATFORM) --od $(BUILD_DIR) + +############################## Preparing sdcard folder ############################## +ifeq ($(SD_CARD_NEEDED), on) +RUN_SCRIPT := $(BUILD_DIR)/run_script.sh +$(RUN_SCRIPT): + rm -rf $(RUN_SCRIPT) + @echo 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LIBRARY_PATH)' >> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(XFLIB_DIR)/L2/tests/tileV/data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh \ No newline at end of file diff --git a/ultrasound/L2/tests/tileV/data/input1.txt b/ultrasound/L2/tests/tileV/data/input1.txt new file mode 100644 index 0000000000..b17865743d --- /dev/null +++ b/ultrasound/L2/tests/tileV/data/input1.txt @@ -0,0 +1,4 @@ +1 +2 +3 +4 \ No newline at end of file diff --git a/ultrasound/L2/tests/tileV/data/tileV_golden b/ultrasound/L2/tests/tileV/data/tileV_golden new file mode 100644 index 0000000000..9871fc1b87 --- /dev/null +++ b/ultrasound/L2/tests/tileV/data/tileV_golden @@ -0,0 +1,128 @@ +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +1.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L2/tests/tileV/description.json b/ultrasound/L2/tests/tileV/description.json new file mode 100644 index 0000000000..7253090619 --- /dev/null +++ b/ultrasound/L2/tests/tileV/description.json @@ -0,0 +1,63 @@ +{ + "name": "L1 tileV Test", + "description": "tileV Test", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + } + } + } + }, + "data": [ + "LIB_DIR/L2/tests/tileV/data" + ], + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L2/tests/tileV/test.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 32768, + "max_time_min": { + "vitis_aie_sim": 470, + "vitis_aie_x86sim": 300 + } + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim" + ], + "category": "canary" + } +} diff --git a/ultrasound/L2/tests/tileV/test.cpp b/ultrasound/L2/tests/tileV/test.cpp new file mode 100644 index 0000000000..80c6370d47 --- /dev/null +++ b/ultrasound/L2/tests/tileV/test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test.hpp" + +us::L2::tileV g; + +int main(void) { + g.init(); + + g.run(1); + + g.end(); + + return 0; +} diff --git a/ultrasound/L2/tests/tileV/test.hpp b/ultrasound/L2/tests/tileV/test.hpp new file mode 100644 index 0000000000..7d384a3375 --- /dev/null +++ b/ultrasound/L2/tests/tileV/test.hpp @@ -0,0 +1,54 @@ +/* + * Copyright 2021 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "kernels.hpp" + +namespace us { +namespace L2 { + +template +class tileV : public adf::graph { + public: + adf::output_plio output_tileV; + + tileV() { + // input and output port + output_tileV = adf::output_plio::create("output_tileV", adf::plio_32_bits, "data/output.txt"); + + // Kernel definition + tileVKernel = adf::kernel::create(L1::tileVApo); + + // source kernel + adf::source(tileVKernel) = "tileV/tileV.cpp"; + + // connections + adf::connect(tileVKernel.out[0], output_tileV.in[0]); + + // setting kernel ratio + adf::runtime(tileVKernel) = KERNEL_RATIO; + + // Setting frame depth + adf::dimensions(tileVKernel.out[0]) = {DIM_VECTOR_}; + } + + private: + // Kernel declaration + adf::kernel tileVKernel; +}; +} // namespace L2 +} // namespace us diff --git a/ultrasound/L2/tests/tileV/utils.mk b/ultrasound/L2/tests/tileV/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L2/tests/tileV/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L3/README.md b/ultrasound/L3/README.md new file mode 100644 index 0000000000..0e3d5c0524 --- /dev/null +++ b/ultrasound/L3/README.md @@ -0,0 +1,150 @@ +## Ultrasound Library - Level 3 (L3) + +The level 3 of Vitis Ultrasound Library contains the host-callable kernels. For more details information, please reference to L2 User Guide in the document for usage and design information. + +## Overview of APIs +The L3 APIs are the complete beamformer composed of the units provided in L2. There are three types of beamformer provided: SA, PW and ScanLine. + +### ScanLine Beamformer + +This beamformer is a variant of the one used in PW where the difference consists in the receiver delay computation. As the graph is obtained by the composition of L2 libraries, it will have the summation of the components in I/O of the L2 libraries: + +- **Graph Inputs**: + - `start_positions`: the position which we start the investigation in cartesian coordinate; + - `directions`: X-Y-Z values of propagation of the spherical or planar wave emitted; + - `samples_arange`: array with the index of the rf-data; + - `image_points_from_PL`: the result of Image Points; + - `image_points_from_PL2`: the result of Image Points; + - `tx_def_ref_point`: X-Y-Z array with the reference point of the investigation for that iteration; + - `tx_def_delay_distance`: X-Y-Z array which represent our absolute distance with respect to our focus; + - `tx_def_delay_distance2`: X-Y-Z array which represent our absolute distance with respect to our focus; + - `tx_def_focal_point`: X-Y-Z array which represent our focus; + - `t_start`: The starting time of emission; + - `apo_ref_0`: X component of the vector of apodization reference; + - `xdc_def_0`: X component of the vector which represent the transducer positions; + - `apo_ref_1`: Y component of the vector of apodization reference; + - `xdc_def_1`: Y component of the vector which represent the transducer positions; + - `image_points_from_PL_2`: Result of Image Points; + - `delay_from_PL`: Result of Delay; + - `xdc_def_positions`: X-Y-Z vector which represents the positions of our transducers in the probe; + - `sampling_frequency`: The sampling frequency of the probe; + - `image_points`: Result of Image Points; + - `apodization_reference`: X-Y-Z vector which represents the positions of our apodization reference; + - `apo_distance_k`: Result of Focusing; + - `F_number`: The selected F number for the application; + - `P1`: First point to be interpolated; + - `P2`: Second point to be interpolated; + - `P3`: Second point to be interpolated; + - `P4`: Third point to be interpolated; + - `P5`: Third point to be interpolated; + - `P6`: Fourth point to be interpolated; +- **Graph Outputs**: + - `Image Points`: A Nx4 matrix which represents our points to analyze; + - `delay_to_PL`: A vector which represents our time delay per point to analyze; + - `focusing_output`: A vector which represents apodization distance per transducer; + - `samples_to_PL`: A vector which represents our valid entries in the rf-data vector; + - `apodization`: A vector which represents our Hanning Window for the reference point chosen; + - `C`: A vector with the result of the interpolation + +### PW Beamformer + +This beamformer is the one used to compute PW beamformation. As the graph is obtained by the composition of L2 libraries, it will have the summation of the components in I/O of the L2 libraries: + +- **Graph Inputs**: + - `start_positions`: the position which we start the investigation in cartesian coordinate; + - `directions`: X-Y-Z values of propagation of the spherical or planar wave emitted; + - `samples_arange`: array with the index of the rf-data; + - `image_points_from_PL`: the result of Image Points; + - `tx_def_ref_point`: X-Y-Z array with the reference point of the investigation for that iteration; + - `t_start`: The starting time of emission; + - `apo_ref_0`: X component of the vector of apodization reference; + - `xdc_def_0`: X component of the vector which represent the transducer positions; + - `apo_ref_1`: Y component of the vector of apodization reference; + - `xdc_def_1`: Y component of the vector which represent the transducer positions; + - `image_points_from_PL_2`: Result of Image Points; + - `delay_from_PL`: Result of Delay; + - `xdc_def_positions`: X-Y-Z vector which represents the positions of our transducers in the probe; + - `sampling_frequency`: The sampling frequency of the probe; + - `image_points`: Result of Image Points; + - `apodization_reference`: X-Y-Z vector which represents the positions of our apodization reference; + - `apo_distance_k`: Result of Focusing; + - `F_number`: The selected F number for the application; + - `P1`: First point to be interpolated; + - `P2`: Second point to be interpolated; + - `P3`: Second point to be interpolated; + - `P4`: Third point to be interpolated; + - `P5`: Third point to be interpolated; + - `P6`: Fourth point to be interpolated; +- **Graph Outputs**: + - `Image Points`: A Nx4 matrix which represents our points to analyze; + - `delay_to_PL`: A vector which represents our time delay per point to analyze; + - `focusing_output`: A vector which represents apodization distance per transducer; + - `samples_to_PL`: A vector which represents our valid entries in the rf-data vector; + - `apodization`: A vector which represents our Hanning Window for the reference point chosen; + - `C`: A vector with the result of the interpolation + +### SA Beamformer + +This beamformer is the one used to compute SA beamformation. As the graph is obtained by the composition of L2 libraries, it will have the summation of the components in I/O of the L2 libraries: + +- **Graph Inputs**: + - `start_positions`: the position which we start the investigation in cartesian coordinate; + - `directions`: X-Y-Z values of propagation of the spherical or planar wave emitted; + - `samples_arange`: array with the index of the rf-data; + - `image_points_from_PL`: the result of Image Points; + - `image_points_from_PL2`: the result of Image Points; + - `tx_def_ref_point`: X-Y-Z array with the reference point of the investigation for that iteration; + - `tx_def_delay_distance`: X-Y-Z array which represent our absolute distance with respect to our focus; + - `tx_def_delay_distance2`: X-Y-Z array which represent our absolute distance with respect to our focus; + - `tx_def_focal_point`: X-Y-Z array which represent our focus; + - `t_start`: The starting time of emission; + - `apo_ref_0_tx`: X component of the vector of apodization reference; + - `img_points_0`: X component of the Image Points result; + - `apo_ref_1_tx`: Y component of the vector of apodization reference; + - `img_points_1`: Y component of the Image Points result; + - `image_points`: Result of Image Points; + - `apodization_reference_tx`: X-Y-Z vector which represents the positions of our apodization reference (transmission); + - `apo_distance_k_tx`: Result of Focusing_SA; + - `F_number`: The selected F number for the application; + - `apo_ref_0`: X component of the vector of apodization reference; + - `xdc_def_0`: X component of the vector which represent the transducer positions; + - `apo_ref_1`: Y component of the vector of apodization reference; + - `xdc_def_1`: Y component of the vector which represent the transducer positions; + - `image_points_from_PL_2`: Result of Image Points; + - `delay_from_PL`: Result of Delay; + - `xdc_def_positions`: X-Y-Z vector which represents the positions of our transducers in the probe; + - `sampling_frequency`: The sampling frequency of the probe; + - `image_points`: Result of Image Points; + - `apodization_reference`: X-Y-Z vector which represents the positions of our apodization reference; + - `apo_distance_k`: Result of Focusing; + - `F_number`: The selected F number for the application; + - `P1`: First point to be interpolated; + - `P2`: Second point to be interpolated; + - `P3`: Second point to be interpolated; + - `P4`: Third point to be interpolated; + - `P5`: Third point to be interpolated; + - `P6`: Fourth point to be interpolated; +- **Graph Outputs**: + - `Image Points`: A Nx4 matrix which represents our points to analyze; + - `delay_to_PL`: A vector which represents our time delay per point to analyze; + - `focusing_output_tx`: A vector which represents apodization distance in transmission; + - `apodization_tx`: A vector which represents our Hanning Window for the reference point chosen; + - `focusing_output`: A vector which represents apodization distance per transducer; + - `samples_to_PL`: A vector which represents our valid entries in the rf-data vector; + - `apodization`: A vector which represents our Hanning Window for the reference point chosen; + - `C`: A vector with the result of the interpolation + +## License +Copyright 2022 AMD, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/ultrasound/L3/include/common_PL.hpp b/ultrasound/L3/include/common_PL.hpp new file mode 100644 index 0000000000..33afbba59d --- /dev/null +++ b/ultrasound/L3/include/common_PL.hpp @@ -0,0 +1,28 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#define LINES_SIZE 41 +#define TRANSDUCERS_SIZE 128 +#define SPACE_DIMENSIONS_SIZE 4 +#define SIMD_DEPTH 4 +#define UPSAMPLES_SIZE SIMD_DEPTH +#define RFDATA_SIZE 2048 +#define SAMPLES_PROCESSED_AIE 32 +#define BURSTS_DATA_FOR_AIE_ITERATIONS (RFDATA_SIZE / SAMPLES_PROCESSED_AIE) diff --git a/ultrasound/L3/include/plane_wave.hpp b/ultrasound/L3/include/plane_wave.hpp new file mode 100644 index 0000000000..526c10a0ad --- /dev/null +++ b/ultrasound/L3/include/plane_wave.hpp @@ -0,0 +1,338 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 24 +#define OUTPUT_RANGE 6 + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + std::string line; + for (size = 0; std::getline(infile, line); ++size) + ; + + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "direction input is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +namespace us { +namespace L3 { + +template +void plane_wave(std::string xclbin_path, + std::string data_path, + float* res_out[OUTPUT_RANGE], + float res_out_size[OUTPUT_RANGE], + int ITER) { + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + // Input: image-points + file_set[0] = data_path + "start_positions.txt"; + file_set[1] = data_path + "directions.txt"; + file_set[2] = data_path + "samples_arange.txt"; + file_set[3] = data_path + "image_points.txt"; + file_set[4] = data_path + "tx_def_ref_point.txt"; + file_set[5] = data_path + "t_start.txt"; + file_set[6] = data_path + "apo_ref_0.txt"; + file_set[7] = data_path + "xdc_def_0.txt"; + file_set[8] = data_path + "apo_ref_1.txt"; + file_set[9] = data_path + "xdc_def_1.txt"; + file_set[10] = data_path + "image_points.txt"; + file_set[11] = data_path + "delay_from_PL.txt"; + file_set[12] = data_path + "xdc_def_positions.txt"; + file_set[13] = data_path + "sampling_frequency.txt"; + file_set[14] = data_path + "image_points.txt"; + file_set[15] = data_path + "apodization_reference.txt"; + file_set[16] = data_path + "apo_distance_k.txt"; + file_set[17] = data_path + "F_number.txt"; + file_set[18] = data_path + "P1.txt"; + file_set[19] = data_path + "P2.txt"; + file_set[20] = data_path + "P3.txt"; + file_set[21] = data_path + "P4.txt"; + file_set[22] = data_path + "P5.txt"; + file_set[23] = data_path + "P6.txt"; + + // image-points + sizeIn[0] = 4; // data_path + "start_positions.txt"; + sizeIn[1] = 4; // data_path + "directions.txt"; + sizeIn[2] = 32; // data_path + "samples_arange.txt"; + // delay_pw + sizeIn[3] = 128; // data_path + "image_points.txt"; + sizeIn[4] = 4; // data_path + "tx_def_ref_point.txt"; + sizeIn[5] = 32; // data_path + "t_start.txt"; + // focusing + sizeIn[6] = 32; // data_path + "apo_ref_0.txt"; + sizeIn[7] = 32; // data_path + "xdc_def_0.txt"; + sizeIn[8] = 32; // data_path + "apo_ref_1.txt"; + sizeIn[9] = 32; // data_path + "xdc_def_1.txt"; + // samples + sizeIn[10] = 128; // data_path + "image_points.txt"; + sizeIn[11] = 32; // data_path + "delay_from_PL.txt"; + sizeIn[12] = 4; // data_path + "xdc_def_positions.txt"; + sizeIn[13] = 32; // data_path + "sampling_frequency.txt"; + // apodization + sizeIn[14] = 128; // data_path + "image_points.txt"; + sizeIn[15] = 4; // data_path + "apodization_reference.txt"; + sizeIn[16] = 32; // data_path + "apo_distance_k.txt"; + sizeIn[17] = 4; // data_path + "F_number.txt"; + // interpolation + sizeIn[18] = 128; // data_path + "P1.txt"; + sizeIn[19] = 128; // data_path + "P2.txt"; + sizeIn[20] = 128; // data_path + "P3.txt"; + sizeIn[21] = 128; // data_path + "P4.txt"; + sizeIn[22] = 128; // data_path + "P5.txt"; + sizeIn[23] = 128; // data_path + "P6.txt"; + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + // mem data output length define + sizeOut[0] = 128; // image-points output + sizeOut[1] = 32; // delay output + sizeOut[2] = 32; // focusing output + sizeOut[3] = 32; // samples + sizeOut[4] = 32; // apodization + sizeOut[5] = 128; // interpolation + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + pw.init(); + std::cout << "graph init" << std::endl; + + // run all graphs + pw.run(ITER); + std::cout << "graph run" << std::endl; + + pw.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + // wait for run kernel done + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + ////////////////////////////////////////// + // wait for s2mm done + ////////////////////////////////////////// + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // sync output buffer + ////////////////////////////////////////// + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < res_out_size[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + res_out[k][i] = result_tmp; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); +} +} +} diff --git a/ultrasound/L3/include/scanline.hpp b/ultrasound/L3/include/scanline.hpp new file mode 100644 index 0000000000..e5535f8e14 --- /dev/null +++ b/ultrasound/L3/include/scanline.hpp @@ -0,0 +1,340 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 28 +#define OUTPUT_RANGE 6 + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "direction input is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +namespace us { +namespace L3 { + +template +void scanline(std::string xclbin_path, + std::string data_path, + float* res_out[OUTPUT_RANGE], + float res_out_size[OUTPUT_RANGE], + int ITER) { + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + file_set[0] = data_path + "start_positions.txt"; + file_set[1] = data_path + "directions.txt"; + file_set[2] = data_path + "samples_arange.txt"; + file_set[3] = data_path + "image_points.txt"; + file_set[4] = data_path + "image_points.txt"; + file_set[5] = data_path + "tx_def_delay_distance.txt"; + file_set[6] = data_path + "tx_def_delay_distance.txt"; + file_set[7] = data_path + "tx_def_ref_point.txt"; + file_set[8] = data_path + "tx_def_focal_point.txt"; + file_set[9] = data_path + "t_start.txt"; + file_set[10] = data_path + "apo_ref_0.txt"; + file_set[11] = data_path + "xdc_def_0.txt"; + file_set[12] = data_path + "apo_ref_1.txt"; + file_set[13] = data_path + "xdc_def_1.txt"; + file_set[14] = data_path + "image_points.txt"; + file_set[15] = data_path + "delay_from_PL.txt"; + file_set[16] = data_path + "xdc_def_positions.txt"; + file_set[17] = data_path + "sampling_frequency.txt"; + file_set[18] = data_path + "image_points.txt"; + file_set[19] = data_path + "apodization_reference.txt"; + file_set[20] = data_path + "apo_distance_k.txt"; + file_set[21] = data_path + "F_number.txt"; + file_set[22] = data_path + "P1.txt"; + file_set[23] = data_path + "P2.txt"; + file_set[24] = data_path + "P3.txt"; + file_set[25] = data_path + "P4.txt"; + file_set[26] = data_path + "P5.txt"; + file_set[27] = data_path + "P6.txt"; + + // image_points + sizeIn[0] = 4; // image-points + sizeIn[1] = 4; // directions + sizeIn[2] = 32; // samples + // delay + sizeIn[3] = 128; // image_points_from_PL + sizeIn[4] = 128; // image_points_from_PL2 + sizeIn[5] = 4; // tx_def_delay_distance + sizeIn[6] = 32; // tx_def_delay_distance2 + sizeIn[7] = 32; // tx_def_ref_point + sizeIn[8] = 4; // tx_def_focal_point + sizeIn[9] = 4; // t_start + // focusing + sizeIn[10] = 32; // data_path + "apo_ref_0.txt"; + sizeIn[11] = 32; // data_path + "xdc_def_0.txt"; + sizeIn[12] = 32; // data_path + "apo_ref_1.txt"; + sizeIn[13] = 32; // data_path + "xdc_def_1.txt"; + // samples + sizeIn[14] = 128; // image_points + sizeIn[15] = 32; // delay_from_PL + sizeIn[16] = 4; // xdc_def_positions + sizeIn[17] = 32; // sampling_frequency + // apodization + sizeIn[18] = 128; // image_points + sizeIn[19] = 4; // apodization_reference + sizeIn[20] = 32; // apo_distance_k + sizeIn[21] = 4; // F_number + // interpolation + sizeIn[22] = 128; // P1 + sizeIn[23] = 128; // P2 + sizeIn[24] = 128; // P3 + sizeIn[25] = 128; // P4 + sizeIn[26] = 128; // P5 + sizeIn[27] = 128; // P6 + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + // mem data output length define + sizeOut[0] = 128; // image-points output + sizeOut[1] = 32; // delay output + sizeOut[2] = 32; // focusing output + sizeOut[3] = 32; // samples + sizeOut[4] = 32; // apodization + sizeOut[5] = 128; // interpolation + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + scan.init(); + std::cout << "graph init" << std::endl; + + scan.run(ITER); + std::cout << "graph run" << std::endl; + + scan.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + // wait for run kernel done + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + ////////////////////////////////////////// + // wait for s2mm done + ////////////////////////////////////////// + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // sync output buffer + ////////////////////////////////////////// + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < res_out_size[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + res_out[k][i] = result_tmp; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); +} +} +} \ No newline at end of file diff --git a/ultrasound/L3/include/synthetic_aperture.hpp b/ultrasound/L3/include/synthetic_aperture.hpp new file mode 100644 index 0000000000..d6934e4056 --- /dev/null +++ b/ultrasound/L3/include/synthetic_aperture.hpp @@ -0,0 +1,338 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "graph.cpp" + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#define INPUT_RANGE 28 +#define OUTPUT_RANGE 6 + +static std::vector load_xclbin(xrtDeviceHandle device, const std::string& fnm) { + if (fnm.empty()) throw std::runtime_error("No xclbin specified"); + + // load bit stream + std::ifstream stream(fnm); + stream.seekg(0, stream.end); + size_t size = stream.tellg(); + stream.seekg(0, stream.beg); + + std::vector header(size); + stream.read(header.data(), size); + + auto top = reinterpret_cast(header.data()); + if (xrtDeviceLoadXclbin(device, top)) throw std::runtime_error("Xclbin loading failed"); + + return header; +} + +template +T* data_loading(std::string filename, int size) { + T* buffer; + + std::ifstream infile(filename, std::ios::in); + + if (infile.is_open()) { + std::string line; + for (size = 0; std::getline(infile, line); ++size) + ; + + // back to the beginning of file + infile.clear(); + infile.seekg(0, infile.beg); + + // data loading + buffer = new T[size]; + + for (int i = 0; i < size; i++) { + infile >> buffer[i]; + } + } else { + std::cout << "direction input is empty!" << std::endl; + } + + infile.close(); + + std::cout << "file:" << filename << " size:" << size << std::endl; + return buffer; +} + +namespace us { +namespace L3 { + +template +void synthetic_aperture(std::string xclbin_path, + std::string data_path, + float* res_out[OUTPUT_RANGE], + float res_out_size[OUTPUT_RANGE], + int ITER) { + ////////////////////////////////////////// + // Open xclbin + ////////////////////////////////////////// + auto dhdl = xrtDeviceOpen(0); // Open Device the local device + if (dhdl == nullptr) throw std::runtime_error("No valid device handle found. Make sure using right xclOpen index."); + auto xclbin = load_xclbin(dhdl, xclbin_path); + auto top = reinterpret_cast(xclbin.data()); + adf::registerXRT(dhdl, top->m_header.uuid); + + ////////////////////////////////////////// + // data loading + ////////////////////////////////////////// + // global + int sizeIn[INPUT_RANGE]; + int sizeOut[OUTPUT_RANGE]; + float* buf_mem[INPUT_RANGE]; + std::string file_set[INPUT_RANGE]; + + file_set[0] = data_path + "start_positions.txt"; + file_set[1] = data_path + "directions.txt"; + file_set[2] = data_path + "samples_arange.txt"; + file_set[3] = data_path + "image_points.txt"; + file_set[4] = data_path + "image_points.txt"; + file_set[5] = data_path + "tx_def_delay_distance.txt"; + file_set[6] = data_path + "tx_def_delay_distance.txt"; + file_set[7] = data_path + "tx_def_ref_point.txt"; + file_set[8] = data_path + "tx_def_focal_point.txt"; + file_set[9] = data_path + "t_start.txt"; + file_set[10] = data_path + "apo_ref_0.txt"; + file_set[11] = data_path + "xdc_def_0.txt"; + file_set[12] = data_path + "apo_ref_1.txt"; + file_set[13] = data_path + "xdc_def_1.txt"; + file_set[14] = data_path + "image_points.txt"; + file_set[15] = data_path + "apodization_reference.txt"; + file_set[16] = data_path + "apo_distance_k.txt"; + file_set[17] = data_path + "F_number.txt"; + file_set[18] = data_path + "image_points.txt"; + file_set[19] = data_path + "delay_from_PL.txt"; + file_set[20] = data_path + "xdc_def_positions.txt"; + file_set[21] = data_path + "sampling_frequency.txt"; + file_set[22] = data_path + "P1.txt"; + file_set[23] = data_path + "P2.txt"; + file_set[24] = data_path + "P3.txt"; + file_set[25] = data_path + "P4.txt"; + file_set[26] = data_path + "P5.txt"; + file_set[27] = data_path + "P6.txt"; + + sizeIn[0] = 4; // start_positions.txt + sizeIn[1] = 4; // directions.txt + sizeIn[2] = 32; // samples_arange.txt + sizeIn[3] = 128; // image_points.txt + sizeIn[4] = 128; // image_points.txt + sizeIn[5] = 4; // tx_def_delay_distance.txt + sizeIn[6] = 32; // tx_def_delay_distance.txt + sizeIn[7] = 4; // tx_def_ref_point.txt + sizeIn[8] = 4; // tx_def_focal_point.txt + sizeIn[9] = 4; // t_start.txt + sizeIn[10] = 32; // apo_ref_0.txt + sizeIn[11] = 32; // xdc_def_0.txt + sizeIn[12] = 32; // apo_ref_1.txt + sizeIn[13] = 32; // xdc_def_1.txt + sizeIn[14] = 128; // image_points.txt + sizeIn[15] = 4; // apodization_reference.txt + sizeIn[16] = 32; // apo_distance_k.txt + sizeIn[17] = 4; // F_number.txt + sizeIn[18] = 128; // image_points.txt + sizeIn[19] = 32; // delay_from_PL.txt + sizeIn[20] = 4; // xdc_def_positions.txt + sizeIn[21] = 32; // sampling_frequency.txt + sizeIn[22] = 128; // P1.txt + sizeIn[23] = 128; // P2.txt + sizeIn[24] = 128; // P3.txt + sizeIn[25] = 128; // P4.txt + sizeIn[26] = 128; // P5.txt + sizeIn[27] = 128; // P6.txt + + // mem data loading + for (int i = 0; i < INPUT_RANGE; i++) { + buf_mem[i] = data_loading(file_set[i], sizeIn[i]); + } + + // mem data output length define + sizeOut[0] = 128; // image-points output + sizeOut[1] = 32; // delay output + sizeOut[2] = 32; // focusing sa output + sizeOut[3] = 32; // apodization sa output + sizeOut[4] = 32; // samples + sizeOut[5] = 128; // interpolator + + ////////////////////////////////////////// + // input memory + // Allocating the input size of sizeIn to MM2S + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle in_bohdl_set[INPUT_RANGE]; + float* in_bomapped_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + in_bohdl_set[i] = xrtBOAlloc(dhdl, sizeIn[i] * sizeof(float), 0, 0); + in_bomapped_set[i] = reinterpret_cast(xrtBOMap(in_bohdl_set[i])); + memcpy(in_bomapped_set[i], buf_mem[i], sizeIn[i] * sizeof(float)); + std::cout << "Input memory" << i << " virtual addr 0x" << in_bomapped_set[i] << std::endl; + } + + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOSync(in_bohdl_set[i], XCL_BO_SYNC_BO_TO_DEVICE, sizeIn[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // output memory + // Allocating the output size of sizeOut to S2MM + // This is using low-level XRT call xclAllocBO to allocate the memory + ////////////////////////////////////////// + + xrtBufferHandle out_bohdl_set[OUTPUT_RANGE]; + float* out_bomapped_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + out_bohdl_set[i] = xrtBOAlloc(dhdl, sizeOut[i] * sizeof(float), 0, 0); + out_bomapped_set[i] = reinterpret_cast(xrtBOMap(out_bohdl_set[i])); + memset(out_bomapped_set[i], 0xABCDEF00, sizeOut[i] * sizeof(float)); + std::cout << "Output memory" << i << " virtual addr 0x " << out_bomapped_set[i] << std::endl; + } + + ////////////////////////////////////////// + // mm2s ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL mm2s + xrtKernelHandle mm2s_khdl_set[INPUT_RANGE]; + xrtRunHandle mm2s_rhdl_set[INPUT_RANGE]; + + for (int i = 0; i < INPUT_RANGE; i++) { + // get kl name + char kl_name[256]; + sprintf(kl_name, "mm2s%d", i + 1); + + // Open mm2s PL kernels and Set arguments for run + mm2s_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + mm2s_rhdl_set[i] = xrtRunOpen(mm2s_khdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 0, in_bohdl_set[i]); + xrtRunSetArg(mm2s_rhdl_set[i], 2, sizeIn[i]); + xrtRunStart(mm2s_rhdl_set[i]); + } + std::cout << "input kernel complete" << std::endl; + + ////////////////////////////////////////// + // s2mm ips + // Using the xrtPLKernelOpen function to manually control the PL Kernel + // that is outside of the AI Engine graph + ////////////////////////////////////////// + + // set xrt kernels & run kernels for PL s2mm + xrtKernelHandle s2mm_khdl_set[OUTPUT_RANGE]; + xrtRunHandle s2mm_rhdl_set[OUTPUT_RANGE]; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + // gen kernel name + char kl_name[256]; + sprintf(kl_name, "s2mm%d", i + 1); + + // Open s2mm PL kernels and Set arguments for run + s2mm_khdl_set[i] = xrtPLKernelOpen(dhdl, top->m_header.uuid, kl_name); + s2mm_rhdl_set[i] = xrtRunOpen(s2mm_khdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 0, out_bohdl_set[i]); + xrtRunSetArg(s2mm_rhdl_set[i], 2, sizeOut[i]); + xrtRunStart(s2mm_rhdl_set[i]); + } + std::cout << "output kernel complete" << std::endl; + + ////////////////////////////////////////// + // graph execution for AIE + ////////////////////////////////////////// + sa.init(); + std::cout << "graph init" << std::endl; + + sa.run(ITER); + std::cout << "graph run" << std::endl; + + sa.end(); + std::cout << "graph end" << std::endl; + + ////////////////////////////////////////// + // wait for mm2s1 & mm2s2 done + ////////////////////////////////////////// + + for (int i = 0; i < INPUT_RANGE; i++) { + // wait for run kernel done + auto state = xrtRunWait(mm2s_rhdl_set[i]); + std::cout << "mm2s" << i + 1 << " completed with status(" << state << ")\n"; + xrtRunClose(mm2s_rhdl_set[i]); + xrtKernelClose(mm2s_khdl_set[i]); + } + std::cout << "mm2s wait complete" << std::endl; + + for (int i = 0; i < OUTPUT_RANGE; i++) { + auto state = xrtRunWait(s2mm_rhdl_set[i]); + std::cout << "s2mm" << i + 1 << "completed with status(" << state << ")\n"; + xrtRunClose(s2mm_rhdl_set[i]); + xrtKernelClose(s2mm_khdl_set[i]); + } + std::cout << "s2mm wait compete" << std::endl; + + ////////////////////////////////////////// + // wait for s2mm done + ////////////////////////////////////////// + + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOSync(out_bohdl_set[i], XCL_BO_SYNC_BO_FROM_DEVICE, sizeOut[i] * sizeof(float), 0); + } + + ////////////////////////////////////////// + // sync output buffer + ////////////////////////////////////////// + for (int k = 0; k < OUTPUT_RANGE; k++) { + for (int i = 0; i < res_out_size[k]; i++) { + float result_tmp = (float)out_bomapped_set[k][i]; + res_out[k][i] = result_tmp; + } + } + + ////////////////////////////////////////// + // clean up XRT + ////////////////////////////////////////// + + std::cout << "Releasing remaining XRT objects...\n"; + + // intput handle and buffer clean + for (int i = 0; i < INPUT_RANGE; i++) { + xrtBOFree(in_bohdl_set[i]); + delete[] buf_mem[i]; + } + + // output handle clean + for (int i = 0; i < OUTPUT_RANGE; i++) { + xrtBOFree(out_bohdl_set[i]); + } + + // device close + xrtDeviceClose(dhdl); +} +} +} diff --git a/ultrasound/L3/meta/api.json b/ultrasound/L3/meta/api.json new file mode 100644 index 0000000000..9830454fb3 --- /dev/null +++ b/ultrasound/L3/meta/api.json @@ -0,0 +1,78 @@ +{ + "schema": "vitis_libraries_api_list_schema-1.0", + "api_list": [ + { + "api_name": "us::L3::plane_wave", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L3::plane_wave", + "display_name": "plane_wave", + "brief": "", + "target_domain": "", + "header_file_name": [ + "plane_wave.hpp" + ], + "search_paths": [ + "L3/include" + ], + "instance": "function", + "parameters": [ + { + "name": "TIER", + "type": "int" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L3::scanline", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L3::scanline", + "display_name": "scanline", + "brief": "", + "target_domain": "", + "header_file_name": [ + "scanline.hpp" + ], + "search_paths": [ + "L3/include" + ], + "instance": "function", + "parameters": [ + { + "name": "TIER", + "type": "int" + } + ], + "ports": [] + } + }, + { + "api_name": "us::L3::synthetic_aperture", + "spec": { + "schema": "vitis_libraries_api_list_schema-1.0", + "api_name": "us::L3::synthetic_aperture", + "display_name": "synthetic_aperture", + "brief": "", + "target_domain": "", + "header_file_name": [ + "synthetic_aperture.hpp" + ], + "search_paths": [ + "L3/include" + ], + "instance": "function", + "parameters": [ + { + "name": "TIER", + "type": "int" + } + ], + "ports": [] + } + } + ], + "target_domain": "" +} \ No newline at end of file diff --git a/ultrasound/L3/tests/README.md b/ultrasound/L3/tests/README.md new file mode 100644 index 0000000000..d9d55ba27f --- /dev/null +++ b/ultrasound/L3/tests/README.md @@ -0,0 +1,42 @@ +## Ultrasound Library - Level 3 (L3) + +### Setup Environment +```bash +#!/bin/bash +# setup vitis_22.2 env +source /Vitis/2022.2/settings64.sh +source /opt/xilinx/xrt/setup.sh +export PLATFORM_REPO_PATHS= +export DEVICE=xilinx_vck190_base_202220_1 +# set up your SYSROOT, ROOTFS and K_IMAGE PATH +export SYSROOT=/sw/versal/xilinx-versal-common-v2022.2/sysroots/aarch64-xilinx-linux/ +export ROOTFS=/sw/versal/xilinx-versal-common-v2022.2/rootfs.ext4 +export K_IMAGE=/sw/versal/xilinx-versal-common-v2022.2/Image +``` + +### Run a L3 Example +```bash +#!/bin/bash +cd L3/tests/scanline # scanline is an example case. Please change directory to any other cases in L3/tests if interested. +make help # show available make command +make run TARGET=x86sim # run aie x86sim flow +make run TARGET=aiesim # run aie aiesim flow +make run TARGET=sw_emu # run vitis sw_emu flow +make run TRAGET=hw_emu # run vitis hw_emu flow +make all TARGET=hw # build the entire program for hw_run +``` + +## License +Copyright 2022 AMD, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/ultrasound/L3/tests/plane_wave/Makefile b/ultrasound/L3/tests/plane_wave/Makefile new file mode 100644 index 0000000000..8e1870747c --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/Makefile @@ -0,0 +1,595 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L3/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= aarch64 + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := xilinx_vck190_base_202220_1 +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS ?= +XILINX_VITIS_AIELIBS ?= +ifneq ($(wildcard $(XILINX_VITIS)/aietools/.*),) +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +XILINX_VITIS_AIELIBS := -L$(XILINX_VITIS_AIETOOLS)/lib/lnx64.o -ladf_api_xrt +else +XILINX_VITIS_AIELIBS := -L$(XILINX_VITIS_AIETOOLS)/lib/aarch64.o -ladf_api_xrt +endif +else +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/cardano +XILINX_VITIS_AIELIBS:= -lcardano_api_xrt -lxaiengine -lxrt_core +endif +CXXFLAGS += -I$(XILINX_VITIS_AIETOOLS)/include +LDFLAGS += $(XILINX_VITIS_AIELIBS) +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += -I $(XILINX_VITIS_AIETOOLS)/include +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +########################## Setting up Host Variables ########################## +ifeq ($(TARGET),sw_emu) +CXXFLAGS += -D SW_EMU_TEST +endif +ifeq ($(TARGET),hw_emu) +CXXFLAGS += -D HW_EMU_TEST +endif + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L3/tests/plane_wave/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L3/include -I $(XFLIB_DIR)/L3/tests/plane_wave/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L3/tests/plane_wave/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L3/include -I $(XFLIB_DIR)/L3/tests/plane_wave/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +## workaround for opencv +#ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +#endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin plane_wave.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/plane_wave.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_mm2s5 += +VPP_FLAGS_mm2s5 += --hls.clock 100000000:mm2s5 +VPP_FLAGS_mm2s6 += +VPP_FLAGS_mm2s6 += --hls.clock 100000000:mm2s6 +VPP_FLAGS_mm2s7 += +VPP_FLAGS_mm2s7 += --hls.clock 100000000:mm2s7 +VPP_FLAGS_mm2s8 += +VPP_FLAGS_mm2s8 += --hls.clock 100000000:mm2s8 +VPP_FLAGS_mm2s9 += +VPP_FLAGS_mm2s9 += --hls.clock 100000000:mm2s9 +VPP_FLAGS_mm2s10 += +VPP_FLAGS_mm2s10 += --hls.clock 100000000:mm2s10 +VPP_FLAGS_mm2s11 += +VPP_FLAGS_mm2s11 += --hls.clock 100000000:mm2s11 +VPP_FLAGS_mm2s12 += +VPP_FLAGS_mm2s12 += --hls.clock 100000000:mm2s12 +VPP_FLAGS_mm2s13 += +VPP_FLAGS_mm2s13 += --hls.clock 100000000:mm2s13 +VPP_FLAGS_mm2s14 += +VPP_FLAGS_mm2s14 += --hls.clock 100000000:mm2s14 +VPP_FLAGS_mm2s15 += +VPP_FLAGS_mm2s15 += --hls.clock 100000000:mm2s15 +VPP_FLAGS_mm2s16 += +VPP_FLAGS_mm2s16 += --hls.clock 100000000:mm2s16 +VPP_FLAGS_mm2s17 += +VPP_FLAGS_mm2s17 += --hls.clock 100000000:mm2s17 +VPP_FLAGS_mm2s18 += +VPP_FLAGS_mm2s18 += --hls.clock 100000000:mm2s18 +VPP_FLAGS_mm2s19 += +VPP_FLAGS_mm2s19 += --hls.clock 100000000:mm2s19 +VPP_FLAGS_mm2s20 += +VPP_FLAGS_mm2s20 += --hls.clock 100000000:mm2s20 +VPP_FLAGS_mm2s21 += +VPP_FLAGS_mm2s21 += --hls.clock 100000000:mm2s21 +VPP_FLAGS_mm2s22 += +VPP_FLAGS_mm2s22 += --hls.clock 100000000:mm2s22 +VPP_FLAGS_mm2s23 += +VPP_FLAGS_mm2s23 += --hls.clock 100000000:mm2s23 +VPP_FLAGS_mm2s24 += +VPP_FLAGS_mm2s24 += --hls.clock 100000000:mm2s24 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 +VPP_FLAGS_s2mm2 += +VPP_FLAGS_s2mm2 += --hls.clock 100000000:s2mm2 +VPP_FLAGS_s2mm3 += +VPP_FLAGS_s2mm3 += --hls.clock 100000000:s2mm3 +VPP_FLAGS_s2mm4 += +VPP_FLAGS_s2mm4 += --hls.clock 100000000:s2mm4 +VPP_FLAGS_s2mm5 += +VPP_FLAGS_s2mm5 += --hls.clock 100000000:s2mm5 +VPP_FLAGS_s2mm6 += +VPP_FLAGS_s2mm6 += --hls.clock 100000000:s2mm6 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/plane_wave.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/plane_wave_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/plane_wave.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L3/tests/plane_wave/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +#3. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=./Work + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=./Work --profile + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/plane_wave.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(CUR_DIR)/Work $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) + +clean: cleanh diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s1.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s10.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s10.cpp new file mode 100644 index 0000000000..b0a033e406 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s10.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s10(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s11.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s11.cpp new file mode 100644 index 0000000000..d4a56b4bb6 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s11.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s11(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s12.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s12.cpp new file mode 100644 index 0000000000..cfeaca1009 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s12.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s12(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s13.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s13.cpp new file mode 100644 index 0000000000..903bb8c335 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s13.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s13(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s14.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s14.cpp new file mode 100644 index 0000000000..1b9b9e8306 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s14.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s14(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s15.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s15.cpp new file mode 100644 index 0000000000..f55603432a --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s15.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s15(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s16.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s16.cpp new file mode 100644 index 0000000000..402a0eb95d --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s16.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s16(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s17.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s17.cpp new file mode 100644 index 0000000000..1c230772cf --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s17.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s17(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s18.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s18.cpp new file mode 100644 index 0000000000..aadb7b12a9 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s18.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s18(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s19.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s19.cpp new file mode 100644 index 0000000000..bafa9e5013 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s19.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s19(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s2.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s20.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s20.cpp new file mode 100644 index 0000000000..f095a84c1e --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s20.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s20(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s21.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s21.cpp new file mode 100644 index 0000000000..fee6e75230 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s21.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s21(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s22.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s22.cpp new file mode 100644 index 0000000000..bf954f3077 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s22.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s22(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s23.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s23.cpp new file mode 100644 index 0000000000..c7343611a4 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s23.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s23(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s24.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s24.cpp new file mode 100644 index 0000000000..2b8d77f668 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s24.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s24(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s3.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s4.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s5.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s5.cpp new file mode 100644 index 0000000000..583828c713 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s6.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s6.cpp new file mode 100644 index 0000000000..172d9d16b5 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s7.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s7.cpp new file mode 100644 index 0000000000..b0a4a405aa --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s7.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s7(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s8.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s8.cpp new file mode 100644 index 0000000000..f89f755ec6 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s8.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s8(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s9.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s9.cpp new file mode 100644 index 0000000000..a779d2134c --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/mm2s9.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s9(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm1.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm2.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm2.cpp new file mode 100644 index 0000000000..3d340b899f --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm3.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm3.cpp new file mode 100644 index 0000000000..ffcc5aa5be --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm4.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm4.cpp new file mode 100644 index 0000000000..466ff74586 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm5.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm5.cpp new file mode 100644 index 0000000000..dee3325235 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm6.cpp b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm6.cpp new file mode 100644 index 0000000000..17c936f413 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PL_kernels/s2mm6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/plane_wave/PS_host/host.cpp b/ultrasound/L3/tests/plane_wave/PS_host/host.cpp new file mode 100644 index 0000000000..1c105b6822 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PS_host/host.cpp @@ -0,0 +1,151 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#include "plane_wave.hpp" + +#define INPUT_RANGE 24 +#define OUTPUT_RANGE 6 +#define ITER 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +void init_output_buffer(float* res_out[], float* res_out_size) { + /* for this test, assume 1 graph run in aie processing */ + + int golden_sizeOut[OUTPUT_RANGE]; + golden_sizeOut[0] = 128; // image-points output + golden_sizeOut[1] = 32; // delay output + golden_sizeOut[2] = 32; // focusing output + golden_sizeOut[3] = 32; // samples + golden_sizeOut[4] = 32; // apodization + golden_sizeOut[5] = 128; // interpolation + + // output buffer init + for (int i = 0; i < OUTPUT_RANGE; i++) { + int size = golden_sizeOut[i]; + res_out[i] = new float[size]; + } + + // size init + for (int i = 0; i < OUTPUT_RANGE; i++) { + res_out_size[i] = golden_sizeOut[i]; + } +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + // output result buffer + float* res_out[OUTPUT_RANGE]; + float res_out_size[OUTPUT_RANGE]; + + // init output buffer + init_output_buffer(res_out, res_out_size); + + // run aie application + us::L3::plane_wave(xclbin_path, data_path, res_out, res_out_size, ITER); + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "golden/image_points.txt"; + golden_file_set[1] = data_path + "golden/delay_to_PL.txt"; + golden_file_set[2] = data_path + "golden/focusing_output.txt"; + golden_file_set[3] = data_path + "golden/samples_to_PL.txt"; + golden_file_set[4] = data_path + "golden/apodization.txt"; + golden_file_set[5] = data_path + "golden/C.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + + golden_sizeOut[0] = 128; // image-points output + golden_sizeOut[1] = 32; // delay output + golden_sizeOut[2] = 32; // focusing output + golden_sizeOut[3] = 32; // samples + golden_sizeOut[4] = 32; // apodization + golden_sizeOut[5] = 128; // interpolation + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + std::cout << golden_file_set[k] << std::endl; + for (int i = 0; i < golden_sizeOut[k]; i++) { + float result_tmp = (float)res_out[k][i]; + float result_golden = (float)golden_buf_mem[k][i]; + if (result_tmp != result_golden) { + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + err_cnt++; + } + } + } + + for (int i = 0; i < OUTPUT_RANGE; i++) { + delete[] res_out[i]; + } + + // End + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} diff --git a/ultrasound/L3/tests/plane_wave/PS_host/host.hpp b/ultrasound/L3/tests/plane_wave/PS_host/host.hpp new file mode 100644 index 0000000000..e3f25f1d23 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/PS_host/host.hpp @@ -0,0 +1,33 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L3/tests/plane_wave/aie_graph/graph.cpp b/ultrasound/L3/tests/plane_wave/aie_graph/graph.cpp new file mode 100644 index 0000000000..2aa65bbd93 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/aie_graph/graph.cpp @@ -0,0 +1,202 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "imagePoints.hpp" +#include "delay_pw.hpp" +#include "focusing.hpp" +#include "samples.hpp" +#include "apodization.hpp" +#include "bSpline.hpp" + +namespace us { +namespace L3 { + +class plane_wave : public adf::graph { + public: + // IMAGE POINTS + adf::input_plio start_positions; + adf::input_plio directions; + adf::input_plio samples_arange; + adf::output_plio image_points_output; + // DELAY + adf::input_plio image_points_from_PL; + adf::input_plio tx_def_ref_point; + adf::input_plio t_start; + adf::output_plio delay_to_PL; + // FOCUSING + adf::input_plio apo_ref_0; + adf::input_plio xdc_def_0; + adf::input_plio apo_ref_1; + adf::input_plio xdc_def_1; + adf::output_plio focusing_output; + // SAMPLES + adf::input_plio image_points_from_PL_3; + adf::input_plio xdc_def_positions; + adf::input_plio sampling_frequency; + adf::input_plio delay_from_PL; + adf::output_plio samples_to_PL; + // APODIZATION + adf::input_plio image_points_apo; + adf::input_plio apodization_reference; + adf::input_plio apo_distance_k; + adf::input_plio F_number; + adf::output_plio apodization_output; + // INTERPOLATOR + adf::input_plio P1; + adf::input_plio P2; + adf::input_plio P3; + adf::input_plio P4; + adf::input_plio P5; + adf::input_plio P6; + adf::output_plio C; + + us::L2::imagePoints_graph<> img; + us::L2::delay_pw_graph<> d; + us::L2::focusing_graph<> foc; + us::L2::samples_graph<> sam; + us::L2::apodization_graph<> apo; + us::L2::bSpline_graph<> interp; + + plane_wave() { + // IMAGEPOINTS + start_positions = adf::input_plio::create("start_positions", adf::plio_32_bits, "data/start_positions.txt"); + directions = adf::input_plio::create("directions", adf::plio_32_bits, "data/directions.txt"); + samples_arange = adf::input_plio::create("samples_arange", adf::plio_32_bits, "data/samples_arange.txt"); + image_points_output = adf::output_plio::create("image_points", adf::plio_32_bits, "data/image_points.txt"); + + adf::connect<>(start_positions.out[0], img.start_positions); + adf::connect<>(samples_arange.out[0], img.samples_arange); + adf::connect<>(directions.out[0], img.directions); + adf::connect<>(img.image_points, image_points_output.in[0]); + + // DELAY + image_points_from_PL = + adf::input_plio::create("image_points_from_PL", adf::plio_32_bits, "data/image_points.txt"); + tx_def_ref_point = adf::input_plio::create("tx_def_ref_point", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + t_start = adf::input_plio::create("t_start", adf::plio_32_bits, "data/t_start.txt"); + delay_to_PL = adf::output_plio::create("delay_to_PL", adf::plio_32_bits, "data/delay_to_PL.txt"); + + adf::connect<>(image_points_from_PL.out[0], d.image_points_from_PL); + adf::connect<>(tx_def_ref_point.out[0], d.tx_def_reference_point); + adf::connect<>(t_start.out[0], d.t_start); + adf::connect<>(d.delay_to_PL, delay_to_PL.in[0]); + + // FOCUSING + apo_ref_0 = adf::input_plio::create("apo_ref_0", adf::plio_32_bits, "data/apo_ref_0.txt"); + xdc_def_0 = adf::input_plio::create("xdc_def_0", adf::plio_32_bits, "data/xdc_def_0.txt"); + apo_ref_1 = adf::input_plio::create("apo_ref_1", adf::plio_32_bits, "data/apo_ref_1.txt"); + xdc_def_1 = adf::input_plio::create("xdc_def_1", adf::plio_32_bits, "data/xdc_def_1.txt"); + focusing_output = adf::output_plio::create("focusing_output", adf::plio_32_bits, "data/focusing_output.txt"); + + adf::connect<>(apo_ref_0.out[0], foc.apo_ref_0); + adf::connect<>(xdc_def_0.out[0], foc.xdc_def_0); + adf::connect<>(apo_ref_1.out[0], foc.apo_ref_1); + adf::connect<>(xdc_def_1.out[0], foc.xdc_def_1); + adf::connect<>(foc.focusing_output, focusing_output.in[0]); + + // SAMPLES + image_points_from_PL_3 = + adf::input_plio::create("image_points_from_PL_3", adf::plio_32_bits, "data/image_points.txt"); + delay_from_PL = adf::input_plio::create("delay_from_PL", adf::plio_32_bits, "data/delay_from_PL.txt"); + xdc_def_positions = + adf::input_plio::create("xdc_def_positions", adf::plio_32_bits, "data/xdc_def_positions.txt"); + sampling_frequency = + adf::input_plio::create("sampling_frequency", adf::plio_32_bits, "data/sampling_frequency.txt"); + samples_to_PL = adf::output_plio::create("samples_to_PL", adf::plio_32_bits, "data/samples_to_PL.txt"); + + adf::connect<>(image_points_from_PL_3.out[0], sam.image_points_from_PL); + adf::connect<>(xdc_def_positions.out[0], sam.xdc_def_positions); + adf::connect<>(sampling_frequency.out[0], sam.sampling_frequency); + adf::connect<>(delay_from_PL.out[0], sam.delay_from_PL); + adf::connect<>(sam.samples_to_PL, samples_to_PL.in[0]); + + // APODIZATION + image_points_apo = + adf::input_plio::create("image_points_from_PL_4", adf::plio_32_bits, "data/image_points.txt"); + apodization_reference = + adf::input_plio::create("apodization_reference", adf::plio_32_bits, "data/apodization_reference.txt"); + apo_distance_k = adf::input_plio::create("apo_distance_k", adf::plio_32_bits, "data/apo_distance_k.txt"); + F_number = adf::input_plio::create("F_number", adf::plio_32_bits, "data/F_number.txt"); + apodization_output = adf::output_plio::create("apodization", adf::plio_32_bits, "data/apodization.txt"); + + adf::connect<>(image_points_apo.out[0], apo.image_points); + adf::connect<>(apodization_reference.out[0], apo.apodization_reference_i); + adf::connect<>(apo_distance_k.out[0], apo.apo_distance_k); + adf::connect<>(F_number.out[0], apo.F_number); + adf::connect<>(apo.apodization_output, apodization_output.in[0]); + + // INTERPOLATOR + P1 = adf::input_plio::create("P1", adf::plio_32_bits, "data/P1.txt"); + P2 = adf::input_plio::create("P2", adf::plio_32_bits, "data/P2.txt"); + P3 = adf::input_plio::create("P3", adf::plio_32_bits, "data/P3.txt"); + P4 = adf::input_plio::create("P4", adf::plio_32_bits, "data/P4.txt"); + P5 = adf::input_plio::create("P5", adf::plio_32_bits, "data/P5.txt"); + P6 = adf::input_plio::create("P6", adf::plio_32_bits, "data/P6.txt"); + C = adf::output_plio::create("C", adf::plio_32_bits, "data/C.txt"); + + adf::connect<>(P1.out[0], interp.P1); + adf::connect<>(P2.out[0], interp.P2); + adf::connect<>(P3.out[0], interp.P3); + adf::connect<>(P4.out[0], interp.P4); + adf::connect<>(P5.out[0], interp.P5); + adf::connect<>(P6.out[0], interp.P6); + adf::connect<>(interp.C, C.in[0]); + } +}; + +} // namespace L3 +} // namespace us + +us::L3::plane_wave pw; + +// TEST MAIN (EMULATION AIE) +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + /* + // INIT ALL GRAPHS + img.init(); + d.init(); + foc.init(); + sam.init(); + apo.init(); + interp.init(); + + // run all graphs + img.run(1); + d.run(1); + foc.run(1); + sam.run(1); + apo.run(1); + interp.run(1); + + // ENDING GRAPHS (CANNOT BE RE-INSTANTIATED) + img.end(); + d.end(); + foc.end(); + sam.end(); + apo.end(); + interp.end(); + */ + + pw.init(); + + pw.run(1); + + pw.end(); + + return 0; +} +#endif diff --git a/ultrasound/L3/tests/plane_wave/data/F_number.txt b/ultrasound/L3/tests/plane_wave/data/F_number.txt new file mode 100644 index 0000000000..b0f057e95a --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/F_number.txt @@ -0,0 +1,188 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 diff --git a/ultrasound/L3/tests/plane_wave/data/P0.txt b/ultrasound/L3/tests/plane_wave/data/P0.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/P0.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/plane_wave/data/P1.txt b/ultrasound/L3/tests/plane_wave/data/P1.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/P1.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/plane_wave/data/P2.txt b/ultrasound/L3/tests/plane_wave/data/P2.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/P2.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/plane_wave/data/P3.txt b/ultrasound/L3/tests/plane_wave/data/P3.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/P3.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/plane_wave/data/P4.txt b/ultrasound/L3/tests/plane_wave/data/P4.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/P4.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/plane_wave/data/P5.txt b/ultrasound/L3/tests/plane_wave/data/P5.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/P5.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/plane_wave/data/P6.txt b/ultrasound/L3/tests/plane_wave/data/P6.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/P6.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/plane_wave/data/apo_distance_k.txt b/ultrasound/L3/tests/plane_wave/data/apo_distance_k.txt new file mode 100644 index 0000000000..8bfe45aca9 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/apo_distance_k.txt @@ -0,0 +1,128 @@ +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 diff --git a/ultrasound/L3/tests/plane_wave/data/apo_ref_0.txt b/ultrasound/L3/tests/plane_wave/data/apo_ref_0.txt new file mode 100644 index 0000000000..d918d211c4 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/apo_ref_0.txt @@ -0,0 +1,192 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/apo_ref_1.txt b/ultrasound/L3/tests/plane_wave/data/apo_ref_1.txt new file mode 100644 index 0000000000..d918d211c4 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/apo_ref_1.txt @@ -0,0 +1,192 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/apodization_reference.txt b/ultrasound/L3/tests/plane_wave/data/apodization_reference.txt new file mode 100644 index 0000000000..bb4b72142c --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/apodization_reference.txt @@ -0,0 +1,156 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/delay_from_PL.txt b/ultrasound/L3/tests/plane_wave/data/delay_from_PL.txt new file mode 100644 index 0000000000..b6d16b0698 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/delay_from_PL.txt @@ -0,0 +1,206 @@ +-6.975e-06 +-6.97e-06 +-6.965e-06 +-6.96e-06 +-6.955e-06 +-6.95e-06 +-6.945e-06 +-6.94e-06 +-6.935e-06 +-6.93e-06 +-6.925e-06 +-6.92e-06 +-6.915e-06 +-6.91e-06 +-6.905e-06 +-6.9e-06 +-6.895e-06 +-6.89e-06 +-6.885e-06 +-6.88e-06 +-6.875e-06 +-6.87e-06 +-6.865e-06 +-6.86e-06 +-6.855e-06 +-6.85e-06 +-6.845e-06 +-6.84e-06 +-6.835e-06 +-6.83e-06 +-6.825e-06 +-6.82e-06 +-6.815e-06 +-6.81e-06 +-6.805e-06 +-6.8e-06 +-6.795e-06 +-6.79e-06 +-6.785e-06 +-6.78e-06 +-6.775e-06 +-6.77e-06 +-6.765e-06 +-6.76e-06 +-6.755e-06 +-6.75e-06 +-6.745e-06 +-6.74e-06 +-6.735e-06 +-6.73e-06 +-6.725e-06 +-6.72e-06 +-6.715e-06 +-6.71e-06 +-6.705e-06 +-6.7e-06 +-6.695e-06 +-6.69e-06 +-6.685e-06 +-6.68e-06 +-6.675e-06 +-6.67e-06 +-6.665e-06 +-6.66e-06 +-6.655e-06 +-6.65e-06 +-6.645e-06 +-6.64e-06 +-6.635e-06 +-6.63e-06 +-6.625e-06 +-6.62e-06 +-6.615e-06 +-6.61e-06 +-6.605e-06 +-6.6e-06 +-6.595e-06 +-6.59e-06 +-6.585e-06 +-6.58e-06 +-6.575e-06 +-6.57e-06 +-6.565e-06 +-6.56e-06 +-6.555e-06 +-6.55e-06 +-6.545e-06 +-6.54e-06 +-6.535e-06 +-6.53e-06 +-6.525e-06 +-6.52e-06 +-6.515e-06 +-6.51e-06 +-6.505e-06 +-6.5e-06 +-6.495e-06 +-6.49e-06 +-6.485e-06 +-6.48e-06 +-6.475e-06 +-6.47e-06 +-6.465e-06 +-6.46e-06 +-6.455e-06 +-6.45e-06 +-6.445e-06 +-6.44e-06 +-6.435e-06 +-6.43e-06 +-6.425e-06 +-6.42e-06 +-6.415e-06 +-6.41e-06 +-6.405e-06 +-6.4e-06 +-6.395e-06 +-6.39e-06 +-6.385e-06 +-6.38e-06 +-6.375e-06 +-6.37e-06 +-6.365e-06 +-6.36e-06 +-6.355e-06 +-6.35e-06 +-6.345e-06 +-6.34e-06 +-6.335e-06 +-6.33e-06 +-6.325e-06 +-6.32e-06 +-6.315e-06 +-6.31e-06 +-6.305e-06 +-6.3e-06 +-6.295e-06 +-6.29e-06 +-6.285e-06 +-6.28e-06 +-6.275e-06 +-6.27e-06 +-6.265e-06 +-6.26e-06 +-6.255e-06 +-6.25e-06 +-6.245e-06 +-6.24e-06 +-6.235e-06 +-6.23e-06 +-6.225e-06 +-6.22e-06 +-6.215e-06 +-6.21e-06 +-6.205e-06 +-6.2e-06 +-6.195e-06 +-6.19e-06 +-6.185e-06 +-6.18e-06 +-6.175e-06 +-6.17e-06 +-6.165e-06 +-6.16e-06 +-6.155e-06 +-6.15e-06 +-6.145e-06 +-6.14e-06 +-6.135e-06 +-6.13e-06 +-6.125e-06 +-6.12e-06 +-6.115e-06 +-6.11e-06 +-6.105e-06 +-6.1e-06 +-6.095e-06 +-6.09e-06 +-6.085e-06 +-6.08e-06 +-6.075e-06 +-6.07e-06 +-6.065e-06 +-6.06e-06 +-6.055e-06 +-6.05e-06 +-6.045e-06 +-6.04e-06 +-6.035e-06 +-6.03e-06 +-6.025e-06 +-6.02e-06 +-6.015e-06 +-6.01e-06 +-6.005e-06 +-6e-06 +-5.995e-06 +-5.99e-06 +-5.985e-06 +-5.98e-06 +-5.975e-06 +-5.97e-06 +-5.965e-06 +-5.96e-06 +-5.955e-06 +-5.95e-06 diff --git a/ultrasound/L3/tests/plane_wave/data/directions.txt b/ultrasound/L3/tests/plane_wave/data/directions.txt new file mode 100644 index 0000000000..564f5e2bb0 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/directions.txt @@ -0,0 +1,64 @@ +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/golden/C.txt b/ultrasound/L3/tests/plane_wave/data/golden/C.txt new file mode 100644 index 0000000000..9724bec91c --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/golden/C.txt @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.700000000e+01 +1.700000000e+01 +1.700000000e+01 +1.700000000e+01 +1.800000000e+01 +1.800000000e+01 +1.800000000e+01 +1.800000000e+01 +1.900000000e+01 +1.900000000e+01 +1.900000000e+01 +1.900000000e+01 +2.000000000e+01 +2.000000000e+01 +2.000000000e+01 +2.000000000e+01 +2.100000000e+01 +2.100000000e+01 +2.100000000e+01 +2.100000000e+01 +2.200000000e+01 +2.200000000e+01 +2.200000000e+01 +2.200000000e+01 +2.300000000e+01 +2.300000000e+01 +2.300000000e+01 +2.300000000e+01 +2.400000000e+01 +2.400000000e+01 +2.400000000e+01 +2.400000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.600000000e+01 +2.600000000e+01 +2.600000000e+01 +2.600000000e+01 +2.700000000e+01 +2.700000000e+01 +2.700000000e+01 +2.700000000e+01 +2.800000000e+01 +2.800000000e+01 +2.800000000e+01 +2.800000000e+01 +2.900000000e+01 +2.900000000e+01 +2.900000000e+01 +2.900000000e+01 +3.000000000e+01 +3.000000000e+01 +3.000000000e+01 +3.000000000e+01 +3.100000000e+01 +3.100000000e+01 +3.100000000e+01 +3.100000000e+01 +3.200000000e+01 +3.200000000e+01 +3.200000000e+01 +3.200000000e+01 diff --git a/ultrasound/L3/tests/plane_wave/data/golden/apodization.txt b/ultrasound/L3/tests/plane_wave/data/golden/apodization.txt new file mode 100644 index 0000000000..1d7ad2b972 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/golden/apodization.txt @@ -0,0 +1,32 @@ +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L3/tests/plane_wave/data/golden/delay_to_PL.txt b/ultrasound/L3/tests/plane_wave/data/golden/delay_to_PL.txt new file mode 100644 index 0000000000..602bb4fd06 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/golden/delay_to_PL.txt @@ -0,0 +1,32 @@ +-6.974999906e-06 +-6.969999959e-06 +-6.965000011e-06 +-6.960000064e-06 +-6.955000117e-06 +-6.949999715e-06 +-6.944999768e-06 +-6.939999821e-06 +-6.934999874e-06 +-6.929999927e-06 +-6.924999980e-06 +-6.920000033e-06 +-6.915000085e-06 +-6.909999684e-06 +-6.905000191e-06 +-6.899999789e-06 +-6.894999842e-06 +-6.889999895e-06 +-6.884999948e-06 +-6.879999546e-06 +-6.875000054e-06 +-6.870000107e-06 +-6.865000159e-06 +-6.859999758e-06 +-6.854999810e-06 +-6.849999863e-06 +-6.844999916e-06 +-6.839999969e-06 +-6.835000022e-06 +-6.829999620e-06 +-6.824999673e-06 +-6.820000181e-06 diff --git a/ultrasound/L3/tests/plane_wave/data/golden/focusing_output.txt b/ultrasound/L3/tests/plane_wave/data/golden/focusing_output.txt new file mode 100644 index 0000000000..0dd3697ad7 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/golden/focusing_output.txt @@ -0,0 +1,32 @@ +5.821200088e-03 +5.636400077e-03 +5.451600067e-03 +5.266800057e-03 +5.082000047e-03 +4.897200037e-03 +4.712400027e-03 +4.527600016e-03 +4.342800006e-03 +4.157999996e-03 +3.973199986e-03 +3.788399976e-03 +3.603599966e-03 +3.418799955e-03 +3.233999945e-03 +3.049199935e-03 +2.864399925e-03 +2.679599915e-03 +2.494799905e-03 +2.309999894e-03 +2.125199884e-03 +1.940399990e-03 +1.755599980e-03 +1.570799970e-03 +1.385999960e-03 +1.201199950e-03 +1.016400056e-03 +8.315999876e-04 +6.467999774e-04 +4.619999963e-04 +2.771999862e-04 +9.239999781e-05 diff --git a/ultrasound/L3/tests/plane_wave/data/golden/image_points.txt b/ultrasound/L3/tests/plane_wave/data/golden/image_points.txt new file mode 100644 index 0000000000..5f5fa35a3d --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/golden/image_points.txt @@ -0,0 +1,128 @@ +0.000000000e+00 +0.000000000e+00 +7.699999958e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.707699668e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.715399843e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.723099552e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.730799727e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.738499902e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.746199612e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.753899787e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.761599962e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.769299671e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.776999846e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.784700021e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.792399731e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.800099906e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.807799615e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.815499790e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.823199965e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.830900140e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.838599384e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.846299559e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.853999734e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.861699909e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.869400084e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.877100259e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.884799503e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.892499678e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.900199853e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.907900028e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.915600203e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.923299447e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.930999622e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.938699797e-03 +0.000000000e+00 diff --git a/ultrasound/L3/tests/plane_wave/data/golden/samples_to_PL.txt b/ultrasound/L3/tests/plane_wave/data/golden/samples_to_PL.txt new file mode 100644 index 0000000000..1889199664 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/golden/samples_to_PL.txt @@ -0,0 +1,32 @@ +-7.009420013e+01 +-6.919543457e+01 +-6.829649353e+01 +-6.739746094e+01 +-6.649819183e+01 +-6.559883881e+01 +-6.469939423e+01 +-6.379967499e+01 +-6.289991379e+01 +-6.200001526e+01 +-6.109993362e+01 +-6.019976044e+01 +-5.929936218e+01 +-5.839887238e+01 +-5.749824524e+01 +-5.659743500e+01 +-5.569653702e+01 +-5.479540634e+01 +-5.389423370e+01 +-5.299283600e+01 +-5.209148026e+01 +-5.118980789e+01 +-5.028808975e+01 +-4.938614273e+01 +-4.848401642e+01 +-4.758188629e+01 +-4.667957687e+01 +-4.577713013e+01 +-4.487454987e+01 +-4.397178268e+01 +-4.306888199e+01 +-4.216598129e+01 diff --git a/ultrasound/L3/tests/plane_wave/data/image_points.txt b/ultrasound/L3/tests/plane_wave/data/image_points.txt new file mode 100644 index 0000000000..838902f514 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/image_points.txt @@ -0,0 +1,399 @@ +0 +0 +0.0076923 +0 +0 +0 +0.0077 +0 +0 +0 +0.0077077 +0 +0 +0 +0.0077154 +0 +0 +0 +0.0077231 +0 +0 +0 +0.0077308 +0 +0 +0 +0.0077385 +0 +0 +0 +0.0077462 +0 +0 +0 +0.0077539 +0 +0 +0 +0.0077616 +0 +0 +0 +0.0077693 +0 +0 +0 +0.007777 +0 +0 +0 +0.0077847 +0 +0 +0 +0.0077924 +0 +0 +0 +0.0078001 +0 +0 +0 +0.0078078 +0 +0 +0 +0.0078155 +0 +0 +0 +0.0078232 +0 +0 +0 +0.0078309 +0 +0 +0 +0.0078386 +0 +0 +0 +0.0078463 +0 +0 +0 +0.007854 +0 +0 +0 +0.0078617 +0 +0 +0 +0.0078694 +0 +0 +0 +0.0078771 +0 +0 +0 +0.0078848 +0 +0 +0 +0.0078925 +0 +0 +0 +0.0079002 +0 +0 +0 +0.0079079 +0 +0 +0 +0.0079156 +0 +0 +0 +0.0079233 +0 +0 +0 +0.007931 +0 +0 +0 +0.0079387 +0 +0 +0 +0.0079464 +0 +0 +0 +0.0079541 +0 +0 +0 +0.0079618 +0 +0 +0 +0.0079695 +0 +0 +0 +0.0079772 +0 +0 +0 +0.0079849 +0 +0 +0 +0.0079926 +0 +0 +0 +0.0080003 +0 +0 +0 +0.008008 +0 +0 +0 +0.0080157 +0 +0 +0 +0.0080234 +0 +0 +0 +0.0080311 +0 +0 +0 +0.0080388 +0 +0 +0 +0.0080465 +0 +0 +0 +0.0080542 +0 +0 +0 +0.0080619 +0 +0 +0 +0.0080696 +0 +0 +0 +0.0080773 +0 +0 +0 +0.008085 +0 +0 +0 +0.0080927 +0 +0 +0 +0.0081004 +0 +0 +0 +0.0081081 +0 +0 +0 +0.0081158 +0 +0 +0 +0.0081235 +0 +0 +0 +0.0081312 +0 +0 +0 +0.0081389 +0 +0 +0 +0.0081466 +0 +0 +0 +0.0081543 +0 +0 +0 +0.008162 +0 +0 +0 +0.0081697 +0 +0 +0 +0.0081774 +0 +0 +0 +0.0081851 +0 +0 +0 +0.0081928 +0 +0 +0 +0.0082005 +0 +0 +0 +0.0082082 +0 +0 +0 +0.0082159 +0 +0 +0 +0.0082236 +0 +0 +0 +0.0082313 +0 +0 +0 +0.008239 +0 +0 +0 +0.0082467 +0 +0 +0 +0.0082544 +0 +0 +0 +0.0082621 +0 +0 +0 +0.0082698 +0 +0 +0 +0.0082775 +0 +0 +0 +0.0082852 +0 +0 +0 +0.0082929 +0 +0 +0 +0.0083006 +0 +0 +0 +0.0083083 +0 +0 +0 +0.008316 +0 +0 +0 +0.0083237 +0 +0 +0 +0.0083314 +0 +0 +0 +0.0083391 +0 +0 +0 +0.0083468 +0 +0 +0 +0.0083545 +0 +0 +0 +0.0083622 +0 +0 +0 +0.0083699 +0 +0 +0 +0.0083776 +0 +0 +0 +0.0083853 +0 +0 +0 +0.008393 +0 +0 +0 +0.0084007 +0 +0 +0 +0.0084084 +0 +0 +0 +0.0084161 +0 +0 +0 +0.0084238 +0 +0 +0 +0.0084315 +0 +0 +0 +0.0084392 +0 +0 +0 +0.0084469 +0 +0 +0 +0.0084546 diff --git a/ultrasound/L3/tests/plane_wave/data/samples_arange.txt b/ultrasound/L3/tests/plane_wave/data/samples_arange.txt new file mode 100644 index 0000000000..f765d696ea --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/samples_arange.txt @@ -0,0 +1,64 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 diff --git a/ultrasound/L3/tests/plane_wave/data/sampling_frequency.txt b/ultrasound/L3/tests/plane_wave/data/sampling_frequency.txt new file mode 100644 index 0000000000..51084d2137 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/sampling_frequency.txt @@ -0,0 +1,136 @@ +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 diff --git a/ultrasound/L3/tests/plane_wave/data/start_positions.txt b/ultrasound/L3/tests/plane_wave/data/start_positions.txt new file mode 100644 index 0000000000..d930e21e3e --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/start_positions.txt @@ -0,0 +1,64 @@ +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/t_start.txt b/ultrasound/L3/tests/plane_wave/data/t_start.txt new file mode 100644 index 0000000000..a4ea7ceea3 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/t_start.txt @@ -0,0 +1,88 @@ +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 diff --git a/ultrasound/L3/tests/plane_wave/data/tx_def_delay_distance.txt b/ultrasound/L3/tests/plane_wave/data/tx_def_delay_distance.txt new file mode 100644 index 0000000000..d588285663 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/tx_def_delay_distance.txt @@ -0,0 +1,100 @@ +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 diff --git a/ultrasound/L3/tests/plane_wave/data/tx_def_focal_point.txt b/ultrasound/L3/tests/plane_wave/data/tx_def_focal_point.txt new file mode 100644 index 0000000000..b7ecb0972a --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/tx_def_focal_point.txt @@ -0,0 +1,140 @@ +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/tx_def_ref_point.txt b/ultrasound/L3/tests/plane_wave/data/tx_def_ref_point.txt new file mode 100644 index 0000000000..3594245b45 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/tx_def_ref_point.txt @@ -0,0 +1,104 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/xdc_def_0.txt b/ultrasound/L3/tests/plane_wave/data/xdc_def_0.txt new file mode 100644 index 0000000000..40781351d7 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/xdc_def_0.txt @@ -0,0 +1,64 @@ +-0.0058211999999999995 +-0.0056364 +-0.0054516 +-0.005266799999999999 +-0.005082 +-0.0048972 +-0.004712399999999999 +-0.0045276 +-0.0043428 +-0.004158 +-0.0039732 +-0.0037884 +-0.0036035999999999998 +-0.0034188 +-0.003234 +-0.0030491999999999997 +-0.0028644 +-0.0026796 +-0.0024947999999999997 +-0.00231 +-0.0021252 +-0.0019404 +-0.0017556 +-0.0015708 +-0.0013859999999999999 +-0.0012012 +-0.0010164 +-0.0008315999999999999 +-0.0006468 +-0.00046199999999999995 +-0.0002772 +-9.24e-05 +9.24e-05 +0.0002772 +0.00046199999999999995 +0.0006468 +0.0008315999999999999 +0.0010164 +0.0012012 +0.0013859999999999999 +0.0015708 +0.0017556 +0.0019404 +0.0021252 +0.00231 +0.0024947999999999997 +0.0026796 +0.0028644 +0.0030491999999999997 +0.003234 +0.0034188 +0.0036035999999999998 +0.0037884 +0.0039732 +0.004158 +0.0043428 +0.0045276 +0.004712399999999999 +0.0048972 +0.005082 +0.005266799999999999 +0.0054516 +0.0056364 +0.0058211999999999995 \ No newline at end of file diff --git a/ultrasound/L3/tests/plane_wave/data/xdc_def_1.txt b/ultrasound/L3/tests/plane_wave/data/xdc_def_1.txt new file mode 100644 index 0000000000..d918d211c4 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/xdc_def_1.txt @@ -0,0 +1,192 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/plane_wave/data/xdc_def_positions.txt b/ultrasound/L3/tests/plane_wave/data/xdc_def_positions.txt new file mode 100644 index 0000000000..51e06b22d0 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/data/xdc_def_positions.txt @@ -0,0 +1,130 @@ +-0.0058211999999999995 +0 +0 +0 +-0.0056364 +0 +0 +0 +-0.0054516 +0 +0 +0 +-0.005266799999999999 +0 +0 +0 +-0.005082 +0 +0 +0 +-0.0048972 +0 +0 +0 +-0.004712399999999999 +0 +0 +0 +-0.0045276 +0 +0 +0 +-0.0043428 +0 +0 +0 +-0.004158 +0 +0 +0 +-0.0039732 +0 +0 +0 +-0.0037884 +0 +0 +0 +-0.0036035999999999998 +0 +0 +0 +-0.0034188 +0 +0 +0 +-0.003234 +0 +0 +0 +-0.0030491999999999997 +0 +0 +0 +-0.0028644 +0 +0 +0 +-0.0026796 +0 +0 +0 +-0.0024947999999999997 +0 +0 +0 +-0.00231 +0 +0 +0 +-0.0021252 +0 +0 +0 +-0.0019404 +0 +0 +0 +-0.0017556 +-0.0015708 +-0.0013859999999999999 +-0.0012012 +-0.0010164 +-0.0008315999999999999 +-0.0006468 +-0.00046199999999999995 +-0.0002772 +-9.24e-05 +9.24e-05 +0.0002772 +0.00046199999999999995 +0.0006468 +0.0008315999999999999 +0.0010164 +0.0012012 +0.0013859999999999999 +0.0015708 +0.0017556 +0.0019404 +0.0021252 +0.00231 +0.0024947999999999997 +0.0026796 +0.0028644 +0.0030491999999999997 +0.003234 +0.0034188 +0.0036035999999999998 +0.0037884 +0.0039732 +0.004158 +0.0043428 +0.0045276 +0.004712399999999999 +0.0048972 +0.005082 +0.005266799999999999 +0.0054516 +0.0056364 +0.0058211999999999995 \ No newline at end of file diff --git a/ultrasound/L3/tests/plane_wave/description.json b/ultrasound/L3/tests/plane_wave/description.json new file mode 100644 index 0000000000..73b16e801d --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/description.json @@ -0,0 +1,294 @@ +{ + "name": "Plane Wave Test", + "description": "plane_wave example", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin plane_wave.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/plane_wave.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L3/tests/plane_wave/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L3/include", + "LIB_DIR/L3/tests/plane_wave/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L3/tests/plane_wave/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s5" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s6" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s7.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s7" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s8.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s8" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s9.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s9" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s10.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s10" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s11.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s11" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s12.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s12" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s13.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s13" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s14.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s14" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s15.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s15" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s16.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s16" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s17.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s17" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s18.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s18" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s19.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s19" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s20.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s20" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s21.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s21" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s22.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s22" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s23.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s23" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/mm2s24.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s24" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/s2mm2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm2" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/s2mm3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm3" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/s2mm4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm4" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/s2mm5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm5" + }, + { + "location": "LIB_DIR/L3/tests/plane_wave/PL_kernels/s2mm6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm6" + } + ], + "name": "plane_wave" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 65536, + "max_time_min": 600 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} diff --git a/ultrasound/L3/tests/plane_wave/system.cfg b/ultrasound/L3/tests/plane_wave/system.cfg new file mode 100644 index 0000000000..1744768534 --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/system.cfg @@ -0,0 +1,47 @@ +[connectivity] + +#### input #### +# image points +stream_connect=mm2s1_1.s:ai_engine_0.start_positions +stream_connect=mm2s2_1.s:ai_engine_0.directions +stream_connect=mm2s3_1.s:ai_engine_0.samples_arange +# delay +stream_connect=mm2s4_1.s:ai_engine_0.image_points_from_PL +stream_connect=mm2s5_1.s:ai_engine_0.tx_def_ref_point +stream_connect=mm2s6_1.s:ai_engine_0.t_start +# focusing +stream_connect=mm2s7_1.s:ai_engine_0.apo_ref_0 +stream_connect=mm2s8_1.s:ai_engine_0.xdc_def_0 +stream_connect=mm2s9_1.s:ai_engine_0.apo_ref_1 +stream_connect=mm2s10_1.s:ai_engine_0.xdc_def_1 +# samples +stream_connect=mm2s11_1.s:ai_engine_0.image_points_from_PL_3 +stream_connect=mm2s12_1.s:ai_engine_0.delay_from_PL +stream_connect=mm2s13_1.s:ai_engine_0.xdc_def_positions +stream_connect=mm2s14_1.s:ai_engine_0.sampling_frequency +# apodization +stream_connect=mm2s15_1.s:ai_engine_0.image_points_from_PL_4 +stream_connect=mm2s16_1.s:ai_engine_0.apodization_reference +stream_connect=mm2s17_1.s:ai_engine_0.apo_distance_k +stream_connect=mm2s18_1.s:ai_engine_0.F_number +# interpolator +stream_connect=mm2s19_1.s:ai_engine_0.P1 +stream_connect=mm2s20_1.s:ai_engine_0.P2 +stream_connect=mm2s21_1.s:ai_engine_0.P3 +stream_connect=mm2s22_1.s:ai_engine_0.P4 +stream_connect=mm2s23_1.s:ai_engine_0.P5 +stream_connect=mm2s24_1.s:ai_engine_0.P6 + +#### output ##### +# image points +stream_connect=ai_engine_0.image_points:s2mm1_1.s +# delay +stream_connect=ai_engine_0.delay_to_PL:s2mm2_1.s +# focusing +stream_connect=ai_engine_0.focusing_output:s2mm3_1.s +# samples +stream_connect=ai_engine_0.samples_to_PL:s2mm4_1.s +# apodization +stream_connect=ai_engine_0.apodization:s2mm5_1.s +# interpolator +stream_connect=ai_engine_0.C:s2mm6_1.s diff --git a/ultrasound/L3/tests/plane_wave/utils.mk b/ultrasound/L3/tests/plane_wave/utils.mk new file mode 100644 index 0000000000..49ad0db7ef --- /dev/null +++ b/ultrasound/L3/tests/plane_wave/utils.mk @@ -0,0 +1,328 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +# 1) for versal flow from 2022.1 +DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM) | grep 'FPGA Family' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(DEVICE_TYPE), versal) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# device2xsa - create a filesystem friendly name from device name +# $(1) - full name of device +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L3/tests/scanline/Makefile b/ultrasound/L3/tests/scanline/Makefile new file mode 100644 index 0000000000..3059250447 --- /dev/null +++ b/ultrasound/L3/tests/scanline/Makefile @@ -0,0 +1,642 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L3/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L3/tests/scanline/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L3/include -I $(XFLIB_DIR)/L3/tests/scanline/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L3/tests/scanline/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L3/include -I $(XFLIB_DIR)/L3/tests/scanline/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(INSTANCE_FILES) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin scanline.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/scanline.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_mm2s5 += +VPP_FLAGS_mm2s5 += --hls.clock 100000000:mm2s5 +VPP_FLAGS_mm2s6 += +VPP_FLAGS_mm2s6 += --hls.clock 100000000:mm2s6 +VPP_FLAGS_mm2s7 += +VPP_FLAGS_mm2s7 += --hls.clock 100000000:mm2s7 +VPP_FLAGS_mm2s8 += +VPP_FLAGS_mm2s8 += --hls.clock 100000000:mm2s8 +VPP_FLAGS_mm2s9 += +VPP_FLAGS_mm2s9 += --hls.clock 100000000:mm2s9 +VPP_FLAGS_mm2s10 += +VPP_FLAGS_mm2s10 += --hls.clock 100000000:mm2s10 +VPP_FLAGS_mm2s11 += +VPP_FLAGS_mm2s11 += --hls.clock 100000000:mm2s11 +VPP_FLAGS_mm2s12 += +VPP_FLAGS_mm2s12 += --hls.clock 100000000:mm2s12 +VPP_FLAGS_mm2s13 += +VPP_FLAGS_mm2s13 += --hls.clock 100000000:mm2s13 +VPP_FLAGS_mm2s14 += +VPP_FLAGS_mm2s14 += --hls.clock 100000000:mm2s14 +VPP_FLAGS_mm2s15 += +VPP_FLAGS_mm2s15 += --hls.clock 100000000:mm2s15 +VPP_FLAGS_mm2s16 += +VPP_FLAGS_mm2s16 += --hls.clock 100000000:mm2s16 +VPP_FLAGS_mm2s17 += +VPP_FLAGS_mm2s17 += --hls.clock 100000000:mm2s17 +VPP_FLAGS_mm2s18 += +VPP_FLAGS_mm2s18 += --hls.clock 100000000:mm2s18 +VPP_FLAGS_mm2s19 += +VPP_FLAGS_mm2s19 += --hls.clock 100000000:mm2s19 +VPP_FLAGS_mm2s20 += +VPP_FLAGS_mm2s20 += --hls.clock 100000000:mm2s20 +VPP_FLAGS_mm2s21 += +VPP_FLAGS_mm2s21 += --hls.clock 100000000:mm2s21 +VPP_FLAGS_mm2s22 += +VPP_FLAGS_mm2s22 += --hls.clock 100000000:mm2s22 +VPP_FLAGS_mm2s23 += +VPP_FLAGS_mm2s23 += --hls.clock 100000000:mm2s23 +VPP_FLAGS_mm2s24 += +VPP_FLAGS_mm2s24 += --hls.clock 100000000:mm2s24 +VPP_FLAGS_mm2s25 += +VPP_FLAGS_mm2s25 += --hls.clock 100000000:mm2s25 +VPP_FLAGS_mm2s26 += +VPP_FLAGS_mm2s26 += --hls.clock 100000000:mm2s26 +VPP_FLAGS_mm2s27 += +VPP_FLAGS_mm2s27 += --hls.clock 100000000:mm2s27 +VPP_FLAGS_mm2s28 += +VPP_FLAGS_mm2s28 += --hls.clock 100000000:mm2s28 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 +VPP_FLAGS_s2mm2 += +VPP_FLAGS_s2mm2 += --hls.clock 100000000:s2mm2 +VPP_FLAGS_s2mm3 += +VPP_FLAGS_s2mm3 += --hls.clock 100000000:s2mm3 +VPP_FLAGS_s2mm4 += +VPP_FLAGS_s2mm4 += --hls.clock 100000000:s2mm4 +VPP_FLAGS_s2mm5 += +VPP_FLAGS_s2mm5 += --hls.clock 100000000:s2mm5 +VPP_FLAGS_s2mm6 += +VPP_FLAGS_s2mm6 += --hls.clock 100000000:s2mm6 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/scanline.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/scanline_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/scanline.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L3/tests/scanline/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp $(AIE_WORK_DIR)/reports/dma_lock_report.json ./ + cp $(AIE_WORK_DIR)/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/scanline.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +gen_instances: $(INSTANCE_FILES) + @echo "Nothing to generate." + +valid_params: + @echo "Nothing to validate." + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ $(INST_TB_FILES) + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* $(INST_FILES) + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) *.html $(INSTANCE_FILES) + +clean: cleanh diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s1.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s10.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s10.cpp new file mode 100644 index 0000000000..b0a033e406 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s10.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s10(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s11.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s11.cpp new file mode 100644 index 0000000000..d4a56b4bb6 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s11.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s11(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s12.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s12.cpp new file mode 100644 index 0000000000..cfeaca1009 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s12.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s12(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s13.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s13.cpp new file mode 100644 index 0000000000..903bb8c335 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s13.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s13(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s14.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s14.cpp new file mode 100644 index 0000000000..1b9b9e8306 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s14.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s14(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s15.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s15.cpp new file mode 100644 index 0000000000..f55603432a --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s15.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s15(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s16.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s16.cpp new file mode 100644 index 0000000000..402a0eb95d --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s16.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s16(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s17.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s17.cpp new file mode 100644 index 0000000000..1c230772cf --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s17.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s17(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s18.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s18.cpp new file mode 100644 index 0000000000..aadb7b12a9 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s18.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s18(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s19.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s19.cpp new file mode 100644 index 0000000000..bafa9e5013 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s19.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s19(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s2.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s20.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s20.cpp new file mode 100644 index 0000000000..f095a84c1e --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s20.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s20(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s21.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s21.cpp new file mode 100644 index 0000000000..fee6e75230 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s21.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s21(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s22.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s22.cpp new file mode 100644 index 0000000000..bf954f3077 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s22.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s22(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s23.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s23.cpp new file mode 100644 index 0000000000..c7343611a4 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s23.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s23(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s24.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s24.cpp new file mode 100644 index 0000000000..2b8d77f668 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s24.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s24(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s25.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s25.cpp new file mode 100644 index 0000000000..60b53305a2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s25.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s25(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s26.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s26.cpp new file mode 100644 index 0000000000..2183e0abfc --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s26.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s26(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s27.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s27.cpp new file mode 100644 index 0000000000..0c6cefccd2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s27.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s27(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s28.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s28.cpp new file mode 100644 index 0000000000..e2baab32a5 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s28.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s28(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s3.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s4.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s5.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s5.cpp new file mode 100644 index 0000000000..583828c713 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s6.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s6.cpp new file mode 100644 index 0000000000..172d9d16b5 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s7.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s7.cpp new file mode 100644 index 0000000000..b0a4a405aa --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s7.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s7(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s8.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s8.cpp new file mode 100644 index 0000000000..f89f755ec6 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s8.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s8(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/mm2s9.cpp b/ultrasound/L3/tests/scanline/PL_kernels/mm2s9.cpp new file mode 100644 index 0000000000..a779d2134c --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/mm2s9.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s9(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/s2mm1.cpp b/ultrasound/L3/tests/scanline/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/s2mm2.cpp b/ultrasound/L3/tests/scanline/PL_kernels/s2mm2.cpp new file mode 100644 index 0000000000..3d340b899f --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/s2mm2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/s2mm3.cpp b/ultrasound/L3/tests/scanline/PL_kernels/s2mm3.cpp new file mode 100644 index 0000000000..ffcc5aa5be --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/s2mm3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/s2mm4.cpp b/ultrasound/L3/tests/scanline/PL_kernels/s2mm4.cpp new file mode 100644 index 0000000000..466ff74586 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/s2mm4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/s2mm5.cpp b/ultrasound/L3/tests/scanline/PL_kernels/s2mm5.cpp new file mode 100644 index 0000000000..dee3325235 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/s2mm5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PL_kernels/s2mm6.cpp b/ultrasound/L3/tests/scanline/PL_kernels/s2mm6.cpp new file mode 100644 index 0000000000..17c936f413 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PL_kernels/s2mm6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/scanline/PS_host/host.cpp b/ultrasound/L3/tests/scanline/PS_host/host.cpp new file mode 100644 index 0000000000..f24fa0dd53 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PS_host/host.cpp @@ -0,0 +1,152 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#include "scanline.hpp" + +#define INPUT_RANGE 28 +#define OUTPUT_RANGE 6 +#define ITER 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +void init_output_buffer(float* res_out[], float* res_out_size) { + /* for this test, assume 1 graph run in aie processing */ + + float golden_sizeOut[OUTPUT_RANGE]; + golden_sizeOut[0] = 128; // image-points output + golden_sizeOut[1] = 32; // delay output + golden_sizeOut[2] = 32; // focusing output + golden_sizeOut[3] = 32; // samples + golden_sizeOut[4] = 32; // apodization + golden_sizeOut[5] = 128; // apodization + + // output buffer init + for (int i = 0; i < OUTPUT_RANGE; i++) { + int size = golden_sizeOut[i]; + res_out[i] = new float[size]; + } + + // size init + for (int i = 0; i < OUTPUT_RANGE; i++) { + res_out_size[i] = golden_sizeOut[i]; + } +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + // output result buffer + float* res_out[OUTPUT_RANGE]; + float res_out_size[OUTPUT_RANGE]; + + // init output buffer + init_output_buffer(res_out, res_out_size); + + // run aie application + us::L3::scanline<>(xclbin_path, data_path, res_out, res_out_size, ITER); + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "golden/image_points.txt"; + golden_file_set[1] = data_path + "golden/delay_to_PL.txt"; + golden_file_set[2] = data_path + "golden/focusing_output.txt"; + golden_file_set[3] = data_path + "golden/samples_to_PL.txt"; + golden_file_set[4] = data_path + "golden/apodization.txt"; + golden_file_set[5] = data_path + "golden/C.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + + // mem data output length define + golden_sizeOut[0] = 128; // image-points output + golden_sizeOut[1] = 32; // delay output + golden_sizeOut[2] = 32; // focusing output + golden_sizeOut[3] = 32; // samples + golden_sizeOut[4] = 32; // apodization + golden_sizeOut[5] = 128; // interpolation + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + std::cout << golden_file_set[k] << std::endl; + for (int i = 0; i < golden_sizeOut[k]; i++) { + float result_tmp = (float)res_out[k][i]; + float result_golden = (float)golden_buf_mem[k][i]; + if (result_tmp != result_golden) { + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + err_cnt++; + } + } + } + + for (int i = 0; i < OUTPUT_RANGE; i++) { + delete[] res_out[i]; + } + + // End + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/PS_host/host.hpp b/ultrasound/L3/tests/scanline/PS_host/host.hpp new file mode 100644 index 0000000000..e3f25f1d23 --- /dev/null +++ b/ultrasound/L3/tests/scanline/PS_host/host.hpp @@ -0,0 +1,33 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L3/tests/scanline/aie_graph/graph.cpp b/ultrasound/L3/tests/scanline/aie_graph/graph.cpp new file mode 100644 index 0000000000..bf3a945c40 --- /dev/null +++ b/ultrasound/L3/tests/scanline/aie_graph/graph.cpp @@ -0,0 +1,197 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "imagePoints.hpp" +#include "delay.hpp" +#include "focusing.hpp" +#include "samples.hpp" +#include "apodization.hpp" +#include "bSpline.hpp" + +// #define DIM_VECTOR LENGTH +// #define DIM_MATRIX (LENGTH * SPACE_DIMENSION) +#define KERNEL_RATIO_SCANLINE 1.0 + +namespace us { +namespace L3 { + +class scanline : public adf::graph { + public: + // IMAGE POINTS + adf::input_plio start_positions; + adf::input_plio directions; + adf::input_plio samples_arange; + adf::output_plio image_points_output; + // // DELAY + adf::input_plio image_points_from_PL; + adf::input_plio image_points_from_PL_2; + adf::input_plio tx_def_ref_point; + adf::input_plio tx_def_delay_distance; + adf::input_plio tx_def_delay_distance_2; + adf::input_plio tx_def_focal_point; + adf::input_plio t_start; + adf::output_plio delay_to_PL; + // FOCUSING + adf::input_plio apo_ref_0; + adf::input_plio xdc_def_0; + adf::input_plio apo_ref_1; + adf::input_plio xdc_def_1; + adf::output_plio focusing_output; + // SAMPLES + adf::input_plio image_points_from_PL_3; + adf::input_plio xdc_def_positions; + adf::input_plio sampling_frequency; + adf::input_plio delay_from_PL; + adf::output_plio samples_to_PL; + // APODIZATION + adf::input_plio image_points_apo; + adf::input_plio apodization_reference; + adf::input_plio apo_distance_k; + adf::input_plio F_number; + adf::output_plio apodization_output; + // INTERPOLATOR + adf::input_plio P1; + adf::input_plio P2; + adf::input_plio P3; + adf::input_plio P4; + adf::input_plio P5; + adf::input_plio P6; + adf::output_plio C; + + us::L2::imagePoints_graph<> img = us::L2::imagePoints_graph<>(KERNEL_RATIO_SCANLINE); + us::L2::delay_graph<> d = us::L2::delay_graph<>(KERNEL_RATIO_SCANLINE); + us::L2::focusing_graph<> foc = us::L2::focusing_graph<>(KERNEL_RATIO_SCANLINE); + us::L2::samples_graph<> sam = us::L2::samples_graph<>(KERNEL_RATIO_SCANLINE); + us::L2::apodization_graph<> apo = us::L2::apodization_graph<>(KERNEL_RATIO_SCANLINE); + us::L2::bSpline_graph<> interp = us::L2::bSpline_graph<>(KERNEL_RATIO_SCANLINE); + + scanline() { + // IMAGEPOINTS + start_positions = adf::input_plio::create("start_positions", adf::plio_32_bits, "data/start_positions.txt"); + directions = adf::input_plio::create("directions", adf::plio_32_bits, "data/directions.txt"); + samples_arange = adf::input_plio::create("samples_arange", adf::plio_32_bits, "data/samples_arange.txt"); + image_points_output = adf::output_plio::create("image_points", adf::plio_32_bits, "data/image_points.txt"); + + adf::connect<>(start_positions.out[0], img.start_positions); + adf::connect<>(samples_arange.out[0], img.samples_arange); + adf::connect<>(directions.out[0], img.directions); + adf::connect<>(img.image_points, image_points_output.in[0]); + + // DELAY + image_points_from_PL = + adf::input_plio::create("image_points_from_PL", adf::plio_32_bits, "data/image_points.txt"); + image_points_from_PL_2 = + adf::input_plio::create("image_points_from_PL_2", adf::plio_32_bits, "data/image_points.txt"); + tx_def_ref_point = adf::input_plio::create("tx_def_ref_point", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + tx_def_delay_distance = + adf::input_plio::create("tx_def_delay_distance", adf::plio_32_bits, "data/tx_def_delay_distance.txt"); + tx_def_delay_distance_2 = + adf::input_plio::create("tx_def_delay_distance_2", adf::plio_32_bits, "data/tx_def_delay_distance.txt"); + tx_def_focal_point = + adf::input_plio::create("tx_def_focal_point", adf::plio_32_bits, "data/tx_def_focal_point.txt"); + t_start = adf::input_plio::create("t_start", adf::plio_32_bits, "data/t_start.txt"); + delay_to_PL = adf::output_plio::create("delay_to_PL", adf::plio_32_bits, "data/delay_to_PL.txt"); + + // connections + adf::connect<>(image_points_from_PL.out[0], d.image_points_from_PL); + adf::connect<>(image_points_from_PL_2.out[0], d.image_points_from_PL_); + adf::connect<>(tx_def_ref_point.out[0], d.tx_def_ref_point); + adf::connect<>(tx_def_delay_distance.out[0], d.tx_def_delay_distance); + adf::connect<>(tx_def_delay_distance_2.out[0], d.tx_def_delay_distance2); + adf::connect<>(tx_def_focal_point.out[0], d.tx_def_focal_point); + adf::connect<>(t_start.out[0], d.t_start); + adf::connect<>(d.delay_to_PL, delay_to_PL.in[0]); + + // FOCUSING + apo_ref_0 = adf::input_plio::create("apo_ref_0", adf::plio_32_bits, "data/apo_ref_0.txt"); + xdc_def_0 = adf::input_plio::create("xdc_def_0", adf::plio_32_bits, "data/xdc_def_0.txt"); + apo_ref_1 = adf::input_plio::create("apo_ref_1", adf::plio_32_bits, "data/apo_ref_1.txt"); + xdc_def_1 = adf::input_plio::create("xdc_def_1", adf::plio_32_bits, "data/xdc_def_1.txt"); + focusing_output = adf::output_plio::create("focusing_output", adf::plio_32_bits, "data/focusing_output.txt"); + + adf::connect<>(apo_ref_0.out[0], foc.apo_ref_0); + adf::connect<>(xdc_def_0.out[0], foc.xdc_def_0); + adf::connect<>(apo_ref_1.out[0], foc.apo_ref_1); + adf::connect<>(xdc_def_1.out[0], foc.xdc_def_1); + adf::connect<>(foc.focusing_output, focusing_output.in[0]); + + // SAMPLES + image_points_from_PL_3 = + adf::input_plio::create("image_points_from_PL_3", adf::plio_32_bits, "data/image_points.txt"); + delay_from_PL = adf::input_plio::create("delay_from_PL", adf::plio_32_bits, "data/delay_from_PL.txt"); + xdc_def_positions = + adf::input_plio::create("xdc_def_positions", adf::plio_32_bits, "data/xdc_def_positions.txt"); + sampling_frequency = + adf::input_plio::create("sampling_frequency", adf::plio_32_bits, "data/sampling_frequency.txt"); + samples_to_PL = adf::output_plio::create("samples_to_PL", adf::plio_32_bits, "data/samples_to_PL.txt"); + + adf::connect<>(image_points_from_PL_3.out[0], sam.image_points_from_PL); + adf::connect<>(xdc_def_positions.out[0], sam.xdc_def_positions); + adf::connect<>(sampling_frequency.out[0], sam.sampling_frequency); + adf::connect<>(delay_from_PL.out[0], sam.delay_from_PL); + adf::connect<>(sam.samples_to_PL, samples_to_PL.in[0]); + + // APODIZATION + image_points_apo = + adf::input_plio::create("image_points_from_PL_4", adf::plio_32_bits, "data/image_points.txt"); + apodization_reference = + adf::input_plio::create("apodization_reference", adf::plio_32_bits, "data/apodization_reference.txt"); + apo_distance_k = adf::input_plio::create("apo_distance_k", adf::plio_32_bits, "data/apo_distance_k.txt"); + F_number = adf::input_plio::create("F_number", adf::plio_32_bits, "data/F_number.txt"); + apodization_output = adf::output_plio::create("apodization", adf::plio_32_bits, "data/apodization.txt"); + + adf::connect<>(image_points_apo.out[0], apo.image_points); + adf::connect<>(apodization_reference.out[0], apo.apodization_reference_i); + adf::connect<>(apo_distance_k.out[0], apo.apo_distance_k); + adf::connect<>(F_number.out[0], apo.F_number); + adf::connect<>(apo.apodization_output, apodization_output.in[0]); + + // INTERPOLATOR + P1 = adf::input_plio::create("P1", adf::plio_32_bits, "data/P1.txt"); + P2 = adf::input_plio::create("P2", adf::plio_32_bits, "data/P2.txt"); + P3 = adf::input_plio::create("P3", adf::plio_32_bits, "data/P3.txt"); + P4 = adf::input_plio::create("P4", adf::plio_32_bits, "data/P4.txt"); + P5 = adf::input_plio::create("P5", adf::plio_32_bits, "data/P5.txt"); + P6 = adf::input_plio::create("P6", adf::plio_32_bits, "data/P6.txt"); + C = adf::output_plio::create("C", adf::plio_32_bits, "data/C.txt"); + + adf::connect<>(P1.out[0], interp.P1); + adf::connect<>(P2.out[0], interp.P2); + adf::connect<>(P3.out[0], interp.P3); + adf::connect<>(P4.out[0], interp.P4); + adf::connect<>(P5.out[0], interp.P5); + adf::connect<>(P6.out[0], interp.P6); + adf::connect<>(interp.C, C.in[0]); + } +}; + +} // namespace L3 +} // namespace us + +us::L3::scanline scan; + +// TEST MAIN (EMULATION AIE) +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + scan.init(); + + scan.run(1); + + scan.end(); + + return 0; +} +#endif \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/F_number.txt b/ultrasound/L3/tests/scanline/data/F_number.txt new file mode 100644 index 0000000000..b0f057e95a --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/F_number.txt @@ -0,0 +1,188 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 diff --git a/ultrasound/L3/tests/scanline/data/P0.txt b/ultrasound/L3/tests/scanline/data/P0.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/P0.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/scanline/data/P1.txt b/ultrasound/L3/tests/scanline/data/P1.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/P1.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/scanline/data/P2.txt b/ultrasound/L3/tests/scanline/data/P2.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/P2.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/scanline/data/P3.txt b/ultrasound/L3/tests/scanline/data/P3.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/P3.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/scanline/data/P4.txt b/ultrasound/L3/tests/scanline/data/P4.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/P4.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/scanline/data/P5.txt b/ultrasound/L3/tests/scanline/data/P5.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/P5.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/scanline/data/P6.txt b/ultrasound/L3/tests/scanline/data/P6.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/P6.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/scanline/data/apo_distance_k.txt b/ultrasound/L3/tests/scanline/data/apo_distance_k.txt new file mode 100644 index 0000000000..8bfe45aca9 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/apo_distance_k.txt @@ -0,0 +1,128 @@ +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 diff --git a/ultrasound/L3/tests/scanline/data/apo_ref_0.txt b/ultrasound/L3/tests/scanline/data/apo_ref_0.txt new file mode 100644 index 0000000000..acb7e1063d --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/apo_ref_0.txt @@ -0,0 +1,64 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/apo_ref_1.txt b/ultrasound/L3/tests/scanline/data/apo_ref_1.txt new file mode 100644 index 0000000000..acb7e1063d --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/apo_ref_1.txt @@ -0,0 +1,64 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/apodization_reference.txt b/ultrasound/L3/tests/scanline/data/apodization_reference.txt new file mode 100644 index 0000000000..bb4b72142c --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/apodization_reference.txt @@ -0,0 +1,156 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/scanline/data/delay_from_PL.txt b/ultrasound/L3/tests/scanline/data/delay_from_PL.txt new file mode 100644 index 0000000000..b6d16b0698 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/delay_from_PL.txt @@ -0,0 +1,206 @@ +-6.975e-06 +-6.97e-06 +-6.965e-06 +-6.96e-06 +-6.955e-06 +-6.95e-06 +-6.945e-06 +-6.94e-06 +-6.935e-06 +-6.93e-06 +-6.925e-06 +-6.92e-06 +-6.915e-06 +-6.91e-06 +-6.905e-06 +-6.9e-06 +-6.895e-06 +-6.89e-06 +-6.885e-06 +-6.88e-06 +-6.875e-06 +-6.87e-06 +-6.865e-06 +-6.86e-06 +-6.855e-06 +-6.85e-06 +-6.845e-06 +-6.84e-06 +-6.835e-06 +-6.83e-06 +-6.825e-06 +-6.82e-06 +-6.815e-06 +-6.81e-06 +-6.805e-06 +-6.8e-06 +-6.795e-06 +-6.79e-06 +-6.785e-06 +-6.78e-06 +-6.775e-06 +-6.77e-06 +-6.765e-06 +-6.76e-06 +-6.755e-06 +-6.75e-06 +-6.745e-06 +-6.74e-06 +-6.735e-06 +-6.73e-06 +-6.725e-06 +-6.72e-06 +-6.715e-06 +-6.71e-06 +-6.705e-06 +-6.7e-06 +-6.695e-06 +-6.69e-06 +-6.685e-06 +-6.68e-06 +-6.675e-06 +-6.67e-06 +-6.665e-06 +-6.66e-06 +-6.655e-06 +-6.65e-06 +-6.645e-06 +-6.64e-06 +-6.635e-06 +-6.63e-06 +-6.625e-06 +-6.62e-06 +-6.615e-06 +-6.61e-06 +-6.605e-06 +-6.6e-06 +-6.595e-06 +-6.59e-06 +-6.585e-06 +-6.58e-06 +-6.575e-06 +-6.57e-06 +-6.565e-06 +-6.56e-06 +-6.555e-06 +-6.55e-06 +-6.545e-06 +-6.54e-06 +-6.535e-06 +-6.53e-06 +-6.525e-06 +-6.52e-06 +-6.515e-06 +-6.51e-06 +-6.505e-06 +-6.5e-06 +-6.495e-06 +-6.49e-06 +-6.485e-06 +-6.48e-06 +-6.475e-06 +-6.47e-06 +-6.465e-06 +-6.46e-06 +-6.455e-06 +-6.45e-06 +-6.445e-06 +-6.44e-06 +-6.435e-06 +-6.43e-06 +-6.425e-06 +-6.42e-06 +-6.415e-06 +-6.41e-06 +-6.405e-06 +-6.4e-06 +-6.395e-06 +-6.39e-06 +-6.385e-06 +-6.38e-06 +-6.375e-06 +-6.37e-06 +-6.365e-06 +-6.36e-06 +-6.355e-06 +-6.35e-06 +-6.345e-06 +-6.34e-06 +-6.335e-06 +-6.33e-06 +-6.325e-06 +-6.32e-06 +-6.315e-06 +-6.31e-06 +-6.305e-06 +-6.3e-06 +-6.295e-06 +-6.29e-06 +-6.285e-06 +-6.28e-06 +-6.275e-06 +-6.27e-06 +-6.265e-06 +-6.26e-06 +-6.255e-06 +-6.25e-06 +-6.245e-06 +-6.24e-06 +-6.235e-06 +-6.23e-06 +-6.225e-06 +-6.22e-06 +-6.215e-06 +-6.21e-06 +-6.205e-06 +-6.2e-06 +-6.195e-06 +-6.19e-06 +-6.185e-06 +-6.18e-06 +-6.175e-06 +-6.17e-06 +-6.165e-06 +-6.16e-06 +-6.155e-06 +-6.15e-06 +-6.145e-06 +-6.14e-06 +-6.135e-06 +-6.13e-06 +-6.125e-06 +-6.12e-06 +-6.115e-06 +-6.11e-06 +-6.105e-06 +-6.1e-06 +-6.095e-06 +-6.09e-06 +-6.085e-06 +-6.08e-06 +-6.075e-06 +-6.07e-06 +-6.065e-06 +-6.06e-06 +-6.055e-06 +-6.05e-06 +-6.045e-06 +-6.04e-06 +-6.035e-06 +-6.03e-06 +-6.025e-06 +-6.02e-06 +-6.015e-06 +-6.01e-06 +-6.005e-06 +-6e-06 +-5.995e-06 +-5.99e-06 +-5.985e-06 +-5.98e-06 +-5.975e-06 +-5.97e-06 +-5.965e-06 +-5.96e-06 +-5.955e-06 +-5.95e-06 diff --git a/ultrasound/L3/tests/scanline/data/directions.txt b/ultrasound/L3/tests/scanline/data/directions.txt new file mode 100644 index 0000000000..564f5e2bb0 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/directions.txt @@ -0,0 +1,64 @@ +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 diff --git a/ultrasound/L3/tests/scanline/data/golden/C.txt b/ultrasound/L3/tests/scanline/data/golden/C.txt new file mode 100644 index 0000000000..9724bec91c --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/golden/C.txt @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.700000000e+01 +1.700000000e+01 +1.700000000e+01 +1.700000000e+01 +1.800000000e+01 +1.800000000e+01 +1.800000000e+01 +1.800000000e+01 +1.900000000e+01 +1.900000000e+01 +1.900000000e+01 +1.900000000e+01 +2.000000000e+01 +2.000000000e+01 +2.000000000e+01 +2.000000000e+01 +2.100000000e+01 +2.100000000e+01 +2.100000000e+01 +2.100000000e+01 +2.200000000e+01 +2.200000000e+01 +2.200000000e+01 +2.200000000e+01 +2.300000000e+01 +2.300000000e+01 +2.300000000e+01 +2.300000000e+01 +2.400000000e+01 +2.400000000e+01 +2.400000000e+01 +2.400000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.600000000e+01 +2.600000000e+01 +2.600000000e+01 +2.600000000e+01 +2.700000000e+01 +2.700000000e+01 +2.700000000e+01 +2.700000000e+01 +2.800000000e+01 +2.800000000e+01 +2.800000000e+01 +2.800000000e+01 +2.900000000e+01 +2.900000000e+01 +2.900000000e+01 +2.900000000e+01 +3.000000000e+01 +3.000000000e+01 +3.000000000e+01 +3.000000000e+01 +3.100000000e+01 +3.100000000e+01 +3.100000000e+01 +3.100000000e+01 +3.200000000e+01 +3.200000000e+01 +3.200000000e+01 +3.200000000e+01 diff --git a/ultrasound/L3/tests/scanline/data/golden/apodization.txt b/ultrasound/L3/tests/scanline/data/golden/apodization.txt new file mode 100644 index 0000000000..1d7ad2b972 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/golden/apodization.txt @@ -0,0 +1,32 @@ +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L3/tests/scanline/data/golden/delay_to_PL.txt b/ultrasound/L3/tests/scanline/data/golden/delay_to_PL.txt new file mode 100644 index 0000000000..2143716546 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/golden/delay_to_PL.txt @@ -0,0 +1,32 @@ +-6.974999906e-06 +-6.969999959e-06 +-6.965000011e-06 +-6.959999610e-06 +-6.954999662e-06 +-6.949999715e-06 +-6.944999768e-06 +-6.939999821e-06 +-6.935000329e-06 +-6.930000382e-06 +-6.924999980e-06 +-6.920000033e-06 +-6.915000085e-06 +-6.909999684e-06 +-6.904999736e-06 +-6.899999789e-06 +-6.894999842e-06 +-6.889999895e-06 +-6.884999948e-06 +-6.879999546e-06 +-6.875000054e-06 +-6.870000107e-06 +-6.865000159e-06 +-6.859999758e-06 +-6.854999810e-06 +-6.849999863e-06 +-6.844999916e-06 +-6.839999969e-06 +-6.835000022e-06 +-6.829999620e-06 +-6.824999673e-06 +-6.820000181e-06 diff --git a/ultrasound/L3/tests/scanline/data/golden/focusing_output.txt b/ultrasound/L3/tests/scanline/data/golden/focusing_output.txt new file mode 100644 index 0000000000..0dd3697ad7 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/golden/focusing_output.txt @@ -0,0 +1,32 @@ +5.821200088e-03 +5.636400077e-03 +5.451600067e-03 +5.266800057e-03 +5.082000047e-03 +4.897200037e-03 +4.712400027e-03 +4.527600016e-03 +4.342800006e-03 +4.157999996e-03 +3.973199986e-03 +3.788399976e-03 +3.603599966e-03 +3.418799955e-03 +3.233999945e-03 +3.049199935e-03 +2.864399925e-03 +2.679599915e-03 +2.494799905e-03 +2.309999894e-03 +2.125199884e-03 +1.940399990e-03 +1.755599980e-03 +1.570799970e-03 +1.385999960e-03 +1.201199950e-03 +1.016400056e-03 +8.315999876e-04 +6.467999774e-04 +4.619999963e-04 +2.771999862e-04 +9.239999781e-05 diff --git a/ultrasound/L3/tests/scanline/data/golden/image_points.txt b/ultrasound/L3/tests/scanline/data/golden/image_points.txt new file mode 100644 index 0000000000..5f5fa35a3d --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/golden/image_points.txt @@ -0,0 +1,128 @@ +0.000000000e+00 +0.000000000e+00 +7.699999958e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.707699668e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.715399843e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.723099552e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.730799727e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.738499902e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.746199612e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.753899787e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.761599962e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.769299671e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.776999846e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.784700021e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.792399731e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.800099906e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.807799615e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.815499790e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.823199965e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.830900140e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.838599384e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.846299559e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.853999734e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.861699909e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.869400084e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.877100259e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.884799503e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.892499678e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.900199853e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.907900028e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.915600203e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.923299447e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.930999622e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.938699797e-03 +0.000000000e+00 diff --git a/ultrasound/L3/tests/scanline/data/golden/samples_to_PL.txt b/ultrasound/L3/tests/scanline/data/golden/samples_to_PL.txt new file mode 100644 index 0000000000..1889199664 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/golden/samples_to_PL.txt @@ -0,0 +1,32 @@ +-7.009420013e+01 +-6.919543457e+01 +-6.829649353e+01 +-6.739746094e+01 +-6.649819183e+01 +-6.559883881e+01 +-6.469939423e+01 +-6.379967499e+01 +-6.289991379e+01 +-6.200001526e+01 +-6.109993362e+01 +-6.019976044e+01 +-5.929936218e+01 +-5.839887238e+01 +-5.749824524e+01 +-5.659743500e+01 +-5.569653702e+01 +-5.479540634e+01 +-5.389423370e+01 +-5.299283600e+01 +-5.209148026e+01 +-5.118980789e+01 +-5.028808975e+01 +-4.938614273e+01 +-4.848401642e+01 +-4.758188629e+01 +-4.667957687e+01 +-4.577713013e+01 +-4.487454987e+01 +-4.397178268e+01 +-4.306888199e+01 +-4.216598129e+01 diff --git a/ultrasound/L3/tests/scanline/data/image_points.txt b/ultrasound/L3/tests/scanline/data/image_points.txt new file mode 100644 index 0000000000..4cec60c658 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/image_points.txt @@ -0,0 +1,128 @@ +0 +0 +0.0076923 +0 +0 +0 +0.0077 +0 +0 +0 +0.0077077 +0 +0 +0 +0.0077154 +0 +0 +0 +0.0077231 +0 +0 +0 +0.0077308 +0 +0 +0 +0.0077385 +0 +0 +0 +0.0077462 +0 +0 +0 +0.0077539 +0 +0 +0 +0.0077616 +0 +0 +0 +0.0077693 +0 +0 +0 +0.007777 +0 +0 +0 +0.0077847 +0 +0 +0 +0.0077924 +0 +0 +0 +0.0078001 +0 +0 +0 +0.0078078 +0 +0 +0 +0.0078155 +0 +0 +0 +0.0078232 +0 +0 +0 +0.0078309 +0 +0 +0 +0.0078386 +0 +0 +0 +0.0078463 +0 +0 +0 +0.007854 +0 +0 +0 +0.0078617 +0 +0 +0 +0.0078694 +0 +0 +0 +0.0078771 +0 +0 +0 +0.0078848 +0 +0 +0 +0.0078925 +0 +0 +0 +0.0079002 +0 +0 +0 +0.0079079 +0 +0 +0 +0.0079156 +0 +0 +0 +0.0079233 +0 +0 +0 +0.007931 +0 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/samples_arange.txt b/ultrasound/L3/tests/scanline/data/samples_arange.txt new file mode 100644 index 0000000000..c67bf80073 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/samples_arange.txt @@ -0,0 +1,128 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/sampling_frequency.txt b/ultrasound/L3/tests/scanline/data/sampling_frequency.txt new file mode 100644 index 0000000000..51084d2137 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/sampling_frequency.txt @@ -0,0 +1,136 @@ +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 diff --git a/ultrasound/L3/tests/scanline/data/start_positions.txt b/ultrasound/L3/tests/scanline/data/start_positions.txt new file mode 100644 index 0000000000..d930e21e3e --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/start_positions.txt @@ -0,0 +1,64 @@ +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 diff --git a/ultrasound/L3/tests/scanline/data/t_start.txt b/ultrasound/L3/tests/scanline/data/t_start.txt new file mode 100644 index 0000000000..6b5df0bb06 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/t_start.txt @@ -0,0 +1,128 @@ +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/tx_def_delay_distance.txt b/ultrasound/L3/tests/scanline/data/tx_def_delay_distance.txt new file mode 100644 index 0000000000..b2dee58cc2 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/tx_def_delay_distance.txt @@ -0,0 +1,128 @@ +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/tx_def_focal_point.txt b/ultrasound/L3/tests/scanline/data/tx_def_focal_point.txt new file mode 100644 index 0000000000..8379811af6 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/tx_def_focal_point.txt @@ -0,0 +1,128 @@ +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/tx_def_ref_point.txt b/ultrasound/L3/tests/scanline/data/tx_def_ref_point.txt new file mode 100644 index 0000000000..dc7f6f0ff6 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/tx_def_ref_point.txt @@ -0,0 +1,128 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/xdc_def_0.txt b/ultrasound/L3/tests/scanline/data/xdc_def_0.txt new file mode 100644 index 0000000000..40781351d7 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/xdc_def_0.txt @@ -0,0 +1,64 @@ +-0.0058211999999999995 +-0.0056364 +-0.0054516 +-0.005266799999999999 +-0.005082 +-0.0048972 +-0.004712399999999999 +-0.0045276 +-0.0043428 +-0.004158 +-0.0039732 +-0.0037884 +-0.0036035999999999998 +-0.0034188 +-0.003234 +-0.0030491999999999997 +-0.0028644 +-0.0026796 +-0.0024947999999999997 +-0.00231 +-0.0021252 +-0.0019404 +-0.0017556 +-0.0015708 +-0.0013859999999999999 +-0.0012012 +-0.0010164 +-0.0008315999999999999 +-0.0006468 +-0.00046199999999999995 +-0.0002772 +-9.24e-05 +9.24e-05 +0.0002772 +0.00046199999999999995 +0.0006468 +0.0008315999999999999 +0.0010164 +0.0012012 +0.0013859999999999999 +0.0015708 +0.0017556 +0.0019404 +0.0021252 +0.00231 +0.0024947999999999997 +0.0026796 +0.0028644 +0.0030491999999999997 +0.003234 +0.0034188 +0.0036035999999999998 +0.0037884 +0.0039732 +0.004158 +0.0043428 +0.0045276 +0.004712399999999999 +0.0048972 +0.005082 +0.005266799999999999 +0.0054516 +0.0056364 +0.0058211999999999995 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/xdc_def_1.txt b/ultrasound/L3/tests/scanline/data/xdc_def_1.txt new file mode 100644 index 0000000000..acb7e1063d --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/xdc_def_1.txt @@ -0,0 +1,64 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/data/xdc_def_positions.txt b/ultrasound/L3/tests/scanline/data/xdc_def_positions.txt new file mode 100644 index 0000000000..51e06b22d0 --- /dev/null +++ b/ultrasound/L3/tests/scanline/data/xdc_def_positions.txt @@ -0,0 +1,130 @@ +-0.0058211999999999995 +0 +0 +0 +-0.0056364 +0 +0 +0 +-0.0054516 +0 +0 +0 +-0.005266799999999999 +0 +0 +0 +-0.005082 +0 +0 +0 +-0.0048972 +0 +0 +0 +-0.004712399999999999 +0 +0 +0 +-0.0045276 +0 +0 +0 +-0.0043428 +0 +0 +0 +-0.004158 +0 +0 +0 +-0.0039732 +0 +0 +0 +-0.0037884 +0 +0 +0 +-0.0036035999999999998 +0 +0 +0 +-0.0034188 +0 +0 +0 +-0.003234 +0 +0 +0 +-0.0030491999999999997 +0 +0 +0 +-0.0028644 +0 +0 +0 +-0.0026796 +0 +0 +0 +-0.0024947999999999997 +0 +0 +0 +-0.00231 +0 +0 +0 +-0.0021252 +0 +0 +0 +-0.0019404 +0 +0 +0 +-0.0017556 +-0.0015708 +-0.0013859999999999999 +-0.0012012 +-0.0010164 +-0.0008315999999999999 +-0.0006468 +-0.00046199999999999995 +-0.0002772 +-9.24e-05 +9.24e-05 +0.0002772 +0.00046199999999999995 +0.0006468 +0.0008315999999999999 +0.0010164 +0.0012012 +0.0013859999999999999 +0.0015708 +0.0017556 +0.0019404 +0.0021252 +0.00231 +0.0024947999999999997 +0.0026796 +0.0028644 +0.0030491999999999997 +0.003234 +0.0034188 +0.0036035999999999998 +0.0037884 +0.0039732 +0.004158 +0.0043428 +0.0045276 +0.004712399999999999 +0.0048972 +0.005082 +0.005266799999999999 +0.0054516 +0.0056364 +0.0058211999999999995 \ No newline at end of file diff --git a/ultrasound/L3/tests/scanline/description.json b/ultrasound/L3/tests/scanline/description.json new file mode 100644 index 0000000000..be458a4b4b --- /dev/null +++ b/ultrasound/L3/tests/scanline/description.json @@ -0,0 +1,318 @@ +{ + "name": "Scanline Test", + "description": "scanline example", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin scanline.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/scanline.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L3/tests/scanline/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L3/include", + "LIB_DIR/L3/tests/scanline/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L3/tests/scanline/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s5" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s6" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s7.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s7" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s8.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s8" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s9.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s9" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s10.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s10" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s11.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s11" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s12.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s12" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s13.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s13" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s14.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s14" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s15.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s15" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s16.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s16" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s17.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s17" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s18.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s18" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s19.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s19" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s20.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s20" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s21.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s21" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s22.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s22" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s23.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s23" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s24.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s24" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s25.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s25" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s26.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s26" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s27.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s27" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/mm2s28.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s28" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/s2mm2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm2" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/s2mm3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm3" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/s2mm4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm4" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/s2mm5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm5" + }, + { + "location": "LIB_DIR/L3/tests/scanline/PL_kernels/s2mm6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm6" + } + ], + "name": "scanline" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 65536, + "max_time_min": 450 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} diff --git a/ultrasound/L3/tests/scanline/system.cfg b/ultrasound/L3/tests/scanline/system.cfg new file mode 100644 index 0000000000..e28d3b9d33 --- /dev/null +++ b/ultrasound/L3/tests/scanline/system.cfg @@ -0,0 +1,51 @@ +[connectivity] + +#### input #### +# image points +stream_connect=mm2s1_1.s:ai_engine_0.start_positions +stream_connect=mm2s2_1.s:ai_engine_0.directions +stream_connect=mm2s3_1.s:ai_engine_0.samples_arange +# delay +stream_connect=mm2s4_1.s:ai_engine_0.image_points_from_PL +stream_connect=mm2s5_1.s:ai_engine_0.image_points_from_PL_2 +stream_connect=mm2s6_1.s:ai_engine_0.tx_def_delay_distance +stream_connect=mm2s7_1.s:ai_engine_0.tx_def_delay_distance_2 +stream_connect=mm2s8_1.s:ai_engine_0.tx_def_ref_point +stream_connect=mm2s9_1.s:ai_engine_0.tx_def_focal_point +stream_connect=mm2s10_1.s:ai_engine_0.t_start +# focusing +stream_connect=mm2s11_1.s:ai_engine_0.apo_ref_0 +stream_connect=mm2s12_1.s:ai_engine_0.xdc_def_0 +stream_connect=mm2s13_1.s:ai_engine_0.apo_ref_1 +stream_connect=mm2s14_1.s:ai_engine_0.xdc_def_1 +# samples +stream_connect=mm2s15_1.s:ai_engine_0.image_points_from_PL_3 +stream_connect=mm2s16_1.s:ai_engine_0.delay_from_PL +stream_connect=mm2s17_1.s:ai_engine_0.xdc_def_positions +stream_connect=mm2s18_1.s:ai_engine_0.sampling_frequency +# apodization +stream_connect=mm2s19_1.s:ai_engine_0.image_points_from_PL_4 +stream_connect=mm2s20_1.s:ai_engine_0.apodization_reference +stream_connect=mm2s21_1.s:ai_engine_0.apo_distance_k +stream_connect=mm2s22_1.s:ai_engine_0.F_number +# interpolator +stream_connect=mm2s23_1.s:ai_engine_0.P1 +stream_connect=mm2s24_1.s:ai_engine_0.P2 +stream_connect=mm2s25_1.s:ai_engine_0.P3 +stream_connect=mm2s26_1.s:ai_engine_0.P4 +stream_connect=mm2s27_1.s:ai_engine_0.P5 +stream_connect=mm2s28_1.s:ai_engine_0.P6 + +#### output ##### +# image points +stream_connect=ai_engine_0.image_points:s2mm1_1.s +# delay +stream_connect=ai_engine_0.delay_to_PL:s2mm2_1.s +# focusing +stream_connect=ai_engine_0.focusing_output:s2mm3_1.s +# samples +stream_connect=ai_engine_0.samples_to_PL:s2mm4_1.s +# apodization +stream_connect=ai_engine_0.apodization:s2mm5_1.s +# interpolator +stream_connect=ai_engine_0.C:s2mm6_1.s diff --git a/ultrasound/L3/tests/scanline/utils.mk b/ultrasound/L3/tests/scanline/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L3/tests/scanline/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/L3/tests/synthetic_aperture/Makefile b/ultrasound/L3/tests/synthetic_aperture/Makefile new file mode 100644 index 0000000000..b2f7d15ded --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/Makefile @@ -0,0 +1,636 @@ +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 + +############################## Help Section ############################## +.PHONY: help + +help:: + $(ECHO) "Makefile Usage:" + $(ECHO) " make all TARGET= PLATFORM=" + $(ECHO) " Command to generate the design for specified Target and Shell." + $(ECHO) "" + $(ECHO) " make run TARGET= PLATFORM=" + $(ECHO) " Command to run application in emulation." + $(ECHO) "" + $(ECHO) " make xclbin TARGET= PLATFORM=" + $(ECHO) " Command to build xclbin application." + $(ECHO) "" + $(ECHO) " make host TARGET=" + $(ECHO) " Command to build host application." + $(ECHO) "" + $(ECHO) " NOTE: For embedded devices, e.g. zcu102/zcu104/vck190, HOST_ARCH is either aarch32 or aarch64." + $(ECHO) " a.IF Download the platform, and common-image from Xilinx Download Center(Suggested):" + $(ECHO) " Run the sdk.sh script from the common-image directory to install sysroot using the command : ./sdk.sh -y -d ./ -p " + $(ECHO) " Unzip the rootfs file : gunzip ./rootfs.ext4.gz" + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " b.User could also define SYSROOT, K_IMAGE and ROOTFS by themselves: " + $(ECHO) " export SYSROOT=< path-to-platform-sysroot >" + $(ECHO) " export K_IMAGE=< path-to-Image-files >" + $(ECHO) " export ROOTFS=< path-to-rootfs >" + $(ECHO) "" + $(ECHO) " make clean " + $(ECHO) " Command to remove the generated non-hardware files." + $(ECHO) "" + $(ECHO) " make cleanall TARGET=" + $(ECHO) " Command to remove all the generated files." + $(ECHO) "" + +############################## Setting up Project Variables ############################## + +MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +XF_PROJ_ROOT ?= $(shell bash -c 'export MK_PATH=$(MK_PATH); echo $${MK_PATH%/L3/*}') +CUR_DIR := $(patsubst %/,%,$(dir $(MK_PATH))) +XFLIB_DIR = $(XF_PROJ_ROOT) + +# setting devault value +TARGET ?= aiesim +HOST_ARCH ?= + +#setting PLATFORM +ifeq ($(PLATFORM),) +PLATFORM := $(DEVICE) +endif +ifeq ($(PLATFORM),) +PLATFORM := +endif + +# #################### Checking if PLATFORM in whitelist ############################ +PLATFORM_ALLOWLIST += vck190 +PLATFORM_BLOCKLIST += + +include ./utils.mk +TEMP_DIR := _x_temp.$(TARGET).$(PLATFORM_NAME) +TEMP_REPORT_DIR := $(CUR_DIR)/reports/_x.$(TARGET).$(PLATFORM_NAME) +BUILD_DIR := build_dir.$(TARGET).$(PLATFORM_NAME) +ifneq ($(RESULT_DIR),) +BUILD_DIR = $(RESULT_DIR) +endif +BUILD_REPORT_DIR := $(CUR_DIR)/reports/_build.$(TARGET).$(PLATFORM_NAME) +EMCONFIG := $(BUILD_DIR)/emconfig.json +XCLBIN_DIR := $(CUR_DIR)/$(BUILD_DIR) +export XCL_BINDIR = $(XCLBIN_DIR) + +EXE_FILE_DEPS := +BINARY_CONTAINERS_DEPS := +RUN_DEPS := + +# get global setting +ifeq ($(HOST_ARCH), x86) +CXXFLAGS += -fmessage-length=0 -I$(CUR_DIR)/src/ -I$(XILINX_XRT)/include -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(XILINX_XRT)/lib -L$(XILINX_HLS)/lnx64/tools/fpo_v7_1 -Wl,--as-needed -lOpenCL -lxrt_coreutil -lgmp -lmpfr -lIp_floating_point_v7_1_bitacc_cmodel +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +else ifeq ($(HOST_ARCH), aarch64) +CXXFLAGS += -I$(CUR_DIR)/src/ -fmessage-length=0 --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include/xrt -I$(XILINX_HLS)/include -std=c++14 -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label +LDFLAGS += -pthread -L$(SYSROOT)/usr/lib -Wl,--as-needed -lxilinxopencl -lxrt_coreutil +VPP_FLAGS += -t $(TARGET) --platform $(XPLATFORM) --save-temps +VPP_LDFLAGS += --optimize 2 -R 2 +endif +CXXFLAGS += $(EXTRA_CXXFLAGS) +VPP_FLAGS += $(EXTRA_VPP_FLAGS) + +# aie template +XILINX_VITIS_AIETOOLS := $(XILINX_VITIS)/aietools +ifeq ($(HOST_ARCH), x86) +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/lnx64.o -ladf_api_xrt +else +AIE_CXXFLAGS_INC += -I $(XILINX_VITIS)/aietools/include +AIE_LDFLAGS_LD += -L $(XILINX_VITIS)/aietools/lib/aarch64.o -ladf_api_xrt +endif +CXXFLAGS += $(AIE_CXXFLAGS_INC) +LDFLAGS += $(AIE_LDFLAGS_LD) + +AIE_WORK_DIR ?= Work +AIE_PKG_DIR ?= Work + +# Setting customized_params in aiecompiler + +############################ setting AIE Compiler ########################### +ifneq ($(filter aiesim hw_emu hw, $(TARGET)),) +AIETARGET := hw +else +AIETARGET := x86sim +endif + +AIE_CXXFLAGS += --target=$(AIETARGET) --platform=$(XPLATFORM) --pl-freq=100 +AIE_CXXFLAGS += $(AIE_CXXFLAGS_INC) +AIE_CONTAINER = $(TEMP_DIR)/libadf.a +AIE_WORK_DIR = $(CUR_DIR)/Work +AIE_PKG_DIR = $(AIE_WORK_DIR) +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L1/include/ +AIE_CXXFLAGS += -I $(XFLIB_DIR)/L2/include/ +$(AIE_WORK_DIR)/ps/c_rts/aie_control_xrt.cpp: $(AIE_CONTAINER) + +EXE_FILE_DEPS += $(AIE_CONTAINER) +BINARY_CONTAINERS_DEPS += $(AIE_CONTAINER) +AIESIMFLAGS += $(EXTRA_AIESIMFLAGS) + +########################## Setting up Host Variables ########################## + +#Inclue Required Host Source Files +ifeq ($(ps_on_x86), on) +HOST_SRCS += $(XFLIB_DIR)/L3/tests/synthetic_aperture/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L3/include -I $(XFLIB_DIR)/L3/tests/synthetic_aperture/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +else +HOST_SRCS += $(XFLIB_DIR)/L3/tests/synthetic_aperture/PS_host/host.cpp $(CUR_DIR)/Work/ps/c_rts/aie_control_xrt.cpp +CXXFLAGS += -D __PS_ENABLE_AIE__ +CXXFLAGS += -I $(XFLIB_DIR)/L1/include -I $(XFLIB_DIR)/L2/include -I $(XFLIB_DIR)/L3/include -I $(XFLIB_DIR)/L3/tests/synthetic_aperture/aie_graph +CXXFLAGS += -include $(XFLIB_DIR)/L1/include/kernels.hpp +endif + +# workaround for opencv +ifeq (,$(findstring opencv,$(CXXFLAGS))) +#CXXFLAGS += $(XRT_CXXFLAGS) +endif + +EXE_NAME := host.exe +EXE_FILE := $(BUILD_DIR)/$(EXE_NAME) +EXE_FILE_DEPS := $(HOST_SRCS) $(EXE_FILE_DEPS) + +HOST_ARGS := -xclbin synthetic_aperture.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +ifeq ($(TARGET),$(filter $(TARGET),sw_emu)) +HOST_ARGS := -xclbin $(BUILD_DIR)/synthetic_aperture.xclbin -data data/ +ifneq ($(HOST_ARCH), x86) +PKG_HOST_ARGS = $(foreach args,$(HOST_ARGS),$(subst $(dir $(patsubst %/,%,$(args))),,$(args))) +endif +endif + +########################## Kernel compiler global settings ########################## +ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/')) +VPP_FLAGS += +VPP_LDFLAGS += --config $(CUR_DIR)/system.cfg +VPP_PACKAGE += --package.defer_aie_run + +else + +endif + +######################### binary container global settings ########################## +VPP_FLAGS_mm2s1 += +VPP_FLAGS_mm2s1 += --hls.clock 100000000:mm2s1 +VPP_FLAGS_mm2s2 += +VPP_FLAGS_mm2s2 += --hls.clock 100000000:mm2s2 +VPP_FLAGS_mm2s3 += +VPP_FLAGS_mm2s3 += --hls.clock 100000000:mm2s3 +VPP_FLAGS_mm2s4 += +VPP_FLAGS_mm2s4 += --hls.clock 100000000:mm2s4 +VPP_FLAGS_mm2s5 += +VPP_FLAGS_mm2s5 += --hls.clock 100000000:mm2s5 +VPP_FLAGS_mm2s6 += +VPP_FLAGS_mm2s6 += --hls.clock 100000000:mm2s6 +VPP_FLAGS_mm2s7 += +VPP_FLAGS_mm2s7 += --hls.clock 100000000:mm2s7 +VPP_FLAGS_mm2s8 += +VPP_FLAGS_mm2s8 += --hls.clock 100000000:mm2s8 +VPP_FLAGS_mm2s9 += +VPP_FLAGS_mm2s9 += --hls.clock 100000000:mm2s9 +VPP_FLAGS_mm2s10 += +VPP_FLAGS_mm2s10 += --hls.clock 100000000:mm2s10 +VPP_FLAGS_mm2s11 += +VPP_FLAGS_mm2s11 += --hls.clock 100000000:mm2s11 +VPP_FLAGS_mm2s12 += +VPP_FLAGS_mm2s12 += --hls.clock 100000000:mm2s12 +VPP_FLAGS_mm2s13 += +VPP_FLAGS_mm2s13 += --hls.clock 100000000:mm2s13 +VPP_FLAGS_mm2s14 += +VPP_FLAGS_mm2s14 += --hls.clock 100000000:mm2s14 +VPP_FLAGS_mm2s15 += +VPP_FLAGS_mm2s15 += --hls.clock 100000000:mm2s15 +VPP_FLAGS_mm2s16 += +VPP_FLAGS_mm2s16 += --hls.clock 100000000:mm2s16 +VPP_FLAGS_mm2s17 += +VPP_FLAGS_mm2s17 += --hls.clock 100000000:mm2s17 +VPP_FLAGS_mm2s18 += +VPP_FLAGS_mm2s18 += --hls.clock 100000000:mm2s18 +VPP_FLAGS_mm2s19 += +VPP_FLAGS_mm2s19 += --hls.clock 100000000:mm2s19 +VPP_FLAGS_mm2s20 += +VPP_FLAGS_mm2s20 += --hls.clock 100000000:mm2s20 +VPP_FLAGS_mm2s21 += +VPP_FLAGS_mm2s21 += --hls.clock 100000000:mm2s21 +VPP_FLAGS_mm2s22 += +VPP_FLAGS_mm2s22 += --hls.clock 100000000:mm2s22 +VPP_FLAGS_mm2s23 += +VPP_FLAGS_mm2s23 += --hls.clock 100000000:mm2s23 +VPP_FLAGS_mm2s24 += +VPP_FLAGS_mm2s24 += --hls.clock 100000000:mm2s24 +VPP_FLAGS_mm2s25 += +VPP_FLAGS_mm2s25 += --hls.clock 100000000:mm2s25 +VPP_FLAGS_mm2s26 += +VPP_FLAGS_mm2s26 += --hls.clock 100000000:mm2s26 +VPP_FLAGS_mm2s27 += +VPP_FLAGS_mm2s27 += --hls.clock 100000000:mm2s27 +VPP_FLAGS_mm2s28 += +VPP_FLAGS_mm2s28 += --hls.clock 100000000:mm2s28 +VPP_FLAGS_s2mm1 += +VPP_FLAGS_s2mm1 += --hls.clock 100000000:s2mm1 +VPP_FLAGS_s2mm2 += +VPP_FLAGS_s2mm2 += --hls.clock 100000000:s2mm2 +VPP_FLAGS_s2mm3 += +VPP_FLAGS_s2mm3 += --hls.clock 100000000:s2mm3 +VPP_FLAGS_s2mm4 += +VPP_FLAGS_s2mm4 += --hls.clock 100000000:s2mm4 +VPP_FLAGS_s2mm5 += +VPP_FLAGS_s2mm5 += --hls.clock 100000000:s2mm5 +VPP_FLAGS_s2mm6 += +VPP_FLAGS_s2mm6 += --hls.clock 100000000:s2mm6 + +ifneq ($(SD_CARD_NEEDED), on) +BINARY_CONTAINERS += $(BUILD_DIR)/synthetic_aperture.xclbin +else +BINARY_CONTAINERS += $(BUILD_DIR)/synthetic_aperture_pkg.$(LINK_TARGET_FMT) +BINARY_CONTAINERS_PKG += $(BUILD_DIR)/synthetic_aperture.xclbin +endif + +# ################ Setting Rules for Binary Containers (Building Kernels) ################ +$(TEMP_DIR)/mm2s1.xo: $(XFLIB_DIR)/L3/tests/synthetic_aperture/PL_kernels/mm2s1.cpp + $(ECHO) "Compiling Kernel: mm2s1" + mkdir -p $(TEMP_DIR) + $(VPP) -c $(VPP_FLAGS_mm2s1) $(VPP_FLAGS) -k mm2s1 -I'$(> $(RUN_SCRIPT) +ifneq ($(filter sw_emu hw_emu, $(TARGET)),) + @echo 'export XCL_EMULATION_MODE=$(TARGET)' >> $(RUN_SCRIPT) +endif + @echo 'export XILINX_VITIS=/mnt' >> $(RUN_SCRIPT) + @echo 'export XILINX_XRT=/usr' >> $(RUN_SCRIPT) + @echo 'if [ -f platform_desc.txt ]; then' >> $(RUN_SCRIPT) + @echo ' cp platform_desc.txt /etc/xocl.txt' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo './$(EXE_NAME) $(PKG_HOST_ARGS)' >> $(RUN_SCRIPT) + @echo 'return_code=$$?' >> $(RUN_SCRIPT) + @echo 'if [ $$return_code -ne 0 ]; then' >> $(RUN_SCRIPT) + @echo ' echo "ERROR: TEST FAILED, RC=$$return_code"' >> $(RUN_SCRIPT) + @echo 'else' >> $(RUN_SCRIPT) + @echo ' echo "INFO: TEST PASSED, RC=0"' >> $(RUN_SCRIPT) + @echo 'fi' >> $(RUN_SCRIPT) + @echo 'echo "INFO: Embedded host run completed."' >> $(RUN_SCRIPT) + @echo 'exit $$return_code' >> $(RUN_SCRIPT) +DATA_FILE := $(custom_data_file) +DATA_DIR := $(CUR_DIR)//data $(custom_data_dir) +SD_FILES += $(RUN_SCRIPT) +SD_FILES += $(EXE_FILE) +SD_FILES += $(EMCONFIG) +SD_FILES += xrt.ini +SD_FILES += $(DATA_FILE)# where define DATAFILE in json +SD_FILES_WITH_PREFIX = $(foreach sd_file,$(SD_FILES), $(if $(filter $(sd_file),$(wildcard $(sd_file))), --package.sd_file $(sd_file))) +SD_DIRS_WITH_PREFIX = $(foreach sd_dir,$(DATA_DIR),--package.sd_dir $(sd_dir)) +PACKAGE_FILES := $(BINARY_CONTAINERS) +PACKAGE_FILES += $(AIE_CONTAINER) +SD_CARD := $(CUR_DIR)/package_$(TARGET) +$(SD_CARD): host xclbin $(RUN_SCRIPT) $(EMCONFIG) check_kimage check_rootfs + @echo "Generating sd_card folder...." + mkdir -p $(SD_CARD) + chmod a+rx $(BUILD_DIR)/run_script.sh +# 1. DFX HW Flow +ifeq ($(dfx_hw), on) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p $(PACKAGE_FILES) $(VPP_PACKAGE) -o $(BINARY_CONTAINERS_PKG) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -p --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) --package.sd_file $(BINARY_CONTAINERS_PKG) + @echo "### ***** sd_card generation done! ***** ###" +endif +# 2. PS_ON_X86 - From 2022.2, Target:sw_emu +ifeq ($(ps_on_x86), on) + @echo "### ***** running PS X86 SE_EMU ***** ###" + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.emu_ps x86 +endif +# 3. AIE_ON_X86 Flow +ifeq ($(pcie_aie), on) + @echo "### ***** running AIE ON_X86 ***** ###" + ${VPP} -p $(VPP_PACKAGE) -t ${TARGET} -f ${XPLATFORM} ${AIE_CONTAINER} ${BINARY_CONTAINERS} -o $(BINARY_CONTAINERS_PKG) --package.boot_mode ospi + @echo "### ***** sd_card generation done! ***** ###" +endif +# 4. General Embeded flow +ifeq ($(dfx_hw), off) +ifeq ($(ps_on_x86), off) +ifeq ($(pcie_aie), off) + $(VPP) -t $(TARGET) --platform $(XPLATFORM) -o $(BINARY_CONTAINERS_PKG) -p $(PACKAGE_FILES) $(VPP_PACKAGE) --package.out_dir $(SD_CARD) --package.rootfs $(ROOTFS) --package.kernel_image $(K_IMAGE) --package.boot_mode sd $(SD_FILES_WITH_PREFIX) $(SD_DIRS_WITH_PREFIX) + @echo "### ***** sd_card generation done! ***** ###" +endif +endif +endif + +.PHONY: sd_card +sd_card: $(SD_CARD) +endif +############################## Setting Essential Checks and Building Rules ############################## +ifneq (,$(filter x86sim aiesim, $(TARGET))) +RUN_DEPS += $(AIE_CONTAINER) +else +RUN_DEPS += host xclbin $(EMCONFIG) +RUN_DEPS += $(SD_CARD) +endif + +.PHONY: mkflag all run +mkflag: + mkdir -p $(BUILD_DIR) + rm -rf $(BUILD_DIR)/makefile_args.txt + @for var in $(MAKEFLAGS); do echo $$var >> $(BUILD_DIR)/makefile_args.txt; done + +all: check_device check_vpp check_platform mkflag $(RUN_DEPS) + +run: all +#x86sim +ifeq ($(TARGET), x86sim) + $(X86SIMULATOR) --pkg-dir=$(AIE_PKG_DIR) + +endif +#aiesim +ifeq ($(TARGET), aiesim) + $(AIESIMULATOR) --pkg-dir=$(AIE_PKG_DIR) --profile $(AIESIMFLAGS) + +endif +#hw_emu +ifneq (,$(filter hw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) +ifeq ($(pcie_aie), on) + cp Work/reports/dma_lock_report.json ./ + cp Work/ps/c_rts/aie_control_config.json ./ + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) $(BINARY_CONTAINERS_PKG) + +endif + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#sw_emu +ifneq (,$(filter sw_emu, $(TARGET))) +ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + XCL_EMULATION_MODE=$(TARGET) $(EXE_FILE) $(HOST_ARGS) + +else + @echo $(RUN_DEPS) + $(SD_CARD)/launch_$(TARGET).sh -no-reboot -run-app $(notdir $(RUN_SCRIPT)) + grep "TEST PASSED, RC=0" $(SD_CARD)/qemu_output.log || exit 1 + +endif +endif +#hw +ifeq ($(TARGET), hw) +ifneq (,$(findstring aws-vu9p-f1, $(PLATFORM_NAME))) +ifeq (,$(wildcard $(BUILD_DIR)/synthetic_aperture.awsxclbin)) + $(ECHO) "This makefile does not directly support converting .xclbin to .awsxclbin, please refer https://github.com/aws/aws-fpga/blob/master/Vitis/README.md for next operations" +else + $(ECHO) "Running HW using generated .awsxclbin" + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(subst .xclbin,.awsxclbin,$(HOST_ARGS)) + +endif +else ifeq ($(HOST_ARCH), x86) + LD_LIBRARY_PATH=$(LIBRARY_PATH):$$LD_LIBRARY_PATH \ + $(EXE_FILE) $(HOST_ARGS) + +else + $(ECHO) "Please copy the content of sd_card folder and data to an SD Card and run on the board" +endif +endif + +############################## Setting Targets ############################## + +.PHONY: clean cleanall emconfig +emconfig: $(EMCONFIG) + +.PHONY: host +ifeq ($(HOST_ARCH), x86) +host: check_xrt $(EXE_FILE) +else +host: check_sysroot $(EXE_FILE) +endif + +.PHONY: xclbin +ifeq ($(HOST_ARCH), x86) +xclbin: check_vpp check_xrt $(BINARY_CONTAINERS) +else +xclbin: check_vpp check_sysroot $(BINARY_CONTAINERS) +endif + +############################## Cleaning Rules ############################## +cleanh: + -$(RMDIR) $(EXE_FILE) vitis_* TempConfig system_estimate.xtxt *.rpt .run/ + -$(RMDIR) src/*.ll _xocc_* .Xil dltmp* xmltmp* *.log *.jou *.wcfg *.wdb sample_link.ini sample_compile.ini obj* bin* *.csv *.jpg *.jpeg *.png *.db + +cleank: + -$(RMDIR) $(BUILD_DIR)/*.xclbin _vimage *xclbin.run_summary qemu-memory-_* emulation/ _vimage/ pl*start_simulation. sh *.xclbin + -$(RMDIR) _x_temp.* _x* + +cleanall: cleanh cleank + -$(RMDIR) $(BUILD_DIR) sd_card* emconfig.json *.html $(TEMP_DIR) $(CUR_DIR)/reports *.csv *.run_summary $(CUR_DIR)/*.raw package_* $(BUILD_DIR)/run_script.sh .ipcache *.str + -$(RMDIR) $(AIE_CONTAINER) aiesimulator_output .AIE_SIM_CMD_LINE_OPTIONS x86simulator_output $(AIE_WORK_DIR) $(AIE_PKG_DIR) $(CUR_DIR)/*.xpe $(CUR_DIR)/hw.o $(CUR_DIR)/*.xsa $(CUR_DIR)/xnwOut + -$(RMDIR) + +clean: cleanh diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s1.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s1.cpp new file mode 100644 index 0000000000..595ea8a658 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s10.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s10.cpp new file mode 100644 index 0000000000..b0a033e406 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s10.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s10(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s11.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s11.cpp new file mode 100644 index 0000000000..d4a56b4bb6 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s11.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s11(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s12.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s12.cpp new file mode 100644 index 0000000000..cfeaca1009 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s12.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s12(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s13.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s13.cpp new file mode 100644 index 0000000000..903bb8c335 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s13.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s13(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s14.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s14.cpp new file mode 100644 index 0000000000..1b9b9e8306 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s14.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s14(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s15.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s15.cpp new file mode 100644 index 0000000000..f55603432a --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s15.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s15(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s16.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s16.cpp new file mode 100644 index 0000000000..402a0eb95d --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s16.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s16(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s17.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s17.cpp new file mode 100644 index 0000000000..1c230772cf --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s17.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s17(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s18.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s18.cpp new file mode 100644 index 0000000000..aadb7b12a9 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s18.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s18(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s19.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s19.cpp new file mode 100644 index 0000000000..bafa9e5013 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s19.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s19(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s2.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s2.cpp new file mode 100644 index 0000000000..a602d3267e --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s20.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s20.cpp new file mode 100644 index 0000000000..f095a84c1e --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s20.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s20(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s21.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s21.cpp new file mode 100644 index 0000000000..fee6e75230 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s21.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s21(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s22.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s22.cpp new file mode 100644 index 0000000000..bf954f3077 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s22.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s22(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s23.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s23.cpp new file mode 100644 index 0000000000..c7343611a4 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s23.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s23(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s24.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s24.cpp new file mode 100644 index 0000000000..2b8d77f668 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s24.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s24(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s25.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s25.cpp new file mode 100644 index 0000000000..60b53305a2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s25.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s25(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s26.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s26.cpp new file mode 100644 index 0000000000..2183e0abfc --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s26.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s26(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s27.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s27.cpp new file mode 100644 index 0000000000..0c6cefccd2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s27.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s27(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s28.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s28.cpp new file mode 100644 index 0000000000..e2baab32a5 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s28.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s28(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s3.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s3.cpp new file mode 100644 index 0000000000..241b7cfe56 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s4.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s4.cpp new file mode 100644 index 0000000000..8b829dc363 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s4.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s5.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s5.cpp new file mode 100644 index 0000000000..583828c713 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s6.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s6.cpp new file mode 100644 index 0000000000..172d9d16b5 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s7.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s7.cpp new file mode 100644 index 0000000000..b0a4a405aa --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s7.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s7(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s8.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s8.cpp new file mode 100644 index 0000000000..f89f755ec6 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s8.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s8(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s9.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s9.cpp new file mode 100644 index 0000000000..a779d2134c --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s9.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void mm2s9(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + s.write(mem[i]); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm1.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm1.cpp new file mode 100644 index 0000000000..12b45397b3 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm1.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm1(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm2.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm2.cpp new file mode 100644 index 0000000000..3d340b899f --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm2.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm2(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm3.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm3.cpp new file mode 100644 index 0000000000..ffcc5aa5be --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm3.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm3(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm4.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm4.cpp new file mode 100644 index 0000000000..c5fc0ce27d --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm4.cpp @@ -0,0 +1,26 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +extern "C" { + +void s2mm4(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm5.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm5.cpp new file mode 100644 index 0000000000..dee3325235 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm5.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm5(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm6.cpp b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm6.cpp new file mode 100644 index 0000000000..17c936f413 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PL_kernels/s2mm6.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +extern "C" { + +void s2mm6(float* mem, hls::stream& s, int size) { + for (unsigned i = 0; i < size; ++i) { +#pragma HLS PIPELINE II = 1 + mem[i] = s.read(); + } +} +} diff --git a/ultrasound/L3/tests/synthetic_aperture/PS_host/host.cpp b/ultrasound/L3/tests/synthetic_aperture/PS_host/host.cpp new file mode 100644 index 0000000000..6f4ff88531 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PS_host/host.cpp @@ -0,0 +1,151 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#include +#include +#include +#include +#include + +// This is used for the PL Kernels +#include "xrt.h" +#include "experimental/xrt_kernel.h" + +// Using the ADF API that call XRT API +#include "adf/adf_api/XRTConfig.h" + +#include "synthetic_aperture.hpp" + +#define INPUT_RANGE 28 +#define OUTPUT_RANGE 6 +#define ITER 1 + +class ArgParser { + public: + ArgParser(int& argc, const char** argv) { + for (int i = 1; i < argc; ++i) mTokens.push_back(std::string(argv[i])); + } + bool getCmdOption(const std::string option, std::string& value) const { + std::vector::const_iterator itr; + itr = std::find(this->mTokens.begin(), this->mTokens.end(), option); + if (itr != this->mTokens.end() && ++itr != this->mTokens.end()) { + value = *itr; + return true; + } + return false; + } + + private: + std::vector mTokens; +}; + +void init_output_buffer(float* res_out[], float* res_out_size) { + /* for this test, assume 1 graph run in aie processing */ + + float golden_sizeOut[OUTPUT_RANGE]; + golden_sizeOut[0] = 128; // image-points output + golden_sizeOut[1] = 32; // delay output + golden_sizeOut[2] = 32; // focusing output + golden_sizeOut[3] = 32; // samples + golden_sizeOut[4] = 32; // apodization + golden_sizeOut[5] = 128; // apodization + + // output buffer init + for (int i = 0; i < OUTPUT_RANGE; i++) { + int size = golden_sizeOut[i]; + res_out[i] = new float[size]; + } + + // size init + for (int i = 0; i < OUTPUT_RANGE; i++) { + res_out_size[i] = golden_sizeOut[i]; + } +} + +int main(int argc, const char** argv) { + ////////////////////////////////////////// + // input cmd parser + ////////////////////////////////////////// + ArgParser parser(argc, argv); + + std::string xclbin_path; + if (!parser.getCmdOption("-xclbin", xclbin_path)) { + std::cout << "ERROR:[-xclbin] xclbin path is not set!\n"; + return 1; + } + + std::string data_path; + if (!parser.getCmdOption("-data", data_path)) { + std::cout << "ERROR:[-data] data path is not set!\n"; + return 1; + } + + // output result buffer + float* res_out[OUTPUT_RANGE]; + float res_out_size[OUTPUT_RANGE]; + + // init output buffer + init_output_buffer(res_out, res_out_size); + + // run aie application + us::L3::synthetic_aperture<>(xclbin_path, data_path, res_out, res_out_size, ITER); + + ////////////////////////////////////////// + // Comparing the execution data to the golden data + ////////////////////////////////////////// + + int err_cnt = 0; + std::string golden_file_set[OUTPUT_RANGE]; + golden_file_set[0] = data_path + "golden/image_points.txt"; + golden_file_set[1] = data_path + "golden/delay_to_PL.txt"; + golden_file_set[2] = data_path + "golden/focusing_output.txt"; + golden_file_set[3] = data_path + "golden/apodization.txt"; + golden_file_set[4] = data_path + "golden/samples_to_PL.txt"; + golden_file_set[5] = data_path + "golden/C.txt"; + + // loading golden data + float* golden_buf_mem[OUTPUT_RANGE]; + int golden_sizeOut[OUTPUT_RANGE]; + + golden_sizeOut[0] = 128; // image-points output + golden_sizeOut[1] = 32; // delay output + golden_sizeOut[2] = 32; // focusing sa output + golden_sizeOut[3] = 32; // apodization sa output + golden_sizeOut[4] = 32; // samples + golden_sizeOut[5] = 128; // interpolator + + for (int i = 0; i < OUTPUT_RANGE; i++) { + golden_buf_mem[i] = data_loading(golden_file_set[i], golden_sizeOut[i]); + } + + for (int k = 0; k < OUTPUT_RANGE; k++) { + std::cout << golden_file_set[k] << std::endl; + for (int i = 0; i < golden_sizeOut[k]; i++) { + float result_tmp = (float)res_out[k][i]; + float result_golden = (float)golden_buf_mem[k][i]; + if (result_tmp != result_golden) { + printf("i:%d, golden:%f result:%f\n", i, result_golden, result_tmp); + err_cnt++; + } + } + } + + for (int i = 0; i < OUTPUT_RANGE; i++) { + delete[] res_out[i]; + } + + // End + printf("Test Done, err_cnt:%d\n", err_cnt); + + return err_cnt; +} \ No newline at end of file diff --git a/ultrasound/L3/tests/synthetic_aperture/PS_host/host.hpp b/ultrasound/L3/tests/synthetic_aperture/PS_host/host.hpp new file mode 100644 index 0000000000..e3f25f1d23 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/PS_host/host.hpp @@ -0,0 +1,33 @@ +/********** +© Copyright 2020 Xilinx, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**********/ + +#pragma once + +#define CL_HPP_CL_1_2_DEFAULT_BUILD +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1 + +#include + +// Customized buffer allocation for 4K boundary alignment +template +struct aligned_allocator { + using value_type = T; + T* allocate(std::size_t num) { + void* ptr = nullptr; + if (posix_memalign(&ptr, 4096, num * sizeof(T))) throw std::bad_alloc(); + return reinterpret_cast(ptr); + } + void deallocate(T* p, std::size_t num) { free(p); } +}; diff --git a/ultrasound/L3/tests/synthetic_aperture/aie_graph/graph.cpp b/ultrasound/L3/tests/synthetic_aperture/aie_graph/graph.cpp new file mode 100644 index 0000000000..ac38bf87bf --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/aie_graph/graph.cpp @@ -0,0 +1,220 @@ +/* + * Copyright 2022 Xilinx, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "imagePoints.hpp" +#include "delay.hpp" +#include "focusing_sa.hpp" +#include "samples.hpp" +#include "apodization_sa.hpp" +#include "bSpline.hpp" + +namespace us { +namespace L3 { + +class synthetic_aperture : public adf::graph { + public: + // INPUTS + // IMAGE POINTS + adf::input_plio start_positions; + adf::input_plio directions; + adf::input_plio samples_arange; + // DELAY + adf::input_plio image_points_from_PL; + adf::input_plio image_points_from_PL_2; + adf::input_plio tx_def_delay_distance; + adf::input_plio tx_def_delay_distance_2; + adf::input_plio tx_def_focal_point; + adf::input_plio tx_def_ref_point; + adf::input_plio t_start; + // FOCUSING SA + adf::input_plio apo_ref_0_sa; + adf::input_plio img_points_0_sa; + adf::input_plio apo_ref_1_sa; + adf::input_plio img_points_1_sa; + // APODIZATION SA + adf::input_plio image_points_sa; + adf::input_plio apodization_reference_sa; + adf::input_plio apo_distance_k_sa; + adf::input_plio F_number_sa; + // SAMPLES + adf::input_plio image_points_from_PL_3; + adf::input_plio delay_from_PL; + adf::input_plio xdc_def_positions; + adf::input_plio sampling_frequency; + // INTERPOLATOR + adf::input_plio P1; + adf::input_plio P2; + adf::input_plio P3; + adf::input_plio P4; + adf::input_plio P5; + adf::input_plio P6; + + // OUTPUTS + // IMAGE POINTS + adf::output_plio image_points_output; + // DELAY + adf::output_plio delay_to_PL; + // FOCUSING SA + adf::output_plio focusing_output_tx; + // APODIZATION SA + adf::output_plio apodization_output_tx; + // SAMPLES + adf::output_plio samples_to_PL; + // INTERPOLATOR + adf::output_plio C; + + // GRAPH DECLARATIONS + us::L2::imagePoints_graph<> img; + us::L2::delay_graph<> d; + us::L2::focusing_sa_graph<> foc_sa; + us::L2::apodization_sa_graph<> apo_sa; + us::L2::samples_graph<> sam; + us::L2::bSpline_graph<> interp; + + synthetic_aperture() { + /////////////////INPUTS + // IMAGE POINTS + start_positions = adf::input_plio::create("start_positions", adf::plio_32_bits, "data/start_positions.txt"); + directions = adf::input_plio::create("directions", adf::plio_32_bits, "data/directions.txt"); + samples_arange = adf::input_plio::create("samples_arange", adf::plio_32_bits, "data/samples_arange.txt"); + // DELAY + image_points_from_PL = + adf::input_plio::create("image_points_from_PL", adf::plio_32_bits, "data/image_points.txt"); + image_points_from_PL_2 = + adf::input_plio::create("image_points_from_PL_2", adf::plio_32_bits, "data/image_points.txt"); + tx_def_delay_distance = + adf::input_plio::create("tx_def_delay_distance", adf::plio_32_bits, "data/tx_def_delay_distance.txt"); + tx_def_ref_point = adf::input_plio::create("tx_def_ref_point", adf::plio_32_bits, "data/tx_def_ref_point.txt"); + tx_def_delay_distance_2 = + adf::input_plio::create("tx_def_delay_distance_2", adf::plio_32_bits, "data/tx_def_delay_distance.txt"); + tx_def_focal_point = + adf::input_plio::create("tx_def_focal_point", adf::plio_32_bits, "data/tx_def_focal_point.txt"); + t_start = adf::input_plio::create("t_start", adf::plio_32_bits, "data/t_start.txt"); + // FOCUSING SA + apo_ref_0_sa = adf::input_plio::create("apo_ref_0_tx", adf::plio_32_bits, "data/apo_ref_0.txt"); + img_points_0_sa = adf::input_plio::create("img_points_0", adf::plio_32_bits, "data/xdc_def_0.txt"); + apo_ref_1_sa = adf::input_plio::create("apo_ref_1_tx", adf::plio_32_bits, "data/apo_ref_1.txt"); + img_points_1_sa = adf::input_plio::create("img_points_1_tx", adf::plio_32_bits, "data/xdc_def_1.txt"); + // APODIZATION SA + image_points_sa = adf::input_plio::create("image_points_tx", adf::plio_32_bits, "data/image_points.txt"); + apodization_reference_sa = + adf::input_plio::create("apodization_reference_tx", adf::plio_32_bits, "data/apodization_reference.txt"); + apo_distance_k_sa = adf::input_plio::create("apo_distance_k_tx", adf::plio_32_bits, "data/apo_distance_k.txt"); + F_number_sa = adf::input_plio::create("F_number_tx", adf::plio_32_bits, "data/F_number.txt"); + // SAMPLES + image_points_from_PL_3 = + adf::input_plio::create("image_points_from_PL_3", adf::plio_32_bits, "data/image_points.txt"); + delay_from_PL = adf::input_plio::create("delay_from_PL", adf::plio_32_bits, "data/delay_from_PL.txt"); + xdc_def_positions = + adf::input_plio::create("xdc_def_positions", adf::plio_32_bits, "data/xdc_def_positions.txt"); + sampling_frequency = + adf::input_plio::create("sampling_frequency", adf::plio_32_bits, "data/sampling_frequency.txt"); + // INTERPOLATOR + P1 = adf::input_plio::create("P1", adf::plio_32_bits, "data/P1.txt"); + P2 = adf::input_plio::create("P2", adf::plio_32_bits, "data/P2.txt"); + P3 = adf::input_plio::create("P3", adf::plio_32_bits, "data/P3.txt"); + P4 = adf::input_plio::create("P4", adf::plio_32_bits, "data/P4.txt"); + P5 = adf::input_plio::create("P5", adf::plio_32_bits, "data/P5.txt"); + P6 = adf::input_plio::create("P6", adf::plio_32_bits, "data/P6.txt"); + + /////////////////OUTPUTS + // IMAGE POINTS + image_points_output = adf::output_plio::create("image_points", adf::plio_32_bits, "data/image_points.txt"); + // DELAY + delay_to_PL = adf::output_plio::create("delay_to_PL", adf::plio_32_bits, "data/delay_to_PL.txt"); + // FOCUSING SA + focusing_output_tx = + adf::output_plio::create("focusing_output_tx", adf::plio_32_bits, "data/focusing_output.txt"); + // APODIZATION SA + apodization_output_tx = adf::output_plio::create("apodization_tx", adf::plio_32_bits, "data/apodization.txt"); + // SAMPLES + samples_to_PL = adf::output_plio::create("samples_to_PL", adf::plio_32_bits, "data/samples_to_PL.txt"); + // INTERPOLATOR + C = adf::output_plio::create("C", adf::plio_32_bits, "data/C.txt"); + + // GRAPH I/O SPECIFICATION + // INPUT + // IMAGE POINTS + adf::connect<>(start_positions.out[0], img.start_positions); + adf::connect<>(directions.out[0], img.directions); + adf::connect<>(samples_arange.out[0], img.samples_arange); + // DELAY + adf::connect<>(image_points_from_PL.out[0], d.image_points_from_PL); + adf::connect<>(image_points_from_PL_2.out[0], d.image_points_from_PL_); + adf::connect<>(tx_def_delay_distance.out[0], d.tx_def_delay_distance); + adf::connect<>(tx_def_delay_distance_2.out[0], d.tx_def_delay_distance2); + adf::connect<>(tx_def_focal_point.out[0], d.tx_def_focal_point); + adf::connect<>(tx_def_ref_point.out[0], d.tx_def_ref_point); + adf::connect<>(t_start.out[0], d.t_start); + // FOCUSING SA + adf::connect<>(apo_ref_0_sa.out[0], foc_sa.apo_ref_0); + adf::connect<>(img_points_0_sa.out[0], foc_sa.img_points_0); + adf::connect<>(apo_ref_1_sa.out[0], foc_sa.apo_ref_1); + adf::connect<>(img_points_1_sa.out[0], foc_sa.img_points_1); + // APODIZATION SA + adf::connect<>(image_points_sa.out[0], apo_sa.image_points); + adf::connect<>(apodization_reference_sa.out[0], apo_sa.apodization_reference); + adf::connect<>(apo_distance_k_sa.out[0], apo_sa.apo_distance_k); + adf::connect<>(F_number_sa.out[0], apo_sa.F_number); + // SAMPLES + adf::connect<>(image_points_from_PL_3.out[0], sam.image_points_from_PL); + adf::connect<>(delay_from_PL.out[0], sam.delay_from_PL); + adf::connect<>(xdc_def_positions.out[0], sam.xdc_def_positions); + adf::connect<>(sampling_frequency.out[0], sam.sampling_frequency); + // INTERPOLATOR + adf::connect<>(P1.out[0], interp.P1); + adf::connect<>(P2.out[0], interp.P2); + adf::connect<>(P3.out[0], interp.P3); + adf::connect<>(P4.out[0], interp.P4); + adf::connect<>(P5.out[0], interp.P5); + adf::connect<>(P6.out[0], interp.P6); + + // OUTPUT + // IMAGE POINTS + adf::connect<>(img.image_points, image_points_output.in[0]); + // DELAY + adf::connect<>(d.delay_to_PL, delay_to_PL.in[0]); + // FOCUSING SA + adf::connect<>(foc_sa.focusing_output, focusing_output_tx.in[0]); + // APODIZATION SA + adf::connect<>(apo_sa.apodization_output, apodization_output_tx.in[0]); + // SAMPLES + adf::connect<>(sam.samples_to_PL, samples_to_PL.in[0]); + // INTERPOLATOR + adf::connect<>(interp.C, C.in[0]); + } +}; +} // namespace L3 +} // namespace us + +// graph object instantiate +us::L3::synthetic_aperture sa; + +// TEST MAIN (EMULATION AIE) +#if defined(__AIESIM__) || defined(__X86SIM__) +int main(void) { + // INIT SA GRAPH + sa.init(); + + // run SA graph + sa.run(1); + + // ENDING SA (CANNOT BE RE-INSTANTIATED) + sa.end(); + + return 0; +} +#endif diff --git a/ultrasound/L3/tests/synthetic_aperture/data/F_number.txt b/ultrasound/L3/tests/synthetic_aperture/data/F_number.txt new file mode 100644 index 0000000000..b0f057e95a --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/F_number.txt @@ -0,0 +1,188 @@ +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/P0.txt b/ultrasound/L3/tests/synthetic_aperture/data/P0.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/P0.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/P1.txt b/ultrasound/L3/tests/synthetic_aperture/data/P1.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/P1.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/P2.txt b/ultrasound/L3/tests/synthetic_aperture/data/P2.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/P2.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/P3.txt b/ultrasound/L3/tests/synthetic_aperture/data/P3.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/P3.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/P4.txt b/ultrasound/L3/tests/synthetic_aperture/data/P4.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/P4.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/P5.txt b/ultrasound/L3/tests/synthetic_aperture/data/P5.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/P5.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/P6.txt b/ultrasound/L3/tests/synthetic_aperture/data/P6.txt new file mode 100644 index 0000000000..0916b744d2 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/P6.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/apo_distance_k.txt b/ultrasound/L3/tests/synthetic_aperture/data/apo_distance_k.txt new file mode 100644 index 0000000000..8bfe45aca9 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/apo_distance_k.txt @@ -0,0 +1,128 @@ +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0058212 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 +0.0056364 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/apo_ref_0.txt b/ultrasound/L3/tests/synthetic_aperture/data/apo_ref_0.txt new file mode 100644 index 0000000000..d918d211c4 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/apo_ref_0.txt @@ -0,0 +1,192 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/apo_ref_1.txt b/ultrasound/L3/tests/synthetic_aperture/data/apo_ref_1.txt new file mode 100644 index 0000000000..d918d211c4 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/apo_ref_1.txt @@ -0,0 +1,192 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/apodization_reference.txt b/ultrasound/L3/tests/synthetic_aperture/data/apodization_reference.txt new file mode 100644 index 0000000000..bb4b72142c --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/apodization_reference.txt @@ -0,0 +1,156 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/delay_from_PL.txt b/ultrasound/L3/tests/synthetic_aperture/data/delay_from_PL.txt new file mode 100644 index 0000000000..b6d16b0698 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/delay_from_PL.txt @@ -0,0 +1,206 @@ +-6.975e-06 +-6.97e-06 +-6.965e-06 +-6.96e-06 +-6.955e-06 +-6.95e-06 +-6.945e-06 +-6.94e-06 +-6.935e-06 +-6.93e-06 +-6.925e-06 +-6.92e-06 +-6.915e-06 +-6.91e-06 +-6.905e-06 +-6.9e-06 +-6.895e-06 +-6.89e-06 +-6.885e-06 +-6.88e-06 +-6.875e-06 +-6.87e-06 +-6.865e-06 +-6.86e-06 +-6.855e-06 +-6.85e-06 +-6.845e-06 +-6.84e-06 +-6.835e-06 +-6.83e-06 +-6.825e-06 +-6.82e-06 +-6.815e-06 +-6.81e-06 +-6.805e-06 +-6.8e-06 +-6.795e-06 +-6.79e-06 +-6.785e-06 +-6.78e-06 +-6.775e-06 +-6.77e-06 +-6.765e-06 +-6.76e-06 +-6.755e-06 +-6.75e-06 +-6.745e-06 +-6.74e-06 +-6.735e-06 +-6.73e-06 +-6.725e-06 +-6.72e-06 +-6.715e-06 +-6.71e-06 +-6.705e-06 +-6.7e-06 +-6.695e-06 +-6.69e-06 +-6.685e-06 +-6.68e-06 +-6.675e-06 +-6.67e-06 +-6.665e-06 +-6.66e-06 +-6.655e-06 +-6.65e-06 +-6.645e-06 +-6.64e-06 +-6.635e-06 +-6.63e-06 +-6.625e-06 +-6.62e-06 +-6.615e-06 +-6.61e-06 +-6.605e-06 +-6.6e-06 +-6.595e-06 +-6.59e-06 +-6.585e-06 +-6.58e-06 +-6.575e-06 +-6.57e-06 +-6.565e-06 +-6.56e-06 +-6.555e-06 +-6.55e-06 +-6.545e-06 +-6.54e-06 +-6.535e-06 +-6.53e-06 +-6.525e-06 +-6.52e-06 +-6.515e-06 +-6.51e-06 +-6.505e-06 +-6.5e-06 +-6.495e-06 +-6.49e-06 +-6.485e-06 +-6.48e-06 +-6.475e-06 +-6.47e-06 +-6.465e-06 +-6.46e-06 +-6.455e-06 +-6.45e-06 +-6.445e-06 +-6.44e-06 +-6.435e-06 +-6.43e-06 +-6.425e-06 +-6.42e-06 +-6.415e-06 +-6.41e-06 +-6.405e-06 +-6.4e-06 +-6.395e-06 +-6.39e-06 +-6.385e-06 +-6.38e-06 +-6.375e-06 +-6.37e-06 +-6.365e-06 +-6.36e-06 +-6.355e-06 +-6.35e-06 +-6.345e-06 +-6.34e-06 +-6.335e-06 +-6.33e-06 +-6.325e-06 +-6.32e-06 +-6.315e-06 +-6.31e-06 +-6.305e-06 +-6.3e-06 +-6.295e-06 +-6.29e-06 +-6.285e-06 +-6.28e-06 +-6.275e-06 +-6.27e-06 +-6.265e-06 +-6.26e-06 +-6.255e-06 +-6.25e-06 +-6.245e-06 +-6.24e-06 +-6.235e-06 +-6.23e-06 +-6.225e-06 +-6.22e-06 +-6.215e-06 +-6.21e-06 +-6.205e-06 +-6.2e-06 +-6.195e-06 +-6.19e-06 +-6.185e-06 +-6.18e-06 +-6.175e-06 +-6.17e-06 +-6.165e-06 +-6.16e-06 +-6.155e-06 +-6.15e-06 +-6.145e-06 +-6.14e-06 +-6.135e-06 +-6.13e-06 +-6.125e-06 +-6.12e-06 +-6.115e-06 +-6.11e-06 +-6.105e-06 +-6.1e-06 +-6.095e-06 +-6.09e-06 +-6.085e-06 +-6.08e-06 +-6.075e-06 +-6.07e-06 +-6.065e-06 +-6.06e-06 +-6.055e-06 +-6.05e-06 +-6.045e-06 +-6.04e-06 +-6.035e-06 +-6.03e-06 +-6.025e-06 +-6.02e-06 +-6.015e-06 +-6.01e-06 +-6.005e-06 +-6e-06 +-5.995e-06 +-5.99e-06 +-5.985e-06 +-5.98e-06 +-5.975e-06 +-5.97e-06 +-5.965e-06 +-5.96e-06 +-5.955e-06 +-5.95e-06 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/directions.txt b/ultrasound/L3/tests/synthetic_aperture/data/directions.txt new file mode 100644 index 0000000000..564f5e2bb0 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/directions.txt @@ -0,0 +1,64 @@ +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 +0 +0 +0.0000077 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/golden/C.txt b/ultrasound/L3/tests/synthetic_aperture/data/golden/C.txt new file mode 100644 index 0000000000..9724bec91c --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/golden/C.txt @@ -0,0 +1,128 @@ +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +1.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +2.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +3.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +4.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +5.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +6.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +7.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +8.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +9.000000000e+00 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.000000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.100000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.200000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.300000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.400000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.500000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.600000000e+01 +1.700000000e+01 +1.700000000e+01 +1.700000000e+01 +1.700000000e+01 +1.800000000e+01 +1.800000000e+01 +1.800000000e+01 +1.800000000e+01 +1.900000000e+01 +1.900000000e+01 +1.900000000e+01 +1.900000000e+01 +2.000000000e+01 +2.000000000e+01 +2.000000000e+01 +2.000000000e+01 +2.100000000e+01 +2.100000000e+01 +2.100000000e+01 +2.100000000e+01 +2.200000000e+01 +2.200000000e+01 +2.200000000e+01 +2.200000000e+01 +2.300000000e+01 +2.300000000e+01 +2.300000000e+01 +2.300000000e+01 +2.400000000e+01 +2.400000000e+01 +2.400000000e+01 +2.400000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.500000000e+01 +2.600000000e+01 +2.600000000e+01 +2.600000000e+01 +2.600000000e+01 +2.700000000e+01 +2.700000000e+01 +2.700000000e+01 +2.700000000e+01 +2.800000000e+01 +2.800000000e+01 +2.800000000e+01 +2.800000000e+01 +2.900000000e+01 +2.900000000e+01 +2.900000000e+01 +2.900000000e+01 +3.000000000e+01 +3.000000000e+01 +3.000000000e+01 +3.000000000e+01 +3.100000000e+01 +3.100000000e+01 +3.100000000e+01 +3.100000000e+01 +3.200000000e+01 +3.200000000e+01 +3.200000000e+01 +3.200000000e+01 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/golden/apodization.txt b/ultrasound/L3/tests/synthetic_aperture/data/golden/apodization.txt new file mode 100644 index 0000000000..1d7ad2b972 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/golden/apodization.txt @@ -0,0 +1,32 @@ +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/golden/delay_to_PL.txt b/ultrasound/L3/tests/synthetic_aperture/data/golden/delay_to_PL.txt new file mode 100644 index 0000000000..2143716546 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/golden/delay_to_PL.txt @@ -0,0 +1,32 @@ +-6.974999906e-06 +-6.969999959e-06 +-6.965000011e-06 +-6.959999610e-06 +-6.954999662e-06 +-6.949999715e-06 +-6.944999768e-06 +-6.939999821e-06 +-6.935000329e-06 +-6.930000382e-06 +-6.924999980e-06 +-6.920000033e-06 +-6.915000085e-06 +-6.909999684e-06 +-6.904999736e-06 +-6.899999789e-06 +-6.894999842e-06 +-6.889999895e-06 +-6.884999948e-06 +-6.879999546e-06 +-6.875000054e-06 +-6.870000107e-06 +-6.865000159e-06 +-6.859999758e-06 +-6.854999810e-06 +-6.849999863e-06 +-6.844999916e-06 +-6.839999969e-06 +-6.835000022e-06 +-6.829999620e-06 +-6.824999673e-06 +-6.820000181e-06 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/golden/focusing_output.txt b/ultrasound/L3/tests/synthetic_aperture/data/golden/focusing_output.txt new file mode 100644 index 0000000000..0dd3697ad7 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/golden/focusing_output.txt @@ -0,0 +1,32 @@ +5.821200088e-03 +5.636400077e-03 +5.451600067e-03 +5.266800057e-03 +5.082000047e-03 +4.897200037e-03 +4.712400027e-03 +4.527600016e-03 +4.342800006e-03 +4.157999996e-03 +3.973199986e-03 +3.788399976e-03 +3.603599966e-03 +3.418799955e-03 +3.233999945e-03 +3.049199935e-03 +2.864399925e-03 +2.679599915e-03 +2.494799905e-03 +2.309999894e-03 +2.125199884e-03 +1.940399990e-03 +1.755599980e-03 +1.570799970e-03 +1.385999960e-03 +1.201199950e-03 +1.016400056e-03 +8.315999876e-04 +6.467999774e-04 +4.619999963e-04 +2.771999862e-04 +9.239999781e-05 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/golden/image_points.txt b/ultrasound/L3/tests/synthetic_aperture/data/golden/image_points.txt new file mode 100644 index 0000000000..5f5fa35a3d --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/golden/image_points.txt @@ -0,0 +1,128 @@ +0.000000000e+00 +0.000000000e+00 +7.699999958e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.707699668e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.715399843e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.723099552e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.730799727e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.738499902e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.746199612e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.753899787e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.761599962e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.769299671e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.776999846e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.784700021e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.792399731e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.800099906e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.807799615e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.815499790e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.823199965e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.830900140e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.838599384e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.846299559e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.853999734e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.861699909e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.869400084e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.877100259e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.884799503e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.892499678e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.900199853e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.907900028e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.915600203e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.923299447e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.930999622e-03 +0.000000000e+00 +0.000000000e+00 +0.000000000e+00 +7.938699797e-03 +0.000000000e+00 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/golden/samples_to_PL.txt b/ultrasound/L3/tests/synthetic_aperture/data/golden/samples_to_PL.txt new file mode 100644 index 0000000000..1889199664 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/golden/samples_to_PL.txt @@ -0,0 +1,32 @@ +-7.009420013e+01 +-6.919543457e+01 +-6.829649353e+01 +-6.739746094e+01 +-6.649819183e+01 +-6.559883881e+01 +-6.469939423e+01 +-6.379967499e+01 +-6.289991379e+01 +-6.200001526e+01 +-6.109993362e+01 +-6.019976044e+01 +-5.929936218e+01 +-5.839887238e+01 +-5.749824524e+01 +-5.659743500e+01 +-5.569653702e+01 +-5.479540634e+01 +-5.389423370e+01 +-5.299283600e+01 +-5.209148026e+01 +-5.118980789e+01 +-5.028808975e+01 +-4.938614273e+01 +-4.848401642e+01 +-4.758188629e+01 +-4.667957687e+01 +-4.577713013e+01 +-4.487454987e+01 +-4.397178268e+01 +-4.306888199e+01 +-4.216598129e+01 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/image_points.txt b/ultrasound/L3/tests/synthetic_aperture/data/image_points.txt new file mode 100644 index 0000000000..838902f514 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/image_points.txt @@ -0,0 +1,399 @@ +0 +0 +0.0076923 +0 +0 +0 +0.0077 +0 +0 +0 +0.0077077 +0 +0 +0 +0.0077154 +0 +0 +0 +0.0077231 +0 +0 +0 +0.0077308 +0 +0 +0 +0.0077385 +0 +0 +0 +0.0077462 +0 +0 +0 +0.0077539 +0 +0 +0 +0.0077616 +0 +0 +0 +0.0077693 +0 +0 +0 +0.007777 +0 +0 +0 +0.0077847 +0 +0 +0 +0.0077924 +0 +0 +0 +0.0078001 +0 +0 +0 +0.0078078 +0 +0 +0 +0.0078155 +0 +0 +0 +0.0078232 +0 +0 +0 +0.0078309 +0 +0 +0 +0.0078386 +0 +0 +0 +0.0078463 +0 +0 +0 +0.007854 +0 +0 +0 +0.0078617 +0 +0 +0 +0.0078694 +0 +0 +0 +0.0078771 +0 +0 +0 +0.0078848 +0 +0 +0 +0.0078925 +0 +0 +0 +0.0079002 +0 +0 +0 +0.0079079 +0 +0 +0 +0.0079156 +0 +0 +0 +0.0079233 +0 +0 +0 +0.007931 +0 +0 +0 +0.0079387 +0 +0 +0 +0.0079464 +0 +0 +0 +0.0079541 +0 +0 +0 +0.0079618 +0 +0 +0 +0.0079695 +0 +0 +0 +0.0079772 +0 +0 +0 +0.0079849 +0 +0 +0 +0.0079926 +0 +0 +0 +0.0080003 +0 +0 +0 +0.008008 +0 +0 +0 +0.0080157 +0 +0 +0 +0.0080234 +0 +0 +0 +0.0080311 +0 +0 +0 +0.0080388 +0 +0 +0 +0.0080465 +0 +0 +0 +0.0080542 +0 +0 +0 +0.0080619 +0 +0 +0 +0.0080696 +0 +0 +0 +0.0080773 +0 +0 +0 +0.008085 +0 +0 +0 +0.0080927 +0 +0 +0 +0.0081004 +0 +0 +0 +0.0081081 +0 +0 +0 +0.0081158 +0 +0 +0 +0.0081235 +0 +0 +0 +0.0081312 +0 +0 +0 +0.0081389 +0 +0 +0 +0.0081466 +0 +0 +0 +0.0081543 +0 +0 +0 +0.008162 +0 +0 +0 +0.0081697 +0 +0 +0 +0.0081774 +0 +0 +0 +0.0081851 +0 +0 +0 +0.0081928 +0 +0 +0 +0.0082005 +0 +0 +0 +0.0082082 +0 +0 +0 +0.0082159 +0 +0 +0 +0.0082236 +0 +0 +0 +0.0082313 +0 +0 +0 +0.008239 +0 +0 +0 +0.0082467 +0 +0 +0 +0.0082544 +0 +0 +0 +0.0082621 +0 +0 +0 +0.0082698 +0 +0 +0 +0.0082775 +0 +0 +0 +0.0082852 +0 +0 +0 +0.0082929 +0 +0 +0 +0.0083006 +0 +0 +0 +0.0083083 +0 +0 +0 +0.008316 +0 +0 +0 +0.0083237 +0 +0 +0 +0.0083314 +0 +0 +0 +0.0083391 +0 +0 +0 +0.0083468 +0 +0 +0 +0.0083545 +0 +0 +0 +0.0083622 +0 +0 +0 +0.0083699 +0 +0 +0 +0.0083776 +0 +0 +0 +0.0083853 +0 +0 +0 +0.008393 +0 +0 +0 +0.0084007 +0 +0 +0 +0.0084084 +0 +0 +0 +0.0084161 +0 +0 +0 +0.0084238 +0 +0 +0 +0.0084315 +0 +0 +0 +0.0084392 +0 +0 +0 +0.0084469 +0 +0 +0 +0.0084546 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/samples_arange.txt b/ultrasound/L3/tests/synthetic_aperture/data/samples_arange.txt new file mode 100644 index 0000000000..f765d696ea --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/samples_arange.txt @@ -0,0 +1,64 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/sampling_frequency.txt b/ultrasound/L3/tests/synthetic_aperture/data/sampling_frequency.txt new file mode 100644 index 0000000000..51084d2137 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/sampling_frequency.txt @@ -0,0 +1,136 @@ +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 +100e6 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/start_positions.txt b/ultrasound/L3/tests/synthetic_aperture/data/start_positions.txt new file mode 100644 index 0000000000..d930e21e3e --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/start_positions.txt @@ -0,0 +1,64 @@ +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 +0 +0 +0.0076923 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/t_start.txt b/ultrasound/L3/tests/synthetic_aperture/data/t_start.txt new file mode 100644 index 0000000000..a4ea7ceea3 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/t_start.txt @@ -0,0 +1,88 @@ +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 +1.197e-5 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/tx_def_delay_distance.txt b/ultrasound/L3/tests/synthetic_aperture/data/tx_def_delay_distance.txt new file mode 100644 index 0000000000..d588285663 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/tx_def_delay_distance.txt @@ -0,0 +1,100 @@ +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 +0.02 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/tx_def_focal_point.txt b/ultrasound/L3/tests/synthetic_aperture/data/tx_def_focal_point.txt new file mode 100644 index 0000000000..b7ecb0972a --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/tx_def_focal_point.txt @@ -0,0 +1,140 @@ +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 +0 +0 +0.02 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/tx_def_ref_point.txt b/ultrasound/L3/tests/synthetic_aperture/data/tx_def_ref_point.txt new file mode 100644 index 0000000000..3594245b45 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/tx_def_ref_point.txt @@ -0,0 +1,104 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_0.txt b/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_0.txt new file mode 100644 index 0000000000..40781351d7 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_0.txt @@ -0,0 +1,64 @@ +-0.0058211999999999995 +-0.0056364 +-0.0054516 +-0.005266799999999999 +-0.005082 +-0.0048972 +-0.004712399999999999 +-0.0045276 +-0.0043428 +-0.004158 +-0.0039732 +-0.0037884 +-0.0036035999999999998 +-0.0034188 +-0.003234 +-0.0030491999999999997 +-0.0028644 +-0.0026796 +-0.0024947999999999997 +-0.00231 +-0.0021252 +-0.0019404 +-0.0017556 +-0.0015708 +-0.0013859999999999999 +-0.0012012 +-0.0010164 +-0.0008315999999999999 +-0.0006468 +-0.00046199999999999995 +-0.0002772 +-9.24e-05 +9.24e-05 +0.0002772 +0.00046199999999999995 +0.0006468 +0.0008315999999999999 +0.0010164 +0.0012012 +0.0013859999999999999 +0.0015708 +0.0017556 +0.0019404 +0.0021252 +0.00231 +0.0024947999999999997 +0.0026796 +0.0028644 +0.0030491999999999997 +0.003234 +0.0034188 +0.0036035999999999998 +0.0037884 +0.0039732 +0.004158 +0.0043428 +0.0045276 +0.004712399999999999 +0.0048972 +0.005082 +0.005266799999999999 +0.0054516 +0.0056364 +0.0058211999999999995 \ No newline at end of file diff --git a/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_1.txt b/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_1.txt new file mode 100644 index 0000000000..d918d211c4 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_1.txt @@ -0,0 +1,192 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_positions.txt b/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_positions.txt new file mode 100644 index 0000000000..51e06b22d0 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/data/xdc_def_positions.txt @@ -0,0 +1,130 @@ +-0.0058211999999999995 +0 +0 +0 +-0.0056364 +0 +0 +0 +-0.0054516 +0 +0 +0 +-0.005266799999999999 +0 +0 +0 +-0.005082 +0 +0 +0 +-0.0048972 +0 +0 +0 +-0.004712399999999999 +0 +0 +0 +-0.0045276 +0 +0 +0 +-0.0043428 +0 +0 +0 +-0.004158 +0 +0 +0 +-0.0039732 +0 +0 +0 +-0.0037884 +0 +0 +0 +-0.0036035999999999998 +0 +0 +0 +-0.0034188 +0 +0 +0 +-0.003234 +0 +0 +0 +-0.0030491999999999997 +0 +0 +0 +-0.0028644 +0 +0 +0 +-0.0026796 +0 +0 +0 +-0.0024947999999999997 +0 +0 +0 +-0.00231 +0 +0 +0 +-0.0021252 +0 +0 +0 +-0.0019404 +0 +0 +0 +-0.0017556 +-0.0015708 +-0.0013859999999999999 +-0.0012012 +-0.0010164 +-0.0008315999999999999 +-0.0006468 +-0.00046199999999999995 +-0.0002772 +-9.24e-05 +9.24e-05 +0.0002772 +0.00046199999999999995 +0.0006468 +0.0008315999999999999 +0.0010164 +0.0012012 +0.0013859999999999999 +0.0015708 +0.0017556 +0.0019404 +0.0021252 +0.00231 +0.0024947999999999997 +0.0026796 +0.0028644 +0.0030491999999999997 +0.003234 +0.0034188 +0.0036035999999999998 +0.0037884 +0.0039732 +0.004158 +0.0043428 +0.0045276 +0.004712399999999999 +0.0048972 +0.005082 +0.005266799999999999 +0.0054516 +0.0056364 +0.0058211999999999995 \ No newline at end of file diff --git a/ultrasound/L3/tests/synthetic_aperture/description.json b/ultrasound/L3/tests/synthetic_aperture/description.json new file mode 100644 index 0000000000..95a9afce14 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/description.json @@ -0,0 +1,318 @@ +{ + "name": "Synthetic Aperture Test", + "description": "synthetic aperture example", + "flow": "versal", + "platform_allowlist": [ + "vck190" + ], + "platform_blocklist": [], + "platform_properties": { + "vck190": { + "v++": { + "compiler": { + "clflags": [ + "" + ] + }, + "linker": { + "ldclflags": [ + "--config PROJECT/system.cfg" + ] + }, + "package": { + "clflags": [ + "--package.defer_aie_run" + ] + } + } + } + }, + "gui": false, + "data": [ + "PROJECT/data" + ], + "launch": [ + { + "cmd_args": "-xclbin synthetic_aperture.xclbin -data data/", + "name": "generic launch for all flows" + }, + { + "cmd_args": "-xclbin BUILD/synthetic_aperture.xclbin -data data/", + "target": "sw_emu", + "name": "sw_emu launch" + } + ], + "host": { + "host_exe": "host.exe", + "compiler": { + "sources": [ + "LIB_DIR/L3/tests/synthetic_aperture/PS_host/host.cpp", + "./Work/ps/c_rts/aie_control_xrt.cpp" + ], + "includepaths": [ + "LIB_DIR/L1/include", + "LIB_DIR/L2/include", + "LIB_DIR/L3/include", + "LIB_DIR/L3/tests/synthetic_aperture/aie_graph" + ], + "options": [ + "-include LIB_DIR/L1/include/kernels.hpp" + ], + "symbols": [ + "__PS_ENABLE_AIE__" + ] + } + }, + "aiecompiler": { + "compiler": { + "includepaths": [ + "LIB_DIR/L1/include/", + "LIB_DIR/L2/include/" + ] + } + }, + "aiecontainers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/aie_graph/graph.cpp", + "pl-freq": 100, + "workdir": "./Work", + "name": "libadf.a" + } + ] + } + ], + "containers": [ + { + "accelerators": [ + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s1" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s2" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s3" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s4" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s5" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s6" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s7.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s7" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s8.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s8" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s9.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s9" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s10.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s10" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s11.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s11" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s12.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s12" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s13.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s13" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s14.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s14" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s15.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s15" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s16.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s16" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s17.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s17" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s18.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s18" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s19.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s19" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s20.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s20" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s21.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s21" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s22.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s22" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s23.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s23" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s24.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s24" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s25.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s25" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s26.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s26" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s27.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s27" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/mm2s28.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "mm2s28" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/s2mm1.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm1" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/s2mm2.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm2" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/s2mm3.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm3" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/s2mm4.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm4" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/s2mm5.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm5" + }, + { + "location": "LIB_DIR/L3/tests/synthetic_aperture/PL_kernels/s2mm6.cpp", + "frequency": 100.0, + "clflags": " ", + "name": "s2mm6" + } + ], + "name": "synthetic_aperture" + } + ], + "testinfo": { + "disable": false, + "jobs": [ + { + "index": 0, + "dependency": [], + "env": "", + "cmd": "", + "max_memory_MB": 65536, + "max_time_min": 600 + } + ], + "targets": [ + "vitis_aie_sim", + "vitis_aie_x86sim", + "vitis_sw_emu", + "vitis_hw_emu", + "vitis_hw_build" + ], + "category": "canary" + } +} diff --git a/ultrasound/L3/tests/synthetic_aperture/system.cfg b/ultrasound/L3/tests/synthetic_aperture/system.cfg new file mode 100644 index 0000000000..e205d6e5b4 --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/system.cfg @@ -0,0 +1,53 @@ +[connectivity] + +#### input #### +# image points +stream_connect=mm2s1_1.s:ai_engine_0.start_positions +stream_connect=mm2s2_1.s:ai_engine_0.directions +stream_connect=mm2s3_1.s:ai_engine_0.samples_arange +# delay +stream_connect=mm2s4_1.s:ai_engine_0.image_points_from_PL +stream_connect=mm2s5_1.s:ai_engine_0.image_points_from_PL_2 +stream_connect=mm2s6_1.s:ai_engine_0.tx_def_delay_distance +stream_connect=mm2s7_1.s:ai_engine_0.tx_def_delay_distance_2 +stream_connect=mm2s8_1.s:ai_engine_0.tx_def_ref_point +stream_connect=mm2s9_1.s:ai_engine_0.tx_def_focal_point +stream_connect=mm2s10_1.s:ai_engine_0.t_start +# FOCUSING SA +stream_connect=mm2s11_1.s:ai_engine_0.apo_ref_0_tx +stream_connect=mm2s12_1.s:ai_engine_0.img_points_0 +stream_connect=mm2s13_1.s:ai_engine_0.apo_ref_1_tx +stream_connect=mm2s14_1.s:ai_engine_0.img_points_1_tx +# APODIZATION SA +stream_connect=mm2s15_1.s:ai_engine_0.image_points_tx +stream_connect=mm2s16_1.s:ai_engine_0.apodization_reference_tx +stream_connect=mm2s17_1.s:ai_engine_0.apo_distance_k_tx +stream_connect=mm2s18_1.s:ai_engine_0.F_number_tx +# samples +stream_connect=mm2s19_1.s:ai_engine_0.image_points_from_PL_3 +stream_connect=mm2s20_1.s:ai_engine_0.delay_from_PL +stream_connect=mm2s21_1.s:ai_engine_0.xdc_def_positions +stream_connect=mm2s22_1.s:ai_engine_0.sampling_frequency +# interpolator +stream_connect=mm2s23_1.s:ai_engine_0.P1 +stream_connect=mm2s24_1.s:ai_engine_0.P2 +stream_connect=mm2s25_1.s:ai_engine_0.P3 +stream_connect=mm2s26_1.s:ai_engine_0.P4 +stream_connect=mm2s27_1.s:ai_engine_0.P5 +stream_connect=mm2s28_1.s:ai_engine_0.P6 + + +#### output ##### +# image points +stream_connect=ai_engine_0.image_points:s2mm1_1.s +# delay +stream_connect=ai_engine_0.delay_to_PL:s2mm2_1.s +# focusing SA +stream_connect=ai_engine_0.focusing_output_tx:s2mm3_1.s +# apodization SA +stream_connect=ai_engine_0.apodization_tx:s2mm4_1.s +# samples +stream_connect=ai_engine_0.samples_to_PL:s2mm5_1.s +# interpolator +stream_connect=ai_engine_0.C:s2mm6_1.s + diff --git a/ultrasound/L3/tests/synthetic_aperture/utils.mk b/ultrasound/L3/tests/synthetic_aperture/utils.mk new file mode 100644 index 0000000000..5a380574fa --- /dev/null +++ b/ultrasound/L3/tests/synthetic_aperture/utils.mk @@ -0,0 +1,341 @@ +# +# Copyright 2019-2022 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vitis makefile-generator v2.0.8 +# +#+------------------------------------------------------------------------------- +# The following parameters are assigned with default values. These parameters can +# be overridden through the make command line +#+------------------------------------------------------------------------------- + +REPORT := no +PROFILE := no +DEBUG := no + +#Get PLATFORM_NAME by PLATFORM +PLATFORM_NAME = $(strip $(patsubst %.xpfm, % , $(shell basename $(PLATFORM)))) + +#'estimate' for estimate report generation +#'system' for system report generation +ifneq ($(REPORT), no) +VPP_LDFLAGS += --report estimate +VPP_LDFLAGS += --report system +endif + +#Generates profile summary report +ifeq ($(PROFILE), yes) +VPP_LDFLAGS += --profile_kernel data:all:all:all +endif + +#Generates debug summary report +ifeq ($(DEBUG), yes) +VPP_LDFLAGS += --dk protocol:all:all:all +endif + +#Check vitis setup +ifndef XILINX_VITIS + XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION) + export XILINX_VITIS +endif + +.PHONY: check_device +check_device: + @set -eu; \ + inallowlist=False; \ + inblocklist=False; \ + for dev in $(PLATFORM_ALLOWLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inallowlist=True; fi; \ + done ;\ + for dev in $(PLATFORM_BLOCKLIST); \ + do if [[ $$(echo $(PLATFORM_NAME) | grep $$dev) != "" ]]; \ + then inblocklist=True; fi; \ + done ;\ + if [[ $$inallowlist == False ]]; \ + then echo "[Warning]: The device $(PLATFORM_NAME) not in allowlist."; \ + fi; \ + if [[ $$inblocklist == True ]]; \ + then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\ + fi; + +#get HOST_ARCH by PLATFORM +ifneq (,$(PLATFORM)) +HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') +ifeq ($(HOST_ARCH_temp), x86) +HOST_ARCH := x86 +else ifeq ($(HOST_ARCH_temp), cortex-a9) +HOST_ARCH := aarch32 +else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp))) +HOST_ARCH := aarch64 +endif +endif + + + +# Special processing for tool version/platform type +VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1) +AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') +ifeq (AIE ,$(findstring AIE, $(AIE_TYPE))) +HAS_AIE := on +else +HAS_AIE := off +endif +# 1) for aie flow from 2022.1 +ifeq (on, $(HAS_AIE)) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +LINK_TARGET_FMT := xsa +else +LINK_TARGET_FMT := xclbin +endif +else +LINK_TARGET_FMT := xclbin +endif +# 2) dfx flow +dfx_hw := off +ifeq ($(findstring _dfx_, $(PLATFORM_NAME)),_dfx_) +ifeq ($(TARGET),hw) +dfx_hw := on +endif +endif +# 3) for embeded sw_emu flow from 2022.2 +ps_on_x86 := off +ifneq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.2), 1) +ifeq ($(TARGET), sw_emu) +ps_on_x86 := on +HOST_ARCH := x86 +endif +endif +endif +# 4) for aie on x86 flow +pcie_aie := off +ifeq ($(HOST_ARCH), x86) +ifeq ($(HAS_AIE), on) +pcie_aie := on +endif +endif + +#when x86 arch, check XRT setup +ifeq ($(HOST_ARCH), x86) +ifndef XILINX_XRT + XILINX_XRT = /opt/xilinx/xrt + export XILINX_XRT +endif +endif + +#check if need sd_card +ifeq ($(HOST_ARCH), aarch32) +SD_CARD_NEEDED := on +endif +ifeq ($(HOST_ARCH), aarch64) +SD_CARD_NEEDED := on +endif +ifeq ($(ps_on_x86), on) +SD_CARD_NEEDED := on +endif +ifeq ($(pcie_aie), on) +SD_CARD_NEEDED := on +endif + +#Checks for Device Family +ifeq ($(HOST_ARCH), aarch32) + DEV_FAM = 7Series +else ifeq ($(HOST_ARCH), aarch64) + DEV_FAM = Ultrascale +endif + +#Checks for Correct architecture +ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86)) +$(error HOST_ARCH variable not set, please set correctly and rerun) +endif + +.PHONY: check_version check_sysroot check_kimage check_rootfs +check_version: +ifneq (, $(shell which git)) +ifneq (,$(wildcard $(XFLIB_DIR)/.git)) + @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd - +endif +endif + +#Set/Check SYSROOT/K_IMAGE/ROOTFS +ifneq ($(HOST_ARCH), x86) +ifneq (,$(findstring zc706, $(PLATFORM_NAME))) +K_IMAGE ?= $(SYSROOT)/../../uImage +else +K_IMAGE ?= $(SYSROOT)/../../Image +endif +ROOTFS ?= $(SYSROOT)/../../rootfs.ext4 +endif + +check_sysroot: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(SYSROOT))) + $(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_kimage: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(K_IMAGE))) + $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif +check_rootfs: +ifneq ($(HOST_ARCH), x86) +ifeq (,$(wildcard $(ROOTFS))) + $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun) +endif +endif + +CXX := g++ +ifeq ($(HOST_ARCH), x86) +ifeq ($(shell expr $(VITIS_VER) \>= 2022.1), 1) +CXX_VER := 8.3.0 +else +CXX_VER := 6.2.0 +endif +CXX_V := $(shell echo $(CXX_VER) | awk -F. '{print tolower($$1)}') +ifneq ($(shell expr $(shell echo "__GNUG__" | g++ -E -x c++ - | tail -1) \>= $(CXX_V)), 1) +ifndef XILINX_VIVADO +$(error [ERROR]: g++ version too old. Please use $(CXX_VER) or above) +else +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/bin/g++ +ifeq ($(LD_LIBRARY_PATH),) +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64 +else +export LD_LIBRARY_PATH := $(XILINX_VIVADO)/tps/lnx64/gcc-$(CXX_VER)/lib64:$(LD_LIBRARY_PATH) +endif +$(warning [WARNING]: g++ version too old. Using g++ provided by the tool: $(CXX)) +endif +endif +else +ifeq ($(HOST_ARCH), aarch64) +CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ +else ifeq ($(HOST_ARCH), aarch32) +CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ +endif +endif + +#Check OS and setting env for xrt c++ api +OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2)}' | tr -d ' \t' ) +OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2)}' |tr -d ' \t') + +# for centos and redhat +ifneq ($(findstring centos,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +else ifneq ($(findstring redhat,$(OSDIST)),) +ifeq (7,$(shell echo $(OSREL) | awk -F. '{print tolower($$1)}' )) +ifeq ($(HOST_ARCH), x86) +XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 +endif +endif +endif + +#Setting VPP +VPP := v++ + +#Cheks for aiecompiler +AIECXX := aiecompiler +AIESIMULATOR := aiesimulator +X86SIMULATOR := x86simulator + +.PHONY: check_vivado +check_vivado: +ifeq (,$(wildcard $(XILINX_VIVADO)/bin/vivado)) + @echo "Cannot locate Vivado installation. Please set XILINX_VIVADO variable." && false +endif + +.PHONY: check_vpp +check_vpp: +ifeq (,$(wildcard $(XILINX_VITIS)/bin/v++)) + @echo "Cannot locate Vitis installation. Please set XILINX_VITIS variable." && false +endif + +.PHONY: check_xrt +check_xrt: +ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so)) + @echo "Cannot locate XRT installation. Please set XILINX_XRT variable." && false +endif + +export PATH := $(XILINX_VITIS)/bin:$(XILINX_XRT)/bin:$(PATH) +ifeq ($(HOST_ARCH), x86) +ifeq (,$(LD_LIBRARY_PATH)) +LD_LIBRARY_PATH := $(XILINX_XRT)/lib +else +LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH) +endif +endif + +ifneq (,$(wildcard $(PLATFORM))) +# Use PLATFORM as a file path +XPLATFORM := $(PLATFORM) +else +# Use PLATFORM as a file name pattern +# 1. search paths specified by variable +ifneq (,$(PLATFORM_REPO_PATHS)) +# 1.1 as exact name +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) +# 1.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 1.2 +endif # 1 +# 2. search Vitis installation +ifeq (,$(XPLATFORM)) +# 2.1 as exact name +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 2.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 2.2 +endif # 2 +# 3. search default locations +ifeq (,$(XPLATFORM)) +# 3.1 as exact name +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) +# 3.2 as a pattern +ifeq (,$(XPLATFORM)) +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) +endif # 3.2 +endif # 3 +endif + +define MSG_PLATFORM +No platform matched pattern '$(PLATFORM)'. +Available platforms are: $(XPLATFORMS) +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. +endef +export MSG_PLATFORM + + +.PHONY: check_platform +check_platform: +ifeq (,$(XPLATFORM)) + @echo "$${MSG_PLATFORM}" && false +endif +#Check ends + +# Cleaning stuff +RM = rm -f +RMDIR = rm -rf + +MV = mv -f +CP = cp -rf +ECHO:= @echo diff --git a/ultrasound/LICENSE.txt b/ultrasound/LICENSE.txt new file mode 100644 index 0000000000..f82a8ae14f --- /dev/null +++ b/ultrasound/LICENSE.txt @@ -0,0 +1,55 @@ +# License +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and + 2. You must cause any modified files to carry prominent notices stating that You changed the files; and + 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/ultrasound/README.md b/ultrasound/README.md new file mode 100644 index 0000000000..f83c485f7b --- /dev/null +++ b/ultrasound/README.md @@ -0,0 +1,39 @@ +# Vitis Ultrasound Library + +## Overview +Vitis Ultrasound library provides implementation of different L1/L2/L3 APIs as a toolbox for ultrasound image processing. Current version provides: +- L1, the lowest level of abstraction and is composed of simple BLAS operation +- L2, the functional units of the Beamformer, which can be obtained by composing L1 libraries +- L3, complete Beamformer which uses all of the three points above and contain run tests for beamforming design of PW/SA/Scanline + +## Libraries contents +- [Overview of L1 apis](L1) +- [Overview of L2 apis](L2) +- [Overview of L3 apis](L3) + +## Getting Start + +### Download the Vitis Ultrasound Library +```bash +git clone https://github.com/Xilinx/Vitis_Libraries.git +cd Vitis_Libraries/ultrasound +``` + +### Run examples +- [Run L2 testcase](L2/tests) +- [Run L3 testcase](L3/tests) + +## License +Copyright 2022 AMD, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/ultrasound/docs/.gitignore b/ultrasound/docs/.gitignore new file mode 100644 index 0000000000..50663f0f4b --- /dev/null +++ b/ultrasound/docs/.gitignore @@ -0,0 +1,6 @@ +xml +rst +build +.stamp +*.sh +*.swp diff --git a/ultrasound/docs/Doxyfile_L1 b/ultrasound/docs/Doxyfile_L1 new file mode 100644 index 0000000000..f5d2b48590 --- /dev/null +++ b/ultrasound/docs/Doxyfile_L1 @@ -0,0 +1,2446 @@ +# +# Copyright 2019 Xilinx, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Doxyfile 1.8.14 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Vitis Ultrasound Library" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = . + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. + +ALIASES = "rst=\verbatim embed:rst:leading-asterisk" \ + "endrst=\endverbatim" + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = NO + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = ../L1/include + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = NO + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /