--- /dev/null
+---
+title: Testing Guide
+short-description: Testing Guide for FPGA env.
+...
+
+# Testing Guide for FPGA env.
+
+This page describes how to install and test NPU-DDK packages on FPGA (ZCU102-ZYNQMP) envionment.
+
+## Prerequisites
+
+First of all, you have to install the petalinux SDK in your host PC (Ubuntu 18.04 recommended).
+Please refer to [here](PetaLinux.md) for detail instructions.
+
+However, please note that if you are NOT supposed to update any source codes, skip the below FPGA-related descriptions.
+For testing purpose, any host envionment (including Windows) with ssh client program will be fine.
+
+## How to change source repository
+
+Here, we assume that you have already cloned [AIP/meta-trinity](https://github.sec.samsung.net/AIP/meta-trinity) which should be set as your user-layer.
+- In `petalinux-config`, Change *Yocto Settings -> User Layers*.
+
+Then, you can change the source repository of `NPU_SystemService` to yours if there's some updates.
+
+```
+$ cd meta-trinity
+$ ls
+build conf COPYING.MIT hw README.md recipes-app recipes-bsp recipes-ddk recipes-devtools recipes-kernel
+$ vim recipes-ddk/npu-engine/npu-engine_2.3.8.bb
+[ ... ]
+SRC_URI = "git://git@github.sec.samsung.net/AIP/NPU_SystemService.git;protocol=ssh;branch=tizen"
+[ ... ]
+```
+
+## How to install packages
+
+Once you build the patelinux project, packages are created on your local build directory.
+
+```
+[ ... ]
+$ petalinux-build
+$ ls build/tmp/deploy/rpm/aarch64 | grep npu-engine
+npu-engine-2.3.8-r0.aarch64.rpm
+npu-engine-testcases-2.3.8-r0.aarch64.rpm
+```
+
+As our FPGA board supports `ssh` connection, the created packages can be simply copied.
+
+```
+$ cd build/tmp/deploy/rpm/aarch64/
+$ scp npu-engine-2.3.8-r0.aarch64.rpm root@[FPGA IP Address]:.
+$ scp npu-engine-2.3.8-testcases-r0.aarch64.rpm root@[FPGA IP Address]:.
+```
+
+Then, you can install them using `rpm` command in the FPGA board.
+```
+$ ssh root@[FPGA IP Address]
+[ ... ]
+# rpm -ivh npu-engine-2.3.8-r0.aarch64.rpm --force
+# ls -al /usr/lib/libnpu-engine.so
+rwxr-xr-x 1 root root 210872 May 28 05:27 /usr/lib/libnpu-engine.so
+
+# rpm -ivh npu-engine-testcases-2.3.8-r0.aarch64.rpm --force
+# ls -al /usr/lib/npu-engine/bin/
+drwxr-xr-x 2 root root 4096 May 28 05:24 apptests
+drwxr-xr-x 2 root root 4096 May 28 05:24 unittests
+```
+
+Also, please make sure that `source.sh` is executed after booting.
+```
+# pwd
+/home/root
+# source setting.sh
+# dmesg | tail
+[ 715.657379] triv2 402010000.triv2: [0] /home/root/idu/cp/zero.bin -> 0x402000000
+[ 715.667153] triv2 402010000.triv2: [1] /home/root/idu/cp/data.bin -> 0x402000010
+[ 715.679137] triv2 402010000.triv2: [2] /home/root/idu/cp/code.bin -> 0x480020000
+[ 715.696517] triv2 402010000.triv2: [3] /home/root/idu/dsp/zero.bin -> 0x402100000
+[ 715.706382] triv2 402010000.triv2: [4] /home/root/idu/dsp/data.bin -> 0x402100010
+[ 715.718872] triv2 402010000.triv2: [5] /home/root/idu/dsp/code.bin -> 0x480040000
+[ 715.726675] triv2 402210000.triv2: [0] /home/root/idu/cp/zero.bin -> 0x402200000
+[ 715.734339] triv2 402210000.triv2: [1] /home/root/idu/cp/data.bin -> 0x402200010
+[ 715.743088] triv2 402210000.triv2: [2] /home/root/idu/cp/code.bin -> 0x490020000
+[ 715.755241] triv2 402210000.triv2: [3] /home/root/idu/dsp/zero.bin -> 0x402300000
+[ 715.763016] triv2 402210000.triv2: [4] /home/root/idu/dsp/data.bin -> 0x402300010
+[ 715.771947] triv2 402210000.triv2: [5] /home/root/idu/dsp/code.bin -> 0x490040000
+```
+
+## How to test features
+
+NPU-DDK supports two types of test programs: `unittest` and `apptests`.
+- `unittest`: Programs testing basic features
+- `apptest`: Programs testing advanced features, linked to npu-engine library
+
+Any program in `unittests` can be runnable without arguments.
+
+```
+# pwd
+/home/root
+# source setting.sh
+# unittest_ne_libnpuhost
+[ ... ]
+[ OK ] ne_libnpuhost_test.get_npu_device_by_type_n (0 ms)
+[ RUN ] ne_libnpuhost_test.get_npu_device_status_n
+[ OK ] ne_libnpuhost_test.get_npu_device_status_n (0 ms)
+[ RUN ] ne_libnpuhost_test.driver_level_and_tops
+[ OK ] ne_libnpuhost_test.driver_level_and_tops (1 ms)
+[ RUN ] ne_libnpuhost_test.statistics_apis
+[ OK ] ne_libnpuhost_test.statistics_apis (0 ms)
+[ RUN ] ne_libnpuhost_test.statistics_apis_n
+[ OK ] ne_libnpuhost_test.statistics_apis_n (0 ms)
+[----------] 23 tests from ne_libnpuhost_test (8 ms total)
+
+[----------] Global test environment tear-down
+[==========] 23 tests from 1 test case ran. (8 ms total)
+[ PASSED ] 23 tests.
+# unittest_ne_core_buffer
+[ ... ]
+[ OK ] ne_core_buffer_test.buffer_create_tensors_n (0 ms)
+[ RUN ] ne_core_buffer_test.buffer_get_tensor_n
+[ OK ] ne_core_buffer_test.buffer_get_tensor_n (1 ms)
+[----------] 4 tests from ne_core_buffer_test (2 ms total)
+
+[----------] Global test environment tear-down
+[==========] 4 tests from 1 test case ran. (2 ms total)
+[ PASSED ] 4 tests.
+```
+
+Programs in `apptests` are linked to `libnpu-engine.so` and may require extra arguments.
+They may use test models stored in `/home/root/TRIV235_2TOPS` if necessary.
+- `TRIV235_2TOPS/NHWC`: test models with NHWC format
+- `TRIV235_2TOPS/TRIV2`: test models with TRIV2 format
+
+The below shows example command lines for each apptest.
+```
+# pwd
+/home/root
+# source setting.sh
+# apptest_tvn_triv2
+[APPTEST] apptest_tvn_triv2: SKIPPED
+
+# apptest_tvn_triv2 TRIV235_2TOPS/NHWC/MOBILENET_V1
+[APPTEST] apptest_tvn_triv2: PASSED
+
+# apptest_tvn_triv2_bulk TRIV235_2TOPS/NHWC
+[APPTEST] apptest_tvn_triv2_bulk: PASSED (98), FAILED (0)
+
+# apptest_tvn_triv2_bulk TRIV235_2TOPS/TRIV2 -t
+[APPTEST] apptest_tvn_triv2_bulk: PASSED (98), FAILED (0)
+
+# apptest_tvn_triv2_dmabuf TRIV235_2TOPS/NHWC/MOBILENET_V1
+[APPTEST] apptest_tvn_triv2_dmabuf: PASSED
+
+# apptest_tvn_triv2_preempt TRIV235_2TOPS/NHWC
+[APPTEST] apptest_tvn_triv2_preempt: PASSED
+
+# apptest_tvn_triv2_profile TRIV235_2TOPS/NHWC/MOBILENET_V1 -p visa
+[ ... ]
+[622] ADMA_IN
+ Running Cycles : 477
+ Start Cycles : 424930
+ End Cycles : 425407
+ vISA Exec Seq : 23535
+[623] CONV_I8
+ Running Cycles : 560
+ Start Cycles : 425407
+ End Cycles : 425967
+ vISA Exec Seq : 23536
+[624] ADMA_OUT
+ Running Cycles : 1161
+ Start Cycles : 425967
+ End Cycles : 427128
+ vISA Exec Seq : 23537
+[APPTEST] apptest_tvn_triv2_profile: PASSED
+
+# apptest_tvn_triv2_profile TRIV235_2TOPS/NHWC/MOBILENET_V1 -p layer
+[ ... ]
+[30] conv_dw_13_relu/Relu6
+ Running Cycles : 3005
+ Start Cycles : 374458
+ End Cycles : 377463
+[31] conv_pw_13_relu/Relu6
+ Running Cycles : 25575
+ Start Cycles : 377463
+ End Cycles : 403038
+[32] Mean
+ Running Cycles : 2493
+ Start Cycles : 403038
+ End Cycles : 405531
+[33] conv_preds/BiasAdd
+ Running Cycles : 21879
+ Start Cycles : 405531
+ End Cycles : 427410
+[34] Unclassified
+[APPTEST] apptest_tvn_triv2_profile: PASSED
+
+# cat model.xml
+<testcases>
+ <model name="mobilenet_v1" timeout="3000" priority="1">
+ <dirpath>TRIV235_2TOPS/MOBILENET_V1</dirpath>
+ </model>
+ <model name="mobilenet_v2" timeout="1000" priority="2">
+ <dirpath>TRIV235_2TOPS/MOBILENET_V2</dirpath>
+ </model>
+</testcases>
+# apptest_tvn_triv2_xml model.xml
+[APPTEST] apptest_tvn_triv2_xml: PASSED
+```