XCORE SDK
XCORE Software Development Kit
tst_common.h
1 // Copyright 2020-2021 XMOS LIMITED.
2 // This Software is subject to the terms of the XMOS Public Licence: Version 1.
3 
4 #pragma once
5 
6 #include <stdint.h>
7 #include <stdio.h>
8 
9 #include "bfp_math.h"
10 #include "test_random.h"
11 #include "pseudo_rand.h"
12 #include "rand_frame.h"
13 
14 #define SET_TEST_FILE() Unity.TestFile = __FILE__
15 
16 #ifndef PRINT_FUNC_NAMES
17 # ifdef __xcore__
18 # define PRINT_FUNC_NAMES 1
19 # else
20 # define PRINT_FUNC_NAMES 0
21 # endif
22 #endif
23 
24 #ifndef PRINT_ERRORS
25 # define PRINT_ERRORS 0
26 #endif
27 
28 #ifndef TIME_FUNCS
29 # ifdef __xcore__
30 # define TIME_FUNCS 1
31 # else
32 # define TIME_FUNCS 0
33 # endif
34 #endif
35 
36 #ifndef WRITE_PERFORMANCE_INFO
37 # ifdef __xcore__
38 # define WRITE_PERFORMANCE_INFO 1
39 # else
40 # define WRITE_PERFORMANCE_INFO 0
41 # endif
42 #endif
43 
44 #ifndef PERFORMANCE_INFO_FILENAME
45 # define PERFORMANCE_INFO_FILENAME "perf_info.csv"
46 #endif
47 
48 #define TEST_ASSERT_CONVERSION(V) do{ \
49  char qwe[100]; if((V)){ sprintf(qwe, "Conversion failure (0x%X)", (V)); \
50  TEST_ASSERT_FALSE_MESSAGE(V, qwe); }} while(0)
51 
52 
53 EXTERN_C
54 static inline signed sext(int a, unsigned b){
55 
56 #if !defined(__XC__) && defined(__XS3A__)
57  asm("sext %0, %1": "=r"(a): "r"(b));
58 #else
59  unsigned mask = ~((1<<b)-1);
60 
61  unsigned p = a >= 0;
62  a = p? (a & ~mask) : (a | mask);
63 #endif
64 
65  return a;
66 }
67 
68 
69 extern FILE* perf_file;
70 
71 EXTERN_C
72 void xs3_fft_index_bit_reversal_double(
74  const unsigned length);
75 
A complex number with a double-precision floating-point real part and a double-precision floating-poi...
Definition: xs3_math_types.h:409