mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
added BCH(31, 16) T=3 for testing
This commit is contained in:
parent
945da60cbd
commit
6045870288
4 changed files with 30 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue