Skip to content

Commit adc634a

Browse files
committed
NMSIS/DSP: Fix scale function test data initialization
Initialize scaleFract variables with generate_rand functions instead of static values, and adjust shift values accordingly for q7, q15, and q31 scale tests. Signed-off-by: Jiandong Qiu <qiujiandong@nucleisys.com>
1 parent 2c43d48 commit adc634a

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

NMSIS/DSP/Benchmark/TestData/BasicMathFunctions/scale_q15/test_data.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
#define ARRAY_SIZE_Q15 1024
66

7-
static q15_t scaleFract_q15 = -2;
8-
static int8_t shift_q15 = 17;
7+
static q15_t scaleFract_q15;
8+
static int8_t shift_q15 = -2;
99
static q15_t scale_q15_input[ARRAY_SIZE_Q15] = {};

NMSIS/DSP/Benchmark/TestData/BasicMathFunctions/scale_q31/test_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
#define ARRAY_SIZE_Q31 1024
66

7-
static q31_t scaleFract_q31 = -1;
7+
static q31_t scaleFract_q31;
88
static int8_t shift_q31 = -1;
99
static q31_t scale_q31_input[ARRAY_SIZE_Q31] = {};

NMSIS/DSP/Benchmark/TestData/BasicMathFunctions/scale_q7/test_data.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
#define ARRAY_SIZE_Q7 1024
66

7-
static q7_t scaleFract_q7 = -2;
8-
static int8_t shift_q7 = 9;
7+
static q7_t scaleFract_q7;
8+
static int8_t shift_q7 = -2;
99
static q7_t scale_q7_input[ARRAY_SIZE_Q7] = {};

NMSIS/DSP/Test/BasicMathFunctions/riscv_basic_math_functions.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,8 @@ static void riscv_scale_functions(void)
539539
BENCH_STATUS(riscv_scale_f32);
540540

541541
// riscv_scale_q7.c
542-
q7_t scaleFract_q7 = -2;
543-
int8_t shift_q7 = 9;
542+
q7_t scaleFract_q7;
543+
int8_t shift_q7 = -2;
544544
generate_rand_q7(&scaleFract_q7, 1);
545545
BENCH_START(riscv_scale_q7);
546546
riscv_scale_q7(q7_a_array, scaleFract_q7, shift_q7, q7_out_array, ARRAY_SIZE);
@@ -554,8 +554,8 @@ static void riscv_scale_functions(void)
554554
BENCH_STATUS(riscv_scale_q7);
555555

556556
// riscv_scale_q15.c
557-
q15_t scaleFract_q15 = -2;
558-
int8_t shift_q15 = 17;
557+
q15_t scaleFract_q15;
558+
int8_t shift_q15 = -2;
559559
generate_rand_q15(&scaleFract_q15, 1);
560560
BENCH_START(riscv_scale_q15);
561561
riscv_scale_q15(q15_a_array, scaleFract_q15, shift_q15, q15_out_array, ARRAY_SIZE);
@@ -568,7 +568,7 @@ static void riscv_scale_functions(void)
568568
}
569569
BENCH_STATUS(riscv_scale_q15);
570570
// riscv_scale_q31.c
571-
q31_t scaleFract_q31 = -1;
571+
q31_t scaleFract_q31;
572572
generate_rand_q31(&scaleFract_q31, 1);
573573
int8_t shift_q31 = -1;
574574
BENCH_START(riscv_scale_q31);

0 commit comments

Comments
 (0)