added BCH(31, 16) T=3 for testing

This commit is contained in:
Ahmet Inan 2020-06-15 07:33:21 +02:00
commit 6045870288
4 changed files with 30 additions and 0 deletions

View file

@ -53,6 +53,19 @@ int main()
int recovered = decode(damaged);
assert(recovered == target);
}
if (1) {
// BCH(31, 16) T=3
const int N = 31, K = 16, T = 3, POLY = 0b1000111110101111;
CODE::ShortBCHCodeDecoder<N, K, POLY, T> decode;
int target = 970576025;
int damaged = target;
typedef std::uniform_int_distribution<int> distribution;
auto epos = std::bind(distribution(0, N-1), generator);
for (int i = 0; i < T; ++i)
damaged ^= 1 << epos();
int recovered = decode(damaged);
assert(recovered == target);
}
std::cerr << "Short BCH code decoder test passed!" << std::endl;
return 0;
}

View file

@ -54,6 +54,10 @@ int main()
// NASA INTRO BCH(15, 5) T=3
bch_test<15, 5, 3, 0b10100110111>(0b11001, 0b110010001111010);
}
if (1) {
// BCH(31, 16) T=3
bch_test<31, 16, 3, 0b1000111110101111>(29619, 970576025);
}
std::cerr << "Short BCH code encoder test passed!" << std::endl;
return 0;
}

View file

@ -49,6 +49,10 @@ int main()
// NASA INTRO BCH(15, 5) T=3
bch_test<15, 5, 3, 0b10100110111>(1000000);
}
if (1) {
// BCH(31, 16) T=3
bch_test<31, 16, 3, 0b1000111110101111>(1000000);
}
std::cerr << "Short BCH code regression test passed!" << std::endl;
return 0;
}

View file

@ -51,6 +51,15 @@ int popcnt(TYPE x)
const int RADIUS_T = 3;
const int GEN_POLY = 0b10100110111;
#endif
#if 0
// BCH(31, 16) T=3
const int LOOPS = 50000;
const float QEF_SNR = 6.5;
const int CODE_LEN = 31;
const int DATA_LEN = 16;
const int RADIUS_T = 3;
const int GEN_POLY = 0b1000111110101111;
#endif
int main()
{