CMSIS-DSP: Improved tests

pull/19/head
Christophe Favergeon 6 years ago
parent 18fe3c157d
commit 92be16c2aa

@ -1,9 +1,7 @@
#include "TransformF32.h" #include "TransformF32.h"
#include "Error.h" #include "Error.h"
#include "arm_math.h" #include "arm_math.h"
#include "arm_const_structs.h"
void TransformF32::test_cfft_f32() void TransformF32::test_cfft_f32()
{ {
arm_cfft_f32(&(this->cfftInstance), this->pDst, this->ifft,this->bitRev); arm_cfft_f32(&(this->cfftInstance), this->pDst, this->ifft,this->bitRev);

@ -1,98 +1,6 @@
#include "TransformQ15.h" #include "TransformQ15.h"
#include "Error.h" #include "Error.h"
#include "arm_const_structs.h"
#define CFFT_INIT(typ, suffix, S, fftLen) \
\
{ \
\
/* Initialise the default arm status */ \
arm_status status = ARM_MATH_SUCCESS; \
\
/* Initialise the FFT length */ \
S->fftLen = fftLen; \
\
/* Initialise the Twiddle coefficient pointer */ \
S->pTwiddle = (typ *)twiddleCoef_4096_##suffix; \
\
\
/* Initializations of Instance structure depending on the FFT length */\
switch (S->fftLen) { \
\
\
/* Initializations of structure parameters for 2048 point FFT */ \
case 2048U: \
/* Initialise the bit reversal table modifier */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_2048; \
S->pTwiddle = (typ *)twiddleCoef_2048_##suffix; \
break; \
\
/* Initializations of structure parameters for 1024 point FFT */ \
case 1024U: \
/* Initialise the bit reversal table modifier */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_1024; \
S->pTwiddle = (typ *)twiddleCoef_1024_##suffix; \
break; \
\
/* Initializations of structure parameters for 512 point FFT */ \
case 512U: \
/* Initialise the bit reversal table modifier */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_512; \
S->pTwiddle = (typ *)twiddleCoef_512_##suffix; \
break; \
\
case 256U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_256; \
S->pTwiddle = (typ *)twiddleCoef_256_##suffix; \
\
break; \
\
case 128U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_128; \
S->pTwiddle = (typ *)twiddleCoef_128_##suffix; \
\
break; \
\
case 64U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_64; \
S->pTwiddle = (typ *)twiddleCoef_64_##suffix; \
break; \
\
case 32U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_32; \
S->pTwiddle = (typ *)twiddleCoef_32_##suffix; \
break; \
\
case 16U: \
/* Initializations of structure parameters for 16 point FFT */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_16; \
S->pTwiddle = (typ *)twiddleCoef_16_##suffix; \
break; \
\
\
default: \
/* Reporting argument error if fftSize is not valid value */ \
status = ARM_MATH_ARGUMENT_ERROR; \
break; \
} \
\
\
return (status); \
\
}
arm_status arm_cfft_init_q15(arm_cfft_instance_q15 *S, uint16_t fftLen)
{
CFFT_INIT(q15_t, q15, S, fftLen);
}
void TransformQ15::test_cfft_q15() void TransformQ15::test_cfft_q15()
{ {

@ -1,97 +1,5 @@
#include "TransformQ31.h" #include "TransformQ31.h"
#include "Error.h" #include "Error.h"
#include "arm_const_structs.h"
#define CFFT_INIT(typ, suffix, S, fftLen) \
\
{ \
\
/* Initialise the default arm status */ \
arm_status status = ARM_MATH_SUCCESS; \
\
/* Initialise the FFT length */ \
S->fftLen = fftLen; \
\
/* Initialise the Twiddle coefficient pointer */ \
S->pTwiddle = (typ *)twiddleCoef_4096_##suffix; \
\
\
/* Initializations of Instance structure depending on the FFT length */\
switch (S->fftLen) { \
\
/* Initializations of structure parameters for 2048 point FFT */ \
case 2048U: \
/* Initialise the bit reversal table modifier */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_2048; \
S->pTwiddle = (typ *)twiddleCoef_2048_##suffix; \
break; \
\
/* Initializations of structure parameters for 1024 point FFT */ \
case 1024U: \
/* Initialise the bit reversal table modifier */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_1024; \
S->pTwiddle = (typ *)twiddleCoef_1024_##suffix; \
break; \
\
/* Initializations of structure parameters for 512 point FFT */ \
case 512U: \
/* Initialise the bit reversal table modifier */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_512; \
S->pTwiddle = (typ *)twiddleCoef_512_##suffix; \
break; \
\
case 256U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_256; \
S->pTwiddle = (typ *)twiddleCoef_256_##suffix; \
\
break; \
\
case 128U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_128; \
S->pTwiddle = (typ *)twiddleCoef_128_##suffix; \
\
break; \
\
case 64U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_64; \
S->pTwiddle = (typ *)twiddleCoef_64_##suffix; \
break; \
\
case 32U: \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_32; \
S->pTwiddle = (typ *)twiddleCoef_32_##suffix; \
break; \
\
case 16U: \
/* Initializations of structure parameters for 16 point FFT */ \
S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH; \
S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_16; \
S->pTwiddle = (typ *)twiddleCoef_16_##suffix; \
break; \
\
\
default: \
/* Reporting argument error if fftSize is not valid value */ \
status = ARM_MATH_ARGUMENT_ERROR; \
break; \
} \
\
\
return (status); \
\
}
arm_status arm_cfft_init_q31(arm_cfft_instance_q31 *S, uint16_t fftLen)
{
CFFT_INIT(q31_t, q31, S, fftLen);
}
void TransformQ31::test_cfft_q31() void TransformQ31::test_cfft_q31()
{ {

@ -215,7 +215,11 @@ def addRows(conn,elem,tableName,full):
for field in common: for field in common:
if field in VALKEYFIELD: if field in VALKEYFIELD:
if field == "CATEGORY": if field == "CATEGORY":
val = findInTable(conn,"CATEGORY","category",row[field],"categoryid") # Remove type extension to get category name so that
# all types are maped to same category which will
# help for post processing.
testField=re.sub(r'^(.*)[:]([^:]+)(F16|F32|F64|Q31|Q15|Q7)$',r'\1',row[field])
val = findInTable(conn,"CATEGORY","category",testField,"categoryid")
keys[field]=val keys[field]=val
if field == "CORE": if field == "CORE":
val = findInTable(conn,"CORE","coredef",row[field],"coreid") val = findInTable(conn,"CORE","coredef",row[field],"coreid")

@ -223,7 +223,11 @@ def addRows(conn,elem,tableName,full):
for field in common: for field in common:
if field in VALKEYFIELD: if field in VALKEYFIELD:
if field == "CATEGORY": if field == "CATEGORY":
val = findInTable(conn,"CATEGORY","category",row[field],"categoryid") # Remove type extension to get category name so that
# all types are maped to same category which will
# help for post processing.
testField=re.sub(r'^(.*)[:]([^:]+)(F16|F32|F64|Q31|Q15|Q7)$',r'\1',row[field])
val = findInTable(conn,"CATEGORY","category",testField,"categoryid")
keys[field]=val keys[field]=val
if field == "CORE": if field == "CORE":
val = findInTable(conn,"CORE","coredef",row[field],"coreid") val = findInTable(conn,"CORE","coredef",row[field],"coreid")

@ -1297,6 +1297,12 @@ group Root {
REV = [0,1] REV = [0,1]
} }
Params CFFT4_PARAM_ID = {
NB = [16,64,256]
IFFT = [0,1]
REV = [0,1]
}
Params RFFT_PARAM_ID = { Params RFFT_PARAM_ID = {
NB = [32,64,128,256] NB = [32,64,128,256]
IFFT = [0,1] IFFT = [0,1]
@ -1313,7 +1319,7 @@ group Root {
test_cfft_f32:test_cfft_f32 -> CFFT_PARAM_ID test_cfft_f32:test_cfft_f32 -> CFFT_PARAM_ID
test_rfft_f32:test_rfft_f32 -> RFFT_PARAM_ID test_rfft_f32:test_rfft_f32 -> RFFT_PARAM_ID
test_dct4_f32:test_dct4_f32 -> DCT_PARAM_ID test_dct4_f32:test_dct4_f32 -> DCT_PARAM_ID
test_cfft_radix4_f32:test_cfft_radix4_f32 -> CFFT_PARAM_ID test_cfft_radix4_f32:test_cfft_radix4_f32 -> CFFT4_PARAM_ID
test_cfft_radix2_f32:test_cfft_radix2_f32 -> CFFT_PARAM_ID test_cfft_radix2_f32:test_cfft_radix2_f32 -> CFFT_PARAM_ID
} }
} }
@ -1341,6 +1347,12 @@ group Root {
REV = [0,1] REV = [0,1]
} }
Params CFFT4_PARAM_ID = {
NB = [16,64,256]
IFFT = [0,1]
REV = [0,1]
}
Params RFFT_PARAM_ID = { Params RFFT_PARAM_ID = {
NB = [32,64,128,256] NB = [32,64,128,256]
IFFT = [0,1] IFFT = [0,1]
@ -1357,7 +1369,7 @@ group Root {
test_cfft_q31:test_cfft_q31 -> CFFT_PARAM_ID test_cfft_q31:test_cfft_q31 -> CFFT_PARAM_ID
test_rfft_q31:test_rfft_q31 -> RFFT_PARAM_ID test_rfft_q31:test_rfft_q31 -> RFFT_PARAM_ID
test_dct4_q31:test_dct4_q31 -> DCT_PARAM_ID test_dct4_q31:test_dct4_q31 -> DCT_PARAM_ID
test_cfft_radix4_q31:test_cfft_radix4_q31 -> CFFT_PARAM_ID test_cfft_radix4_q31:test_cfft_radix4_q31 -> CFFT4_PARAM_ID
test_cfft_radix2_q31:test_cfft_radix2_q31 -> CFFT_PARAM_ID test_cfft_radix2_q31:test_cfft_radix2_q31 -> CFFT_PARAM_ID
} }
} }
@ -1385,6 +1397,12 @@ group Root {
REV = [0,1] REV = [0,1]
} }
Params CFFT4_PARAM_ID = {
NB = [16,64,256]
IFFT = [0,1]
REV = [0,1]
}
Params RFFT_PARAM_ID = { Params RFFT_PARAM_ID = {
NB = [32,64,128,256] NB = [32,64,128,256]
IFFT = [0,1] IFFT = [0,1]
@ -1401,7 +1419,7 @@ group Root {
test_cfft_q15:test_cfft_q15 -> CFFT_PARAM_ID test_cfft_q15:test_cfft_q15 -> CFFT_PARAM_ID
test_rfft_q15:test_rfft_q15 -> RFFT_PARAM_ID test_rfft_q15:test_rfft_q15 -> RFFT_PARAM_ID
test_dct4_q15:test_dct4_q15 -> DCT_PARAM_ID test_dct4_q15:test_dct4_q15 -> DCT_PARAM_ID
test_cfft_radix4_q15:test_cfft_radix4_q15 -> CFFT_PARAM_ID test_cfft_radix4_q15:test_cfft_radix4_q15 -> CFFT4_PARAM_ID
test_cfft_radix2_q15:test_cfft_radix2_q15 -> CFFT_PARAM_ID test_cfft_radix2_q15:test_cfft_radix2_q15 -> CFFT_PARAM_ID
} }
} }

@ -8,6 +8,7 @@ option(HARDFP "Hard floating point" ON)
option(LITTLEENDIAN "Little endian" ON) option(LITTLEENDIAN "Little endian" ON)
option(FASTMATHCOMPUTATIONS "Fast Math enabled" OFF) option(FASTMATHCOMPUTATIONS "Fast Math enabled" OFF)
option(FLOAT16 "Scalar float16 supported" OFF) option(FLOAT16 "Scalar float16 supported" OFF)
option(HYBRID "Hybrid instrinsics" ON)
# More detailed identification for benchmark results # More detailed identification for benchmark results
SET(COREID ARMCM7) SET(COREID ARMCM7)
@ -95,6 +96,9 @@ function(configcore PROJECTNAME ROOT)
SET(HARDFP ON) SET(HARDFP ON)
SET(LITTLEENDIAN ON) SET(LITTLEENDIAN ON)
SET(COREID ARMv81MML_DSP_DP_MVE_FP PARENT_SCOPE) SET(COREID ARMv81MML_DSP_DP_MVE_FP PARENT_SCOPE)
if (HYBRID)
target_compile_definitions(${PROJECTNAME} PRIVATE __ARM_MVE_HYBRID_INTRINSICS)
endif()
endif() endif()
# CORTEX-M35 # CORTEX-M35

Loading…
Cancel
Save