#include <stdio.h>
#include "riscv_math.h"
#include "math_helper.h"
#define TEST_LENGTH_SAMPLES 1536
#define NUMTAPS 32
#define BLOCKSIZE 32
#define DELTA_ERROR 0.000001f
#define DELTA_COEFF 0.0001f
#define MU 0.5f
#define NUMFRAMES (TEST_LENGTH_SAMPLES / BLOCKSIZE)
float32_t firStateF32[NUMTAPS + BLOCKSIZE];
float32_t lmsStateF32[NUMTAPS + BLOCKSIZE];
float32_t errOutput[TEST_LENGTH_SAMPLES];
riscv_status test_signal_converge_example( void );
riscv_status test_signal_converge(float32_t* err_signal,
uint32_t blockSize);
void getinput(float32_t* input,
uint32_t fr_cnt,
uint32_t blockSize);
extern float32_t testInput_f32[TEST_LENGTH_SAMPLES];
extern float32_t lmsNormCoeff_f32[32];
extern const float32_t FIRCoeff_f32[32];
float32_t wire1[BLOCKSIZE];
float32_t wire2[BLOCKSIZE];
float32_t wire3[BLOCKSIZE];
float32_t err_signal[BLOCKSIZE];
int32_t main(void)
{
#if (defined(__riscv_vector))
__RV_CSR_SET(CSR_MSTATUS, 0x200);
#endif
uint32_t i;
riscv_status status;
uint32_t index;
float32_t minValue;
riscv_fir_init_f32(&LPF_instance, NUMTAPS, (float32_t *)FIRCoeff_f32, firStateF32, BLOCKSIZE);
for(i=0; i < NUMFRAMES; i++)
{
wire1,
wire2,
wire3,
err_signal,
BLOCKSIZE);
}
status = RISCV_MATH_SUCCESS;
if (minValue > DELTA_ERROR)
{
printf("first failed\n");
status = RISCV_MATH_TEST_FAILURE;
}
riscv_sub_f32((float32_t *)FIRCoeff_f32, lmsNormCoeff_f32, lmsNormCoeff_f32, NUMTAPS);
if (minValue > DELTA_COEFF)
{
printf("second failed\n");
status = RISCV_MATH_TEST_FAILURE;
}
if ( status != RISCV_MATH_SUCCESS)
{
printf("failed\n");
return 1;
}
printf("passed\n");
return 0;
}