-
Notifications
You must be signed in to change notification settings - Fork 0
/
code_config.h
51 lines (41 loc) · 1.43 KB
/
code_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#define CODE_HAMMING 1
#define CODE_REPETITION 2
#define CODE_GOLAY 3
// --------- CONFIGURATION ------------ //
#define USED_CODE CODE_HAMMING // 1 = Hamming, 2 = Repetition
#if USED_CODE == CODE_HAMMING
#ifndef HAMMING_CONFIG
#define HAMMING_CONFIG
// Hamming configuration
#define M 7 // Hamming parameter <= 8
#define N (1 << M) - 1 // Length of the encoded words
#define K (N - M) // Length of the data word (without encoding)
#define SIZE_SYNDROME_ARRAY 1
#endif
#elif USED_CODE == CODE_REPETITION
#ifndef REPETITION_CONFIG
#define REPETITION_CONFIG
// Repetition code configuration
#define M 2 // Size of packets
#define N (M * 3) // Length of the encoded words
#define K (M) // Length of the data word (without encoding)
#define SIZE_SYNDROME_ARRAY 2
#endif
#elif USED_CODE == CODE_GOLAY
#ifndef GOLAY_CONFIG
#define GOLAY_CONFIG
// Repetition code configuration
#define N 23 // Length of the encoded words
#define K 12 // Length of the data word (without encoding)
#define SIZE_SYNDROME_ARRAY 3
#endif
#endif // USED_CODE
#if USED_CODE == CODE_HAMMING
#if M > 8
#error The hamming parameter must be inferior to 8
#endif // M
#elif USED_CODE == CODE_REPETITION
#if M > 4
#error The repetition parameter must be inferior to 4
#endif // M
#endif // USED_CODE