1 #include "BasicTestsQ31.h" 2 #include <stdio.h> 3 #include "Error.h" 4 5 #define SNR_THRESHOLD 100 6 7 /* 8 9 Reference patterns are generated with 10 a double precision computation. 11 12 */ 13 #define ABS_ERROR_Q31 ((q31_t)4) 14 #define ABS_ERROR_Q63 ((q63_t)(1<<17)) 15 16 #define ONEHALF 0x40000000 17 18 #define GET_Q31_PTR() \ 19 const q31_t *inp1=input1.ptr(); \ 20 const q31_t *inp2=input2.ptr(); \ 21 q31_t *outp=output.ptr(); 22 23 #define GET_LOGICAL_UINT32_PTR() \ 24 const uint32_t *inp1=inputLogical1.ptr(); \ 25 const uint32_t *inp2=inputLogical2.ptr(); \ 26 uint32_t *outp=outputLogical.ptr(); 27 28 test_add_q31()29 void BasicTestsQ31::test_add_q31() 30 { 31 GET_Q31_PTR(); 32 33 arm_add_q31(inp1,inp2,outp,input1.nbSamples()); 34 35 ASSERT_EMPTY_TAIL(output); 36 37 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 38 39 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 40 41 } 42 test_clip_q31()43 void BasicTestsQ31::test_clip_q31() 44 { 45 const q31_t *inp=input1.ptr(); 46 q31_t *outp=output.ptr(); 47 48 arm_clip_q31(inp,outp,this->min, this->max,input1.nbSamples()); 49 50 ASSERT_EMPTY_TAIL(output); 51 52 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 53 54 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 55 56 } 57 test_sub_q31()58 void BasicTestsQ31::test_sub_q31() 59 { 60 GET_Q31_PTR(); 61 62 arm_sub_q31(inp1,inp2,outp,input1.nbSamples()); 63 64 ASSERT_EMPTY_TAIL(output); 65 66 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 67 68 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 69 70 } 71 test_mult_q31()72 void BasicTestsQ31::test_mult_q31() 73 { 74 GET_Q31_PTR(); 75 76 arm_mult_q31(inp1,inp2,outp,input1.nbSamples()); 77 78 ASSERT_EMPTY_TAIL(output); 79 80 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 81 82 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 83 84 } 85 test_negate_q31()86 void BasicTestsQ31::test_negate_q31() 87 { 88 const q31_t *inp1=input1.ptr(); 89 q31_t *outp=output.ptr(); 90 91 arm_negate_q31(inp1,outp,input1.nbSamples()); 92 93 ASSERT_EMPTY_TAIL(output); 94 95 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 96 97 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 98 99 } 100 test_offset_q31()101 void BasicTestsQ31::test_offset_q31() 102 { 103 const q31_t *inp1=input1.ptr(); 104 q31_t *outp=output.ptr(); 105 106 arm_offset_q31(inp1,this->scalar,outp,input1.nbSamples()); 107 108 ASSERT_EMPTY_TAIL(output); 109 110 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 111 112 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 113 114 } 115 test_scale_q31()116 void BasicTestsQ31::test_scale_q31() 117 { 118 const q31_t *inp1=input1.ptr(); 119 q31_t *outp=output.ptr(); 120 121 arm_scale_q31(inp1,this->scalar,0,outp,input1.nbSamples()); 122 123 ASSERT_EMPTY_TAIL(output); 124 125 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 126 127 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 128 129 } 130 test_dot_prod_q31()131 void BasicTestsQ31::test_dot_prod_q31() 132 { 133 q63_t r; 134 135 const q31_t *inp1=input1.ptr(); 136 const q31_t *inp2=input2.ptr(); 137 q63_t *outp=dotOutput.ptr(); 138 139 arm_dot_prod_q31(inp1,inp2,input1.nbSamples(),&r); 140 141 142 outp[0] = r; 143 144 ASSERT_SNR(dotOutput,dotRef,(float32_t)SNR_THRESHOLD); 145 146 147 ASSERT_NEAR_EQ(dotOutput,dotRef,(q63_t)ABS_ERROR_Q63); 148 149 ASSERT_EMPTY_TAIL(dotOutput); 150 151 } 152 test_abs_q31()153 void BasicTestsQ31::test_abs_q31() 154 { 155 GET_Q31_PTR(); 156 157 (void)inp2; 158 159 arm_abs_q31(inp1,outp,input1.nbSamples()); 160 161 ASSERT_EMPTY_TAIL(output); 162 163 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 164 165 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 166 167 } 168 test_shift_q31()169 void BasicTestsQ31::test_shift_q31() 170 { 171 const q31_t *inp1=input1.ptr(); 172 q31_t *outp=output.ptr(); 173 174 arm_shift_q31(inp1,1,outp,input1.nbSamples()); 175 176 ASSERT_EMPTY_TAIL(output); 177 178 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD); 179 180 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 181 182 } 183 test_and_u32()184 void BasicTestsQ31::test_and_u32() 185 { 186 GET_LOGICAL_UINT32_PTR(); 187 188 arm_and_u32(inp1, inp2, outp,inputLogical1.nbSamples()); 189 190 ASSERT_EMPTY_TAIL(outputLogical); 191 192 ASSERT_EQ(outputLogical,refLogical); 193 194 } 195 test_or_u32()196 void BasicTestsQ31::test_or_u32() 197 { 198 GET_LOGICAL_UINT32_PTR(); 199 200 arm_or_u32(inp1,inp2,outp,inputLogical1.nbSamples()); 201 202 ASSERT_EMPTY_TAIL(outputLogical); 203 204 ASSERT_EQ(outputLogical,refLogical); 205 206 } 207 test_not_u32()208 void BasicTestsQ31::test_not_u32() 209 { 210 GET_LOGICAL_UINT32_PTR(); 211 212 (void)inp2; 213 214 arm_not_u32(inp1,outp,inputLogical1.nbSamples()); 215 216 ASSERT_EMPTY_TAIL(outputLogical); 217 218 ASSERT_EQ(outputLogical,refLogical); 219 220 } 221 test_xor_u32()222 void BasicTestsQ31::test_xor_u32() 223 { 224 GET_LOGICAL_UINT32_PTR(); 225 226 arm_xor_u32(inp1,inp2,outp,inputLogical1.nbSamples()); 227 228 ASSERT_EMPTY_TAIL(outputLogical); 229 230 ASSERT_EQ(outputLogical,refLogical); 231 232 } 233 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)234 void BasicTestsQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr) 235 { 236 237 (void)params; 238 Testing::nbSamples_t nb=MAX_NB_SAMPLES; 239 240 this->scalar = ONEHALF; 241 242 243 switch(id) 244 { 245 case BasicTestsQ31::TEST_ADD_Q31_1: 246 nb = 3; 247 ref.reload(BasicTestsQ31::REF_ADD_Q31_ID,mgr,nb); 248 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 249 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 250 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 251 break; 252 253 case BasicTestsQ31::TEST_ADD_Q31_2: 254 nb = 8; 255 ref.reload(BasicTestsQ31::REF_ADD_Q31_ID,mgr,nb); 256 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 257 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 258 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 259 break; 260 case BasicTestsQ31::TEST_ADD_Q31_3: 261 nb = 11; 262 ref.reload(BasicTestsQ31::REF_ADD_Q31_ID,mgr,nb); 263 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 264 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 265 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 266 break; 267 268 269 case BasicTestsQ31::TEST_SUB_Q31_4: 270 nb = 3; 271 ref.reload(BasicTestsQ31::REF_SUB_Q31_ID,mgr,nb); 272 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 273 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 274 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 275 break; 276 case BasicTestsQ31::TEST_SUB_Q31_5: 277 nb = 8; 278 ref.reload(BasicTestsQ31::REF_SUB_Q31_ID,mgr,nb); 279 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 280 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 281 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 282 break; 283 case BasicTestsQ31::TEST_SUB_Q31_6: 284 nb = 11; 285 ref.reload(BasicTestsQ31::REF_SUB_Q31_ID,mgr,nb); 286 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 287 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 288 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 289 break; 290 291 case BasicTestsQ31::TEST_MULT_Q31_7: 292 nb = 3; 293 ref.reload(BasicTestsQ31::REF_MULT_Q31_ID,mgr,nb); 294 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 295 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 296 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 297 break; 298 case BasicTestsQ31::TEST_MULT_Q31_8: 299 nb = 8; 300 ref.reload(BasicTestsQ31::REF_MULT_Q31_ID,mgr,nb); 301 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 302 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 303 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 304 break; 305 case BasicTestsQ31::TEST_MULT_Q31_9: 306 nb = 11; 307 ref.reload(BasicTestsQ31::REF_MULT_Q31_ID,mgr,nb); 308 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 309 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 310 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 311 break; 312 313 case BasicTestsQ31::TEST_NEGATE_Q31_10: 314 nb = 3; 315 ref.reload(BasicTestsQ31::REF_NEGATE_Q31_ID,mgr,nb); 316 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 317 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 318 break; 319 case BasicTestsQ31::TEST_NEGATE_Q31_11: 320 nb = 8; 321 ref.reload(BasicTestsQ31::REF_NEGATE_Q31_ID,mgr,nb); 322 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 323 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 324 break; 325 case BasicTestsQ31::TEST_NEGATE_Q31_12: 326 nb = 11; 327 ref.reload(BasicTestsQ31::REF_NEGATE_Q31_ID,mgr,nb); 328 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 329 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 330 break; 331 332 case BasicTestsQ31::TEST_OFFSET_Q31_13: 333 nb = 3; 334 ref.reload(BasicTestsQ31::REF_OFFSET_Q31_ID,mgr,nb); 335 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 336 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 337 break; 338 case BasicTestsQ31::TEST_OFFSET_Q31_14: 339 nb = 8; 340 ref.reload(BasicTestsQ31::REF_OFFSET_Q31_ID,mgr,nb); 341 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 342 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 343 break; 344 case BasicTestsQ31::TEST_OFFSET_Q31_15: 345 nb = 11; 346 ref.reload(BasicTestsQ31::REF_OFFSET_Q31_ID,mgr,nb); 347 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 348 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 349 break; 350 351 case BasicTestsQ31::TEST_SCALE_Q31_16: 352 nb = 3; 353 ref.reload(BasicTestsQ31::REF_SCALE_Q31_ID,mgr,nb); 354 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 355 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 356 break; 357 case BasicTestsQ31::TEST_SCALE_Q31_17: 358 nb = 8; 359 ref.reload(BasicTestsQ31::REF_SCALE_Q31_ID,mgr,nb); 360 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 361 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 362 break; 363 case BasicTestsQ31::TEST_SCALE_Q31_18: 364 nb = 11; 365 ref.reload(BasicTestsQ31::REF_SCALE_Q31_ID,mgr,nb); 366 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 367 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 368 break; 369 370 case BasicTestsQ31::TEST_DOT_PROD_Q31_19: 371 nb = 3; 372 dotRef.reload(BasicTestsQ31::REF_DOT_3_Q31_ID,mgr); 373 dotOutput.create(dotRef.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 374 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 375 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 376 break; 377 case BasicTestsQ31::TEST_DOT_PROD_Q31_20: 378 nb = 8; 379 dotRef.reload(BasicTestsQ31::REF_DOT_4N_Q31_ID,mgr); 380 dotOutput.create(dotRef.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 381 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 382 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 383 break; 384 case BasicTestsQ31::TEST_DOT_PROD_Q31_21: 385 nb = 11; 386 dotRef.reload(BasicTestsQ31::REF_DOT_4N1_Q31_ID,mgr); 387 dotOutput.create(dotRef.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 388 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 389 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 390 break; 391 392 case BasicTestsQ31::TEST_ABS_Q31_22: 393 nb = 3; 394 ref.reload(BasicTestsQ31::REF_ABS_Q31_ID,mgr,nb); 395 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 396 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 397 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 398 break; 399 case BasicTestsQ31::TEST_ABS_Q31_23: 400 nb = 8; 401 ref.reload(BasicTestsQ31::REF_ABS_Q31_ID,mgr,nb); 402 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 403 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 404 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 405 break; 406 case BasicTestsQ31::TEST_ABS_Q31_24: 407 nb = 11; 408 ref.reload(BasicTestsQ31::REF_ABS_Q31_ID,mgr,nb); 409 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 410 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 411 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 412 break; 413 414 case BasicTestsQ31::TEST_ADD_Q31_25: 415 input1.reload(BasicTestsQ31::MAXPOS_Q31_ID,mgr); 416 input2.reload(BasicTestsQ31::MAXPOS_Q31_ID,mgr); 417 ref.reload(BasicTestsQ31::REF_POSSAT_12_Q31_ID,mgr); 418 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 419 break; 420 421 case BasicTestsQ31::TEST_ADD_Q31_26: 422 input1.reload(BasicTestsQ31::MAXNEG_Q31_ID,mgr); 423 input2.reload(BasicTestsQ31::MAXNEG_Q31_ID,mgr); 424 ref.reload(BasicTestsQ31::REF_NEGSAT_13_Q31_ID,mgr); 425 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 426 break; 427 428 case BasicTestsQ31::TEST_SUB_Q31_27: 429 ref.reload(BasicTestsQ31::REF_POSSAT_14_Q31_ID,mgr); 430 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 431 input1.reload(BasicTestsQ31::MAXPOS_Q31_ID,mgr); 432 input2.reload(BasicTestsQ31::MAXNEG_Q31_ID,mgr); 433 break; 434 435 case BasicTestsQ31::TEST_SUB_Q31_28: 436 ref.reload(BasicTestsQ31::REF_NEGSAT_15_Q31_ID,mgr); 437 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 438 input1.reload(BasicTestsQ31::MAXNEG_Q31_ID,mgr); 439 input2.reload(BasicTestsQ31::MAXPOS_Q31_ID,mgr); 440 break; 441 442 case BasicTestsQ31::TEST_MULT_Q31_29: 443 ref.reload(BasicTestsQ31::REF_POSSAT_16_Q31_ID,mgr); 444 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 445 input1.reload(BasicTestsQ31::MAXNEG2_Q31_ID,mgr); 446 input2.reload(BasicTestsQ31::MAXNEG2_Q31_ID,mgr); 447 break; 448 449 case BasicTestsQ31::TEST_NEGATE_Q31_30: 450 ref.reload(BasicTestsQ31::REF_POSSAT_17_Q31_ID,mgr); 451 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 452 input1.reload(BasicTestsQ31::MAXNEG2_Q31_ID,mgr); 453 break; 454 455 case BasicTestsQ31::TEST_OFFSET_Q31_31: 456 ref.reload(BasicTestsQ31::REF_POSSAT_18_Q31_ID,mgr); 457 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 458 input1.reload(BasicTestsQ31::MAXPOS_Q31_ID,mgr); 459 /* 0.9 */ 460 this->scalar = 0x73333333; 461 break; 462 463 case BasicTestsQ31::TEST_OFFSET_Q31_32: 464 ref.reload(BasicTestsQ31::REF_NEGSAT_19_Q31_ID,mgr); 465 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 466 input1.reload(BasicTestsQ31::MAXNEG_Q31_ID,mgr); 467 /* -0.9 */ 468 this->scalar = 0x8ccccccd; 469 break; 470 471 case BasicTestsQ31::TEST_SCALE_Q31_33: 472 ref.reload(BasicTestsQ31::REF_POSSAT_20_Q31_ID,mgr); 473 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 474 input1.reload(BasicTestsQ31::MAXNEG2_Q31_ID,mgr); 475 /* Minus max*/ 476 this->scalar = 0x80000000; 477 break; 478 479 case BasicTestsQ31::TEST_SHIFT_Q31_34: 480 ref.reload(BasicTestsQ31::REF_SHIFT_21_Q31_ID,mgr); 481 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 482 input1.reload(BasicTestsQ31::INPUTRAND_Q31_ID,mgr); 483 break; 484 485 case BasicTestsQ31::TEST_SHIFT_Q31_35: 486 ref.reload(BasicTestsQ31::REF_SHIFT_POSSAT_22_Q31_ID,mgr); 487 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 488 input1.reload(BasicTestsQ31::MAXPOS_Q31_ID,mgr); 489 break; 490 491 case BasicTestsQ31::TEST_SHIFT_Q31_36: 492 ref.reload(BasicTestsQ31::REF_SHIFT_NEGSAT_23_Q31_ID,mgr); 493 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 494 input1.reload(BasicTestsQ31::MAXNEG_Q31_ID,mgr); 495 break; 496 497 case BasicTestsQ31::TEST_AND_U32_37: 498 nb = 3; 499 refLogical.reload(BasicTestsQ31::REF_AND_Q31_ID,mgr,nb); 500 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 501 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 502 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 503 break; 504 505 case BasicTestsQ31::TEST_AND_U32_38: 506 nb = 8; 507 refLogical.reload(BasicTestsQ31::REF_AND_Q31_ID,mgr,nb); 508 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 509 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 510 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 511 break; 512 case BasicTestsQ31::TEST_AND_U32_39: 513 nb = 11; 514 refLogical.reload(BasicTestsQ31::REF_AND_Q31_ID,mgr,nb); 515 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 516 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 517 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 518 break; 519 520 case BasicTestsQ31::TEST_OR_U32_40: 521 nb = 3; 522 refLogical.reload(BasicTestsQ31::REF_OR_Q31_ID,mgr,nb); 523 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 524 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 525 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 526 break; 527 528 case BasicTestsQ31::TEST_OR_U32_41: 529 nb = 8; 530 refLogical.reload(BasicTestsQ31::REF_OR_Q31_ID,mgr,nb); 531 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 532 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 533 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 534 break; 535 case BasicTestsQ31::TEST_OR_U32_42: 536 nb = 11; 537 refLogical.reload(BasicTestsQ31::REF_OR_Q31_ID,mgr,nb); 538 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 539 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 540 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 541 break; 542 543 case BasicTestsQ31::TEST_NOT_U32_43: 544 nb = 3; 545 refLogical.reload(BasicTestsQ31::REF_NOT_Q31_ID,mgr,nb); 546 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 547 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 548 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 549 break; 550 551 case BasicTestsQ31::TEST_NOT_U32_44: 552 nb = 8; 553 refLogical.reload(BasicTestsQ31::REF_NOT_Q31_ID,mgr,nb); 554 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 555 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 556 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 557 break; 558 case BasicTestsQ31::TEST_NOT_U32_45: 559 nb = 11; 560 refLogical.reload(BasicTestsQ31::REF_NOT_Q31_ID,mgr,nb); 561 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 562 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 563 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 564 break; 565 566 case BasicTestsQ31::TEST_XOR_U32_46: 567 nb = 3; 568 refLogical.reload(BasicTestsQ31::REF_XOR_Q31_ID,mgr,nb); 569 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 570 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 571 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 572 break; 573 574 case BasicTestsQ31::TEST_XOR_U32_47: 575 nb = 8; 576 refLogical.reload(BasicTestsQ31::REF_XOR_Q31_ID,mgr,nb); 577 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 578 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 579 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 580 break; 581 case BasicTestsQ31::TEST_XOR_U32_48: 582 nb = 11; 583 refLogical.reload(BasicTestsQ31::REF_XOR_Q31_ID,mgr,nb); 584 outputLogical.create(refLogical.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 585 inputLogical1.reload(BasicTestsQ31::INPUT1_BITWISE_Q31_ID,mgr,nb); 586 inputLogical2.reload(BasicTestsQ31::INPUT2_BITWISE_Q31_ID,mgr,nb); 587 break; 588 589 case BasicTestsQ31::TEST_ADD_Q31_49: 590 ref.reload(BasicTestsQ31::REF_ADD_Q31_ID,mgr,nb); 591 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 592 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 593 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 594 break; 595 596 case BasicTestsQ31::TEST_SUB_Q31_50: 597 ref.reload(BasicTestsQ31::REF_SUB_Q31_ID,mgr,nb); 598 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 599 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 600 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 601 break; 602 603 case BasicTestsQ31::TEST_MULT_Q31_51: 604 ref.reload(BasicTestsQ31::REF_MULT_Q31_ID,mgr,nb); 605 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 606 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 607 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 608 break; 609 610 case BasicTestsQ31::TEST_NEGATE_Q31_52: 611 ref.reload(BasicTestsQ31::REF_NEGATE_Q31_ID,mgr,nb); 612 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 613 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 614 break; 615 616 case BasicTestsQ31::TEST_OFFSET_Q31_53: 617 ref.reload(BasicTestsQ31::REF_OFFSET_Q31_ID,mgr,nb); 618 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 619 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 620 break; 621 622 case BasicTestsQ31::TEST_SCALE_Q31_54: 623 ref.reload(BasicTestsQ31::REF_SCALE_Q31_ID,mgr,nb); 624 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 625 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 626 break; 627 628 case BasicTestsQ31::TEST_DOT_PROD_Q31_55: 629 dotRef.reload(BasicTestsQ31::REF_DOT_LONG_Q31_ID,mgr); 630 dotOutput.create(dotRef.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 631 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 632 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 633 break; 634 635 case BasicTestsQ31::TEST_ABS_Q31_56: 636 ref.reload(BasicTestsQ31::REF_ABS_Q31_ID,mgr,nb); 637 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 638 input1.reload(BasicTestsQ31::INPUT1_Q31_ID,mgr,nb); 639 input2.reload(BasicTestsQ31::INPUT2_Q31_ID,mgr,nb); 640 break; 641 642 643 case BasicTestsQ31::TEST_CLIP_Q31_57: 644 ref.reload(BasicTestsQ31::REF_CLIP1_Q31_ID,mgr); 645 input1.reload(BasicTestsQ31::INPUT_CLIP_Q31_ID,mgr,ref.nbSamples()); 646 647 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 648 // Must be coherent with Python script used to generate test patterns 649 this->min=0xC0000000; 650 this->max=0xF3333333; 651 break; 652 653 case BasicTestsQ31::TEST_CLIP_Q31_58: 654 ref.reload(BasicTestsQ31::REF_CLIP2_Q31_ID,mgr); 655 input1.reload(BasicTestsQ31::INPUT_CLIP_Q31_ID,mgr,ref.nbSamples()); 656 657 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 658 // Must be coherent with Python script used to generate test patterns 659 this->min=0xC0000000; 660 this->max=0x40000000; 661 break; 662 663 case BasicTestsQ31::TEST_CLIP_Q31_59: 664 ref.reload(BasicTestsQ31::REF_CLIP3_Q31_ID,mgr); 665 input1.reload(BasicTestsQ31::INPUT_CLIP_Q31_ID,mgr,ref.nbSamples()); 666 667 output.create(ref.nbSamples(),BasicTestsQ31::OUT_SAMPLES_ID,mgr); 668 // Must be coherent with Python script used to generate test patterns 669 this->min=0x0CCCCCCD; 670 this->max=0x40000000; 671 break; 672 673 } 674 675 676 677 678 } 679 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)680 void BasicTestsQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 681 { 682 switch(id) 683 { 684 case BasicTestsQ31::TEST_DOT_PROD_Q31_19: 685 case BasicTestsQ31::TEST_DOT_PROD_Q31_20: 686 case BasicTestsQ31::TEST_DOT_PROD_Q31_21: 687 case BasicTestsQ31::TEST_DOT_PROD_Q31_55: 688 dotOutput.dump(mgr); 689 break; 690 691 case BasicTestsQ31::TEST_AND_U32_37: 692 case BasicTestsQ31::TEST_AND_U32_38: 693 case BasicTestsQ31::TEST_AND_U32_39: 694 case BasicTestsQ31::TEST_OR_U32_40: 695 case BasicTestsQ31::TEST_OR_U32_41: 696 case BasicTestsQ31::TEST_OR_U32_42: 697 case BasicTestsQ31::TEST_NOT_U32_43: 698 case BasicTestsQ31::TEST_NOT_U32_44: 699 case BasicTestsQ31::TEST_NOT_U32_45: 700 case BasicTestsQ31::TEST_XOR_U32_46: 701 case BasicTestsQ31::TEST_XOR_U32_47: 702 case BasicTestsQ31::TEST_XOR_U32_48: 703 outputLogical.dump(mgr); 704 break; 705 706 default: 707 output.dump(mgr); 708 } 709 710 711 } 712