CMSIS-DSP: Added new tests to the test framework.
parent
e5fd202d8b
commit
9ffa36e9c8
@ -0,0 +1,22 @@
|
|||||||
|
#include "Test.h"
|
||||||
|
#include "Pattern.h"
|
||||||
|
class MicroBenchmarksF32:public Client::Suite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MicroBenchmarksF32(Testing::testID_t id);
|
||||||
|
virtual void setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr);
|
||||||
|
virtual void tearDown(Testing::testID_t,Client::PatternMgr *mgr);
|
||||||
|
private:
|
||||||
|
#include "MicroBenchmarksF32_decl.h"
|
||||||
|
|
||||||
|
Client::Pattern<float32_t> input1;
|
||||||
|
Client::Pattern<float32_t> input2;
|
||||||
|
Client::LocalPattern<float32_t> output;
|
||||||
|
|
||||||
|
|
||||||
|
int nbSamples;
|
||||||
|
|
||||||
|
float32_t *inp1;
|
||||||
|
float32_t *inp2;
|
||||||
|
float32_t *outp;
|
||||||
|
};
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#include "Test.h"
|
||||||
|
#include "Pattern.h"
|
||||||
|
class MicroBenchmarksQ15:public Client::Suite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MicroBenchmarksQ15(Testing::testID_t id);
|
||||||
|
virtual void setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr);
|
||||||
|
virtual void tearDown(Testing::testID_t,Client::PatternMgr *mgr);
|
||||||
|
private:
|
||||||
|
#include "MicroBenchmarksQ15_decl.h"
|
||||||
|
|
||||||
|
Client::Pattern<q15_t> input1;
|
||||||
|
Client::Pattern<q15_t> input2;
|
||||||
|
Client::LocalPattern<q15_t> output;
|
||||||
|
|
||||||
|
|
||||||
|
int nbSamples;
|
||||||
|
|
||||||
|
q15_t *inp1;
|
||||||
|
q15_t *inp2;
|
||||||
|
q15_t *outp;
|
||||||
|
};
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#include "Test.h"
|
||||||
|
#include "Pattern.h"
|
||||||
|
class MicroBenchmarksQ31:public Client::Suite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MicroBenchmarksQ31(Testing::testID_t id);
|
||||||
|
virtual void setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr);
|
||||||
|
virtual void tearDown(Testing::testID_t,Client::PatternMgr *mgr);
|
||||||
|
private:
|
||||||
|
#include "MicroBenchmarksQ31_decl.h"
|
||||||
|
|
||||||
|
Client::Pattern<q31_t> input1;
|
||||||
|
Client::Pattern<q31_t> input2;
|
||||||
|
Client::LocalPattern<q31_t> output;
|
||||||
|
|
||||||
|
|
||||||
|
int nbSamples;
|
||||||
|
|
||||||
|
q31_t *inp1;
|
||||||
|
q31_t *inp2;
|
||||||
|
q31_t *outp;
|
||||||
|
};
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#include "Test.h"
|
||||||
|
#include "Pattern.h"
|
||||||
|
class MicroBenchmarksQ7:public Client::Suite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MicroBenchmarksQ7(Testing::testID_t id);
|
||||||
|
virtual void setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr);
|
||||||
|
virtual void tearDown(Testing::testID_t,Client::PatternMgr *mgr);
|
||||||
|
private:
|
||||||
|
#include "MicroBenchmarksQ7_decl.h"
|
||||||
|
|
||||||
|
Client::Pattern<q7_t> input1;
|
||||||
|
Client::Pattern<q7_t> input2;
|
||||||
|
Client::LocalPattern<q7_t> output;
|
||||||
|
|
||||||
|
|
||||||
|
int nbSamples;
|
||||||
|
|
||||||
|
q7_t *inp1;
|
||||||
|
q7_t *inp2;
|
||||||
|
q7_t *outp;
|
||||||
|
};
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
#include "MicroBenchmarksF32.h"
|
||||||
|
#include "Error.h"
|
||||||
|
|
||||||
|
static void add_while_f32(
|
||||||
|
const float32_t * pSrcA,
|
||||||
|
const float32_t * pSrcB,
|
||||||
|
float32_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
while (blkCnt > 0U)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
/* Decrement loop counter */
|
||||||
|
blkCnt--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_for_f32(
|
||||||
|
const float32_t * pSrcA,
|
||||||
|
const float32_t * pSrcB,
|
||||||
|
float32_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_array_f32(
|
||||||
|
const float32_t * pSrcA,
|
||||||
|
const float32_t * pSrcB,
|
||||||
|
float32_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
pDst[i] = pSrcA[i] + pSrcB[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksF32::test_while_f32()
|
||||||
|
{
|
||||||
|
add_while_f32(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksF32::test_for_f32()
|
||||||
|
{
|
||||||
|
add_for_f32(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksF32::test_array_f32()
|
||||||
|
{
|
||||||
|
add_array_f32(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MicroBenchmarksF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<Testing::param_t>::iterator it = params.begin();
|
||||||
|
this->nbSamples = *it;
|
||||||
|
|
||||||
|
input1.reload(MicroBenchmarksF32::INPUT1_F32_ID,mgr,this->nbSamples);
|
||||||
|
input2.reload(MicroBenchmarksF32::INPUT2_F32_ID,mgr,this->nbSamples);
|
||||||
|
|
||||||
|
|
||||||
|
output.create(this->nbSamples,MicroBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
|
||||||
|
|
||||||
|
this->inp1=input1.ptr();
|
||||||
|
this->inp2=input2.ptr();
|
||||||
|
this->outp=output.ptr();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
#include "MicroBenchmarksQ15.h"
|
||||||
|
#include "Error.h"
|
||||||
|
|
||||||
|
static void add_while_q15(
|
||||||
|
const q15_t * pSrcA,
|
||||||
|
const q15_t * pSrcB,
|
||||||
|
q15_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
while (blkCnt > 0U)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
/* Decrement loop counter */
|
||||||
|
blkCnt--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_for_q15(
|
||||||
|
const q15_t * pSrcA,
|
||||||
|
const q15_t * pSrcB,
|
||||||
|
q15_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_array_q15(
|
||||||
|
const q15_t * pSrcA,
|
||||||
|
const q15_t * pSrcB,
|
||||||
|
q15_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
pDst[i] = pSrcA[i] + pSrcB[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ15::test_while_q15()
|
||||||
|
{
|
||||||
|
add_while_q15(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ15::test_for_q15()
|
||||||
|
{
|
||||||
|
add_for_q15(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ15::test_array_q15()
|
||||||
|
{
|
||||||
|
add_array_q15(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MicroBenchmarksQ15::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<Testing::param_t>::iterator it = params.begin();
|
||||||
|
this->nbSamples = *it;
|
||||||
|
|
||||||
|
input1.reload(MicroBenchmarksQ15::INPUT1_Q15_ID,mgr,this->nbSamples);
|
||||||
|
input2.reload(MicroBenchmarksQ15::INPUT2_Q15_ID,mgr,this->nbSamples);
|
||||||
|
|
||||||
|
|
||||||
|
output.create(this->nbSamples,MicroBenchmarksQ15::OUT_SAMPLES_Q15_ID,mgr);
|
||||||
|
|
||||||
|
this->inp1=input1.ptr();
|
||||||
|
this->inp2=input2.ptr();
|
||||||
|
this->outp=output.ptr();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ15::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
#include "MicroBenchmarksQ31.h"
|
||||||
|
#include "Error.h"
|
||||||
|
|
||||||
|
static void add_while_q31(
|
||||||
|
const q31_t * pSrcA,
|
||||||
|
const q31_t * pSrcB,
|
||||||
|
q31_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
while (blkCnt > 0U)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
/* Decrement loop counter */
|
||||||
|
blkCnt--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_for_q31(
|
||||||
|
const q31_t * pSrcA,
|
||||||
|
const q31_t * pSrcB,
|
||||||
|
q31_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_array_q31(
|
||||||
|
const q31_t * pSrcA,
|
||||||
|
const q31_t * pSrcB,
|
||||||
|
q31_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
pDst[i] = pSrcA[i] + pSrcB[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ31::test_while_q31()
|
||||||
|
{
|
||||||
|
add_while_q31(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ31::test_for_q31()
|
||||||
|
{
|
||||||
|
add_for_q31(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ31::test_array_q31()
|
||||||
|
{
|
||||||
|
add_array_q31(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MicroBenchmarksQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<Testing::param_t>::iterator it = params.begin();
|
||||||
|
this->nbSamples = *it;
|
||||||
|
|
||||||
|
input1.reload(MicroBenchmarksQ31::INPUT1_Q31_ID,mgr,this->nbSamples);
|
||||||
|
input2.reload(MicroBenchmarksQ31::INPUT2_Q31_ID,mgr,this->nbSamples);
|
||||||
|
|
||||||
|
|
||||||
|
output.create(this->nbSamples,MicroBenchmarksQ31::OUT_SAMPLES_Q31_ID,mgr);
|
||||||
|
|
||||||
|
this->inp1=input1.ptr();
|
||||||
|
this->inp2=input2.ptr();
|
||||||
|
this->outp=output.ptr();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
#include "MicroBenchmarksQ7.h"
|
||||||
|
#include "Error.h"
|
||||||
|
|
||||||
|
static void add_while_q7(
|
||||||
|
const q7_t * pSrcA,
|
||||||
|
const q7_t * pSrcB,
|
||||||
|
q7_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
while (blkCnt > 0U)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
/* Decrement loop counter */
|
||||||
|
blkCnt--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_for_q7(
|
||||||
|
const q7_t * pSrcA,
|
||||||
|
const q7_t * pSrcB,
|
||||||
|
q7_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
*pDst++ = (*pSrcA++) + (*pSrcB++);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_array_q7(
|
||||||
|
const q7_t * pSrcA,
|
||||||
|
const q7_t * pSrcB,
|
||||||
|
q7_t * pDst,
|
||||||
|
uint32_t blockSize)
|
||||||
|
{
|
||||||
|
uint32_t blkCnt;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
blkCnt = blockSize;
|
||||||
|
|
||||||
|
for(i=0; i<blkCnt; i++)
|
||||||
|
{
|
||||||
|
/* C = A + B */
|
||||||
|
|
||||||
|
/* Add and store result in destination buffer. */
|
||||||
|
pDst[i] = pSrcA[i] + pSrcB[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ7::test_while_q7()
|
||||||
|
{
|
||||||
|
add_while_q7(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ7::test_for_q7()
|
||||||
|
{
|
||||||
|
add_for_q7(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ7::test_array_q7()
|
||||||
|
{
|
||||||
|
add_array_q7(this->inp1,this->inp2,this->outp,this->nbSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MicroBenchmarksQ7::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<Testing::param_t>::iterator it = params.begin();
|
||||||
|
this->nbSamples = *it;
|
||||||
|
|
||||||
|
input1.reload(MicroBenchmarksQ7::INPUT1_Q7_ID,mgr,this->nbSamples);
|
||||||
|
input2.reload(MicroBenchmarksQ7::INPUT2_Q7_ID,mgr,this->nbSamples);
|
||||||
|
|
||||||
|
|
||||||
|
output.create(this->nbSamples,MicroBenchmarksQ7::OUT_SAMPLES_Q7_ID,mgr);
|
||||||
|
|
||||||
|
this->inp1=input1.ptr();
|
||||||
|
this->inp2=input2.ptr();
|
||||||
|
this->outp=output.ptr();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MicroBenchmarksQ7::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
|
||||||
|
{
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue