299 lines
8.0 KiB
XML
299 lines
8.0 KiB
XML
|
|
<instance locked="false"
|
|
id="org.chibios.spc5.components.portable.chibios_unitary_tests_engine">
|
|
<description>
|
|
<brief>
|
|
<value>Core Benchmarks Test Suite.</value>
|
|
</brief>
|
|
<copyright>
|
|
<value><![CDATA[/*
|
|
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
/*
|
|
This module is based on the work of John Walker (April of 1989) and
|
|
merely adapted to work in ChibiOS. The author has not specified
|
|
additional license terms so this is released using the most permissive
|
|
license used in ChibiOS. The license covers the changes only, not the
|
|
original work.
|
|
*/]]></value>
|
|
</copyright>
|
|
<introduction>
|
|
<value>Test suite for core benchmarks. The purpose of this suite
|
|
is to perform general benchmarks in order to assess
|
|
performance of cores and/or compilers.
|
|
</value>
|
|
</introduction>
|
|
</description>
|
|
<global_data_and_code>
|
|
<code_prefix>
|
|
<value>corebmk_</value>
|
|
</code_prefix>
|
|
<global_definitions>
|
|
<value><![CDATA[
|
|
/**/
|
|
]]></value>
|
|
</global_definitions>
|
|
<global_code>
|
|
<value><![CDATA[
|
|
/**/
|
|
]]></value>
|
|
</global_code>
|
|
</global_data_and_code>
|
|
<sequences>
|
|
<sequence>
|
|
<type index="0">
|
|
<value>Internal Tests</value>
|
|
</type>
|
|
<brief>
|
|
<value>Information.</value>
|
|
</brief>
|
|
<description>
|
|
<value>This sequence reports configuration and version
|
|
information about execution environment.
|
|
</value>
|
|
</description>
|
|
<condition>
|
|
<value><![CDATA[CH_CFG_USE_HEAP == TRUE]]></value>
|
|
</condition>
|
|
<shared_code>
|
|
<value><![CDATA[
|
|
#include <string.h>
|
|
|
|
#include "ch.h"
|
|
|
|
#include "ffbench_mod.h"
|
|
|
|
#define ASIZE 64 /* Array edge size. */
|
|
#define NITERATIONS 10 /* Number of iterations. */
|
|
#define NPASSES 50 /* Number of FFT/Inverse passes. */
|
|
|
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
|
#define min(a, b) ((a) <= (b) ? (a) : (b))
|
|
|
|
float *fdatas;
|
|
double *fdatad;
|
|
]]></value>
|
|
</shared_code>
|
|
<cases>
|
|
<case>
|
|
<brief>
|
|
<value>Environment Info.</value>
|
|
</brief>
|
|
<description>
|
|
<value>Environment-related info are reported.</value>
|
|
</description>
|
|
<condition>
|
|
<value />
|
|
</condition>
|
|
<various_code>
|
|
<setup_code>
|
|
<value />
|
|
</setup_code>
|
|
<teardown_code>
|
|
<value />
|
|
</teardown_code>
|
|
<local_variables>
|
|
<value />
|
|
</local_variables>
|
|
</various_code>
|
|
<steps>
|
|
<step>
|
|
<description>
|
|
<value>Architecture and Compiler information.</value>
|
|
</description>
|
|
<tags>
|
|
<value />
|
|
</tags>
|
|
<code>
|
|
<value><![CDATA[
|
|
#if defined(PORT_ARCHITECTURE_NAME)
|
|
test_print("--- Architecture: ");
|
|
test_println(PORT_ARCHITECTURE_NAME);
|
|
#endif
|
|
#if defined(PORT_CORE_VARIANT_NAME)
|
|
test_print("--- Core Variant: ");
|
|
test_println(PORT_CORE_VARIANT_NAME);
|
|
#endif
|
|
#if defined(PORT_COMPILER_NAME)
|
|
test_print("--- Compiler: ");
|
|
test_println(PORT_COMPILER_NAME);
|
|
#endif
|
|
#if defined(PORT_INFO)
|
|
test_print("--- Port Info: ");
|
|
test_println(PORT_INFO);
|
|
#endif
|
|
#if defined(PORT_NATURAL_ALIGN)
|
|
test_print("--- Natural alignment: ");
|
|
test_printn(PORT_NATURAL_ALIGN);
|
|
test_println("");
|
|
#endif
|
|
#if defined(PORT_STACK_ALIGN)
|
|
test_print("--- Stack alignment: ");
|
|
test_printn(PORT_STACK_ALIGN);
|
|
test_println("");
|
|
#endif
|
|
#if defined(PORT_WORKING_AREA_ALIGN)
|
|
test_print("--- Working area alignment: ");
|
|
test_printn(PORT_WORKING_AREA_ALIGN);
|
|
test_println("");
|
|
#endif
|
|
]]></value>
|
|
</code>
|
|
</step>
|
|
</steps>
|
|
</case>
|
|
<case>
|
|
<brief>
|
|
<value>Two-dimensional FFT</value>
|
|
</brief>
|
|
<description>
|
|
<value>Two-dimensional FFT benchmark, execution time is reported, expected results are checked.</value>
|
|
</description>
|
|
<condition>
|
|
<value />
|
|
</condition>
|
|
<various_code>
|
|
<setup_code>
|
|
<value><![CDATA[
|
|
fdatas = NULL;
|
|
]]></value>
|
|
</setup_code>
|
|
<teardown_code>
|
|
<value><![CDATA[
|
|
if (fdatas != NULL) {
|
|
chHeapFree((void *)fdatas);
|
|
}
|
|
]]></value>
|
|
</teardown_code>
|
|
<local_variables>
|
|
<value><![CDATA[
|
|
time_msecs_t msecs;
|
|
size_t fasize;
|
|
int fanum;
|
|
int faedge;
|
|
int nsize[] = {0, 0, 0};
|
|
]]></value>
|
|
</local_variables>
|
|
</various_code>
|
|
<steps>
|
|
<step>
|
|
<description>
|
|
<value>Allocating memory for single precision work matrix</value>
|
|
</description>
|
|
<tags>
|
|
<value />
|
|
</tags>
|
|
<code>
|
|
<value><![CDATA[
|
|
faedge = ASIZE; /* FFT array edge size.*/
|
|
fanum = faedge * faedge;
|
|
fasize = ((size_t)(fanum + 1) * 2 * sizeof(float)); /* FFT array size.*/
|
|
fdatas = (float *)chHeapAlloc(NULL, fasize);
|
|
nsize[1] = nsize[2] = faedge;
|
|
|
|
test_assert(fdatas != NULL, "single precision matrix allocation failed");
|
|
]]></value>
|
|
</code>
|
|
</step>
|
|
<step>
|
|
<description>
|
|
<value>Printing setup</value>
|
|
</description>
|
|
<tags>
|
|
<value />
|
|
</tags>
|
|
<code>
|
|
<value><![CDATA[
|
|
test_print("--- Matrix: ");
|
|
test_printn(ASIZE);
|
|
test_print("x");
|
|
test_printn(ASIZE);
|
|
test_println("");
|
|
test_print("--- Iter. : ");
|
|
test_printn(NITERATIONS);
|
|
test_println("");
|
|
test_print("--- Passes: ");
|
|
test_printn(NPASSES);
|
|
test_println("");
|
|
]]></value>
|
|
</code>
|
|
</step>
|
|
<step>
|
|
<description>
|
|
<value>Running single precision FFT iterations</value>
|
|
</description>
|
|
<tags>
|
|
<value />
|
|
</tags>
|
|
<code>
|
|
<value><![CDATA[
|
|
systime_t start, end;
|
|
int i, j, k, iters;
|
|
|
|
/* Time stamp for benchmark start.*/
|
|
start = chVTGetSystemTime();
|
|
|
|
iters = 0;
|
|
for (k = 0; k < NITERATIONS; k++) {
|
|
|
|
/* Generate data array to process.*/
|
|
memset(fdatas, 0, fasize);
|
|
for (i = 0; i < faedge; i++) {
|
|
for (j = 0; j < faedge; j++) {
|
|
if (((i & 15) == 8) || ((j & 15) == 8)) {
|
|
fdatas[1 + ((faedge * i) + j) * 2] = 128.0;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < NPASSES; i++) {
|
|
/* Transform image to frequency domain.*/
|
|
fourn_float(fdatas, nsize, 2, 1);
|
|
|
|
/* Back-transform to image.*/
|
|
fourn_float(fdatas, nsize, 2, -1);
|
|
|
|
iters++;
|
|
}
|
|
}
|
|
|
|
/* Time stamp for benchmark end.*/
|
|
end = chVTGetSystemTime();
|
|
msecs = chTimeI2MS(chTimeDiffX(start, end));
|
|
]]></value>
|
|
</code>
|
|
</step>
|
|
<step>
|
|
<description>
|
|
<value>Printing execution time</value>
|
|
</description>
|
|
<tags>
|
|
<value />
|
|
</tags>
|
|
<code>
|
|
<value><![CDATA[
|
|
test_print("--- Time : ");
|
|
test_printn(msecs);
|
|
test_println(" milliseconds");
|
|
]]></value>
|
|
</code>
|
|
</step>
|
|
</steps>
|
|
</case>
|
|
</cases>
|
|
</sequence>
|
|
</sequences>
|
|
</instance>
|