From c32a7ac5989b70b2daa682159417c8f1fe59fd12 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Sun, 22 Aug 2021 00:26:44 +0900 Subject: [PATCH] tests: lib: cmsis_dsp: support: Add F16 tests for 1.9.0 This commit adds the support F16 test patterns and implementations for the CMSIS-DSP 1.9.0. Signed-off-by: Stephanos Ioannidis --- tests/lib/cmsis_dsp/support/CMakeLists.txt | 14 +- tests/lib/cmsis_dsp/support/src/f16.c | 241 +++++++++++++++++++++ tests/lib/cmsis_dsp/support/src/f16.pat | 161 ++++++++++++++ tests/lib/cmsis_dsp/support/src/main.c | 6 +- 4 files changed, 419 insertions(+), 3 deletions(-) create mode 100644 tests/lib/cmsis_dsp/support/src/f16.c create mode 100644 tests/lib/cmsis_dsp/support/src/f16.pat diff --git a/tests/lib/cmsis_dsp/support/CMakeLists.txt b/tests/lib/cmsis_dsp/support/CMakeLists.txt index 6cabfc25ade..6dcbae49583 100644 --- a/tests/lib/cmsis_dsp/support/CMakeLists.txt +++ b/tests/lib/cmsis_dsp/support/CMakeLists.txt @@ -4,5 +4,15 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(cmsis_dsp_support) -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) +target_sources(app PRIVATE + src/q7.c + src/q15.c + src/q31.c + src/f32.c + src/barycenter_f32.c + src/main.c + ) + +target_sources_ifdef(CONFIG_CMSIS_DSP_FLOAT16 app PRIVATE + src/f16.c + ) diff --git a/tests/lib/cmsis_dsp/support/src/f16.c b/tests/lib/cmsis_dsp/support/src/f16.c new file mode 100644 index 00000000000..04b6081a3c5 --- /dev/null +++ b/tests/lib/cmsis_dsp/support/src/f16.c @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2021 Stephanos Ioannidis + * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include "../../common/test_common.h" + +#include "f16.pat" + +#define SNR_ERROR_THRESH (120) + +#define ABS_ERROR_THRESH_F16 (1.0e-5) +#define REL_ERROR_THRESH_F16 (1.0e-5) + +#define ABS_ERROR_THRESH_F32 (1.0e-3) +#define REL_ERROR_THRESH_F32 (1.0e-3) + +#define ABS_ERROR_THRESH_Q7 ((q15_t)10) +#define ABS_ERROR_THRESH_Q15 ((q15_t)10) +#define ABS_ERROR_THRESH_Q31 ((q31_t)80) + +#define ABS_ERROR_THRESH_WS (1.0e-1) +#define REL_ERROR_THRESH_WS (5.0e-3) + +static void test_arm_copy_f16(const uint16_t *input1, size_t length) +{ + float16_t *output; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float16_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + arm_copy_f16((float16_t *)input1, output, length); + + /* Validate output */ + zassert_true( + test_equal_f16(length, (float16_t *)input1, output), + ASSERT_MSG_INCORRECT_COMP_RESULT); + + /* Free output buffer */ + free(output); +} + +DEFINE_TEST_VARIANT2(arm_copy_f16, 7, ref_f16, 7); +DEFINE_TEST_VARIANT2(arm_copy_f16, 16, ref_f16, 16); +DEFINE_TEST_VARIANT2(arm_copy_f16, 23, ref_f16, 23); + +static void test_arm_fill_f16(size_t length) +{ + size_t index; + float16_t *output; + float16_t val = 1.1; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float16_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + arm_fill_f16(val, output, length); + + /* Validate output */ + for (index = 0; index < length; index++) { + zassert_equal( + output[index], val, ASSERT_MSG_INCORRECT_COMP_RESULT); + } + + /* Free output buffer */ + free(output); +} + +DEFINE_TEST_VARIANT1(arm_fill_f16, 7, 7); +DEFINE_TEST_VARIANT1(arm_fill_f16, 16, 16); +DEFINE_TEST_VARIANT1(arm_fill_f16, 23, 23); + +static void test_arm_f16_to_q15( + const uint16_t *input1, const q15_t *ref, size_t length) +{ + q15_t *output; + + /* Allocate output buffer */ + output = malloc(length * sizeof(q15_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + arm_f16_to_q15((float16_t *)input1, output, length); + + /* Validate output */ + zassert_true( + test_near_equal_q15(length, ref, output, ABS_ERROR_THRESH_Q15), + ASSERT_MSG_ABS_ERROR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); +} + +DEFINE_TEST_VARIANT3(arm_f16_to_q15, 7, ref_f16, ref_q15, 7); +DEFINE_TEST_VARIANT3(arm_f16_to_q15, 16, ref_f16, ref_q15, 16); +DEFINE_TEST_VARIANT3(arm_f16_to_q15, 23, ref_f16, ref_q15, 23); + +static void test_arm_f16_to_float( + const uint16_t *input1, const uint32_t *ref, size_t length) +{ + float32_t *output; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float32_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + arm_f16_to_float((float16_t *)input1, output, length); + + /* Validate output */ + zassert_true( + test_rel_error_f32(length, (float32_t *)ref, output, + REL_ERROR_THRESH_F32), + ASSERT_MSG_REL_ERROR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); +} + +DEFINE_TEST_VARIANT3(arm_f16_to_float, 7, ref_f16, ref_f32, 7); +DEFINE_TEST_VARIANT3(arm_f16_to_float, 16, ref_f16, ref_f32, 16); +DEFINE_TEST_VARIANT3(arm_f16_to_float, 23, ref_f16, ref_f32, 23); + +static void test_arm_q15_to_f16( + const q15_t *input1, const uint16_t *ref, size_t length) +{ + float16_t *output; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float16_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + arm_q15_to_f16(input1, output, length); + + /* Validate output */ + zassert_true( + test_rel_error_f16(length, (float16_t *)ref, output, + REL_ERROR_THRESH_F16), + ASSERT_MSG_REL_ERROR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); +} + +DEFINE_TEST_VARIANT3(arm_q15_to_f16, 7, ref_q15, ref_f16, 7); +DEFINE_TEST_VARIANT3(arm_q15_to_f16, 16, ref_q15, ref_f16, 16); +DEFINE_TEST_VARIANT3(arm_q15_to_f16, 23, ref_q15, ref_f16, 23); + +static void test_arm_float_to_f16( + const uint32_t *input1, const uint16_t *ref, size_t length) +{ + float16_t *output; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float16_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + arm_float_to_f16((float32_t *)input1, output, length); + + /* Validate output */ + zassert_true( + test_rel_error_f16(length, (float16_t *)ref, output, + REL_ERROR_THRESH_F16), + ASSERT_MSG_REL_ERROR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); +} + +DEFINE_TEST_VARIANT3(arm_float_to_f16, 7, ref_f32, ref_f16, 7); +DEFINE_TEST_VARIANT3(arm_float_to_f16, 16, ref_f32, ref_f16, 16); +DEFINE_TEST_VARIANT3(arm_float_to_f16, 23, ref_f32, ref_f16, 23); + +static void test_arm_weighted_sum_f16( + int ref_offset, size_t length) +{ + const float16_t *val = (const float16_t *)in_weighted_sum_val; + const float16_t *coeff = (const float16_t *)in_weighted_sum_coeff; + const float16_t *ref = (const float16_t *)ref_weighted_sum; + float16_t *output; + + /* Allocate output buffer */ + output = malloc(1 * sizeof(float16_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + output[0] = arm_weighted_sum_f16(val, coeff, length); + + /* Validate output */ + zassert_true( + test_close_error_f16(1, output, &ref[ref_offset], + ABS_ERROR_THRESH_WS, REL_ERROR_THRESH_WS), + ASSERT_MSG_ERROR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); +} + +DEFINE_TEST_VARIANT2(arm_weighted_sum_f16, 7, 0, 7); +DEFINE_TEST_VARIANT2(arm_weighted_sum_f16, 16, 1, 16); +DEFINE_TEST_VARIANT2(arm_weighted_sum_f16, 23, 2, 23); + +void test_support_f16(void) +{ + ztest_test_suite(support_f16, + ztest_unit_test(test_arm_copy_f16_7), + ztest_unit_test(test_arm_copy_f16_16), + ztest_unit_test(test_arm_copy_f16_23), + ztest_unit_test(test_arm_fill_f16_7), + ztest_unit_test(test_arm_fill_f16_16), + ztest_unit_test(test_arm_fill_f16_23), + ztest_unit_test(test_arm_f16_to_q15_7), + ztest_unit_test(test_arm_f16_to_q15_16), + ztest_unit_test(test_arm_f16_to_q15_23), + ztest_unit_test(test_arm_f16_to_float_7), + ztest_unit_test(test_arm_f16_to_float_16), + ztest_unit_test(test_arm_f16_to_float_23), + ztest_unit_test(test_arm_q15_to_f16_7), + ztest_unit_test(test_arm_q15_to_f16_16), + ztest_unit_test(test_arm_q15_to_f16_23), + ztest_unit_test(test_arm_float_to_f16_7), + ztest_unit_test(test_arm_float_to_f16_16), + ztest_unit_test(test_arm_float_to_f16_23), + ztest_unit_test(test_arm_weighted_sum_f16_7), + ztest_unit_test(test_arm_weighted_sum_f16_16), + ztest_unit_test(test_arm_weighted_sum_f16_23) + ); + + ztest_run_test_suite(support_f16); +} diff --git a/tests/lib/cmsis_dsp/support/src/f16.pat b/tests/lib/cmsis_dsp/support/src/f16.pat new file mode 100644 index 00000000000..9deeff9e8e4 --- /dev/null +++ b/tests/lib/cmsis_dsp/support/src/f16.pat @@ -0,0 +1,161 @@ +static const uint16_t in_weighted_sum_val[50] = { + 0x30a6, 0x36e9, 0x3b67, 0x3173, 0x362c, 0x3bfd, 0x2ef6, 0x37ae, + 0x38bd, 0x36e6, 0x369f, 0x3bac, 0x3953, 0x3b9f, 0x3881, 0x38e0, + 0x3b1f, 0x1960, 0x3956, 0x3a83, 0x3174, 0x343c, 0x3998, 0x39e8, + 0x379a, 0x3707, 0x3999, 0x37d3, 0x2f65, 0x2f64, 0x38b1, 0x353e, + 0x3713, 0x3a04, 0x379f, 0x37dc, 0x386c, 0x3966, 0x39a5, 0x3bbc, + 0x383a, 0x3912, 0x2a4a, 0x3756, 0x354c, 0x3663, 0x2402, 0x3458, + 0x3b4d, 0x393f + }; + +static const uint16_t in_weighted_sum_coeff[50] = { + 0x34e2, 0x282f, 0x3443, 0x38f1, 0x30e5, 0x3a33, 0x3aca, 0x3830, + 0x2f6d, 0x3932, 0x33e5, 0x3a9d, 0x3bbe, 0x3488, 0x3ac7, 0x39c4, + 0x37a2, 0x3911, 0x38c6, 0x3aa9, 0x3058, 0x38dc, 0x3b52, 0x3799, + 0x3a40, 0x2d66, 0x28f8, 0x2b0c, 0x3559, 0x354d, 0x38c3, 0x3719, + 0x38e7, 0x30e1, 0x34fd, 0x31ab, 0x3852, 0x3b88, 0x3955, 0x1958, + 0x2df2, 0x3027, 0x39ae, 0x37d2, 0x37a9, 0x3905, 0x175b, 0x34cd, + 0x3917, 0x2e92 + }; + +static const uint32_t ref_f32[256] = { + 0x3e6dc924, 0x3e2486b6, 0x3ea0c4b0, 0x3eb8873d, + 0x3e2a5dcc, 0x3f3a8256, 0x3e7ebb3f, 0x3f0537d7, + 0x3ec9d94d, 0x3f10e8eb, 0x3e8ac054, 0x3e8de34d, + 0x3f38553f, 0x3e12ab5c, 0x3f741331, 0x3f6d0edf, + 0x3e98e5bc, 0x3ee8441e, 0x3f5abe5e, 0x3f228ce2, + 0x3ca9b3f0, 0x3e4ea407, 0x3f414244, 0x3e244fbe, + 0x3f5c38b0, 0x3ee9f27c, 0x3f4c6833, 0x3f1b48e3, + 0x3f6b4071, 0x3f5724df, 0x3f62091b, 0x3f49e803, + 0x3f5f64a1, 0x3f3d3de7, 0x3f5a0a5b, 0x3f38caf3, + 0x3d83c65c, 0x3e1f44b3, 0x3e97bd96, 0x3f1a26d1, + 0x3f2b3656, 0x3f1161b7, 0x3ce00b2d, 0x3e55f2a5, + 0x3ec84050, 0x3ea41c61, 0x3e75bd9c, 0x3f3e0d99, + 0x3e9ab80e, 0x3e9847ac, 0x3eadd8f5, 0x3f1b38b1, + 0x3f4d8e05, 0x3f4887ab, 0x3e9a3928, 0x3ec8bf3b, + 0x3f682c8c, 0x3f48f40f, 0x3f5214d5, 0x3f0e1bd0, + 0x3e7fc575, 0x3ecbc2d6, 0x3f4424c0, 0x3dd13961, + 0x3f6ece1e, 0x3e6e27da, 0x3eb43742, 0x3ed3e600, + 0x3f265621, 0x3f294646, 0x3e23da06, 0x3f03de74, + 0x3ecdaae9, 0x3f23af22, 0x3e3d66f3, 0x3e9eb1b7, + 0x3f7f4ccb, 0x3ee2cf65, 0x3f2fe785, 0x3f4ab2ea, + 0x3ee6d007, 0x3f5b7500, 0x3dd48a16, 0x3f5de4c3, + 0x3d578efb, 0x3e6a74b3, 0x3ef59b6f, 0x3f7cfa5f, + 0x3d959e7c, 0x3f376e35, 0x3eb14546, 0x3d26fa91, + 0x3f462803, 0x3ef7f86d, 0x3e81cc9e, 0x3e3ec7f1, + 0x3eff5680, 0x3f70f0df, 0x3f65a925, 0x3f41b77f, + 0x3f02b49b, 0x3eb8ed41, 0x3f6c9d8d, 0x3e5a750f, + 0x3ede8d52, 0x3f1bcba6, 0x3ef9eece, 0x3e5db8a2, + 0x3e0c70ea, 0x3f28f4c1, 0x3e350932, 0x3e5e62e1, + 0x3f1f5b05, 0x3d50808b, 0x3f3c98fb, 0x3f11791d, + 0x3e973a8d, 0x3f4a303f, 0x3f41abaa, 0x3e860968, + 0x3f479891, 0x3ebd22dd, 0x3ea2b1a4, 0x3d90e7fd, + 0x3f121ec0, 0x3f49077b, 0x3f43fcc1, 0x3dc018fa, + 0x3e92f7a8, 0x3e28acbb, 0x3f2b62f0, 0x3e8ab40e, + 0x3f0759ef, 0x3e6b4c76, 0x3e7ccd69, 0x3d0b5c0e, + 0x3e2b6c0b, 0x3f7b4725, 0x3e09f429, 0x3edc5225, + 0x3e5052ff, 0x3c2d5312, 0x3f17ef38, 0x3e68e722, + 0x3f0124b8, 0x3db054ad, 0x3d7d99d6, 0x3dbc5b8b, + 0x3f320806, 0x3ef488da, 0x3f0f46bb, 0x3ecdab35, + 0x3f51118c, 0x3ed5fe3d, 0x3e82b4a4, 0x3e0d677a, + 0x3f5d5e34, 0x3f549e4d, 0x3f800000, 0x3e878bf5, + 0x3e835ee8, 0x3f032fc2, 0x3c92f727, 0x3eb906cc, + 0x3e2b9f88, 0x3deed844, 0x3f747000, 0x3f32ba35, + 0x3ef305c4, 0x3f3c8745, 0x3f0602ba, 0x3f2b4d46, + 0x3f20c6ff, 0x3f29bd96, 0x3f48bad0, 0x3e1a4a43, + 0x3eda17ca, 0x3f676708, 0x3f430ff7, 0x3db5eb23, + 0x3e338ac1, 0x3dc18b6d, 0x3f570079, 0x3f678ffc, + 0x3f1c6a9f, 0x3f791831, 0x3ec02bb9, 0x3ed12fa1, + 0x3e8d1691, 0x3eac1e7c, 0x3f2f4073, 0x3f33a19a, + 0x3f611b48, 0x3f59ffff, 0x3f30166e, 0x3edd6d54, + 0x3ef15ef6, 0x3eff0b45, 0x3f6265fb, 0x3f0a5736, + 0x3f30b3c8, 0x3ed045e9, 0x3df4920d, 0x3f5f212a, + 0x3f171a71, 0x3f546ed0, 0x3cdcbfbb, 0x3f62bdb0, + 0x3bf57904, 0x3c9dc503, 0x3eb6234c, 0x3f02a4e8, + 0x3ee085d6, 0x3ca99f7a, 0x3f4ef040, 0x3f0e7aed, + 0x3e2ca85b, 0x3f241250, 0x3f6df3e2, 0x3eba5aab, + 0x3f4e8c84, 0x3e6a6d03, 0x3be552df, 0x3f7ad6b8, + 0x3ebde06c, 0x3f393af9, 0x3ea85de8, 0x3dc52f10, + 0x3f32f9b1, 0x3d69c847, 0x3ea4c4d4, 0x3f4827cc, + 0x3f1050e4, 0x3da28f6e, 0x3eac631d, 0x3f04541c, + 0x390ca629, 0x3e225f7d, 0x3e68a5b0, 0x3f09ff3f, + 0x3df47be2, 0x3db00868, 0x3f6009b6, 0x3f37bb10, + 0x3e3e7cc2, 0x3e856c5f, 0x3d880450, 0x3e40e56d, + 0x3f312dda, 0x3e9760cd, 0x3e27a550, 0x3ec3437a, + 0x3ee71457, 0x3f5a881e, 0x3f6b4411, 0x3f040cf0 + }; + +static const q15_t ref_q15[256] = { + 0x1DB9, 0x1491, 0x2831, 0x2E22, 0x154C, 0x5D41, 0x1FD7, 0x429C, + 0x3276, 0x4874, 0x22B0, 0x2379, 0x5C2B, 0x1255, 0x7A0A, 0x7687, + 0x2639, 0x3A11, 0x6D5F, 0x5146, 0x02A7, 0x19D5, 0x60A1, 0x148A, + 0x6E1C, 0x3A7D, 0x6634, 0x4DA4, 0x75A0, 0x6B92, 0x7105, 0x64F4, + 0x6FB2, 0x5E9F, 0x6D05, 0x5C65, 0x083C, 0x13E9, 0x25EF, 0x4D13, + 0x559B, 0x48B1, 0x0380, 0x1ABE, 0x3210, 0x2907, 0x1EB8, 0x5F07, + 0x26AE, 0x2612, 0x2B76, 0x4D9C, 0x66C7, 0x6444, 0x268E, 0x3230, + 0x7416, 0x647A, 0x690A, 0x470E, 0x1FF9, 0x32F1, 0x6212, 0x0D14, + 0x7767, 0x1DC5, 0x2D0E, 0x34FA, 0x532B, 0x54A3, 0x147B, 0x41EF, + 0x336B, 0x51D8, 0x17AD, 0x27AC, 0x7FA6, 0x38B4, 0x57F4, 0x6559, + 0x39B4, 0x6DBB, 0x0D49, 0x6EF2, 0x06BC, 0x1D4F, 0x3D67, 0x7E7D, + 0x095A, 0x5BB7, 0x2C51, 0x0538, 0x6314, 0x3DFE, 0x2073, 0x17D9, + 0x3FD6, 0x7878, 0x72D5, 0x60DC, 0x415A, 0x2E3B, 0x764F, 0x1B4F, + 0x37A3, 0x4DE6, 0x3E7C, 0x1BB7, 0x118E, 0x547A, 0x16A1, 0x1BCC, + 0x4FAE, 0x0684, 0x5E4C, 0x48BD, 0x25CF, 0x6518, 0x60D6, 0x2182, + 0x63CC, 0x2F49, 0x28AC, 0x090E, 0x490F, 0x6484, 0x61FE, 0x0C02, + 0x24BE, 0x1516, 0x55B1, 0x22AD, 0x43AD, 0x1D6A, 0x1F9A, 0x045B, + 0x156E, 0x7DA4, 0x113F, 0x3715, 0x1A0A, 0x015B, 0x4BF8, 0x1D1D, + 0x4092, 0x0B05, 0x07ED, 0x0BC6, 0x5904, 0x3D22, 0x47A3, 0x336B, + 0x6889, 0x3580, 0x20AD, 0x11AD, 0x6EAF, 0x6A4F, 0x7FFF, 0x21E3, + 0x20D8, 0x4198, 0x024C, 0x2E42, 0x1574, 0x0EEE, 0x7A38, 0x595D, + 0x3CC1, 0x5E44, 0x4301, 0x55A7, 0x5063, 0x54DF, 0x645D, 0x1349, + 0x3686, 0x73B4, 0x6188, 0x0B5F, 0x1671, 0x0C19, 0x6B80, 0x73C8, + 0x4E35, 0x7C8C, 0x300B, 0x344C, 0x2346, 0x2B08, 0x57A0, 0x59D1, + 0x708E, 0x6D00, 0x580B, 0x375B, 0x3C58, 0x3FC3, 0x7133, 0x452C, + 0x585A, 0x3411, 0x0F49, 0x6F91, 0x4B8D, 0x6A37, 0x0373, 0x715F, + 0x00F5, 0x0277, 0x2D89, 0x4152, 0x3821, 0x02A6, 0x6778, 0x473D, + 0x1595, 0x5209, 0x76FA, 0x2E97, 0x6746, 0x1D4E, 0x00E5, 0x7D6B, + 0x2F78, 0x5C9D, 0x2A17, 0x0C53, 0x597D, 0x074E, 0x2931, 0x6414, + 0x4828, 0x0A29, 0x2B19, 0x422A, 0x0004, 0x144C, 0x1D15, 0x4500, + 0x0F48, 0x0B01, 0x7005, 0x5BDE, 0x17D0, 0x215B, 0x0880, 0x181D, + 0x5897, 0x25D8, 0x14F5, 0x30D1, 0x39C5, 0x6D44, 0x75A2, 0x4206 + }; + +static const uint16_t ref_f16[256] = { + 0x336e, 0x3124, 0x3506, 0x35c4, 0x3153, 0x39d4, 0x33f6, 0x382a, + 0x364f, 0x3887, 0x3456, 0x346f, 0x39c3, 0x3095, 0x3ba1, 0x3b68, + 0x34c7, 0x3742, 0x3ad6, 0x3914, 0x254e, 0x3275, 0x3a0a, 0x3122, + 0x3ae2, 0x3750, 0x3a63, 0x38da, 0x3b5a, 0x3ab9, 0x3b10, 0x3a4f, + 0x3afb, 0x39ea, 0x3ad0, 0x39c6, 0x2c1e, 0x30fa, 0x34be, 0x38d1, + 0x395a, 0x388b, 0x2700, 0x32b0, 0x3642, 0x3521, 0x33ae, 0x39f0, + 0x34d6, 0x34c2, 0x356f, 0x38da, 0x3a6c, 0x3a44, 0x34d2, 0x3646, + 0x3b41, 0x3a48, 0x3a91, 0x3871, 0x33fe, 0x365e, 0x3a21, 0x2e8a, + 0x3b76, 0x3371, 0x35a2, 0x369f, 0x3933, 0x394a, 0x311f, 0x381f, + 0x366d, 0x391d, 0x31eb, 0x34f6, 0x3bfa, 0x3716, 0x397f, 0x3a56, + 0x3737, 0x3adc, 0x2ea4, 0x3aef, 0x2abc, 0x3354, 0x37ad, 0x3be8, + 0x2cad, 0x39bb, 0x358a, 0x2938, 0x3a31, 0x37c0, 0x340e, 0x31f6, + 0x37fb, 0x3b88, 0x3b2d, 0x3a0e, 0x3816, 0x35c7, 0x3b65, 0x32d4, + 0x36f4, 0x38de, 0x37cf, 0x32ee, 0x3064, 0x3948, 0x31a8, 0x32f3, + 0x38fb, 0x2a84, 0x39e5, 0x388c, 0x34ba, 0x3a52, 0x3a0d, 0x3430, + 0x3a3d, 0x35e9, 0x3516, 0x2c87, 0x3891, 0x3a48, 0x3a20, 0x2e01, + 0x3498, 0x3145, 0x395b, 0x3456, 0x383b, 0x335a, 0x33e6, 0x285b, + 0x315b, 0x3bda, 0x3050, 0x36e3, 0x3283, 0x216b, 0x38bf, 0x3347, + 0x3809, 0x2d83, 0x2bed, 0x2de3, 0x3990, 0x37a4, 0x387a, 0x366d, + 0x3a89, 0x36b0, 0x3416, 0x306b, 0x3aeb, 0x3aa5, 0x3c00, 0x343c, + 0x341b, 0x3819, 0x2498, 0x35c8, 0x315d, 0x2f77, 0x3ba3, 0x3996, + 0x3798, 0x39e4, 0x3830, 0x395a, 0x3906, 0x394e, 0x3a46, 0x30d2, + 0x36d1, 0x3b3b, 0x3a18, 0x2daf, 0x319c, 0x2e0c, 0x3ab8, 0x3b3c, + 0x38e3, 0x3bc9, 0x3601, 0x3689, 0x3469, 0x3561, 0x397a, 0x399d, + 0x3b09, 0x3ad0, 0x3981, 0x36eb, 0x378b, 0x37f8, 0x3b13, 0x3853, + 0x3986, 0x3682, 0x2fa5, 0x3af9, 0x38b9, 0x3aa3, 0x26e6, 0x3b16, + 0x1fac, 0x24ee, 0x35b1, 0x3815, 0x3704, 0x254d, 0x3a78, 0x3874, + 0x3165, 0x3921, 0x3b70, 0x35d3, 0x3a74, 0x3353, 0x1f2b, 0x3bd7, + 0x35ef, 0x39ca, 0x3543, 0x2e29, 0x3998, 0x2b4e, 0x3526, 0x3a41, + 0x3883, 0x2d14, 0x3563, 0x3823, 0x865, 0x3113, 0x3345, 0x3850, + 0x2fa4, 0x2d80, 0x3b00, 0x39be, 0x31f4, 0x342b, 0x2c40, 0x3207, + 0x3989, 0x34bb, 0x313d, 0x361a, 0x3739, 0x3ad4, 0x3b5a, 0x3820 + }; + +static const uint16_t ref_weighted_sum[3] = { + 0x3720, 0x388f, 0x3884 + }; + diff --git a/tests/lib/cmsis_dsp/support/src/main.c b/tests/lib/cmsis_dsp/support/src/main.c index 45c6a5c972a..105d0b536d1 100644 --- a/tests/lib/cmsis_dsp/support/src/main.c +++ b/tests/lib/cmsis_dsp/support/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Stephanos Ioannidis + * Copyright (c) 2021 Stephanos Ioannidis * * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ extern void test_support_q7(void); extern void test_support_q15(void); extern void test_support_q31(void); +extern void test_support_f16(void); extern void test_support_f32(void); extern void test_support_barycenter_f32(void); @@ -18,6 +19,9 @@ void test_main(void) test_support_q7(); test_support_q15(); test_support_q31(); +#ifdef CONFIG_CMSIS_DSP_FLOAT16 + test_support_f16(); +#endif test_support_f32(); test_support_barycenter_f32(); }