mirror of
https://github.com/aicodix/modem.git
synced 2026-04-27 14:30:34 +00:00
added 16 bit CRC
This commit is contained in:
parent
675ee7b024
commit
b8fb5e7dd6
3 changed files with 9 additions and 8 deletions
|
|
@ -32,7 +32,8 @@ struct Common
|
|||
static constexpr int slm_poly[16] = {
|
||||
0x11d, 0x12b, 0x12d, 0x14d, 0x15f, 0x163, 0x165, 0x169,
|
||||
0x171, 0x187, 0x18d, 0x1a9, 0x1c3, 0x1cf, 0x1e7, 0x1f5 };
|
||||
CODE::CRC<uint32_t> crc0;
|
||||
CODE::CRC<uint16_t> crc0;
|
||||
CODE::CRC<uint32_t> crc1;
|
||||
CODE::HadamardEncoder<6> hadamard_encoder;
|
||||
int8_t head[32];
|
||||
int8_t tail[32];
|
||||
|
|
@ -49,7 +50,7 @@ struct Common
|
|||
int symbol_count;
|
||||
bool differential;
|
||||
|
||||
Common() : crc0(0x8F6E37A0) {}
|
||||
Common() : crc0(0xA8F4), crc1(0x8F6E37A0) {}
|
||||
|
||||
void setup(int mode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -372,10 +372,10 @@ struct Decoder : Common
|
|||
polar_decoder(nullptr, mesg, code, frozen_bits, code_order);
|
||||
int best = -1;
|
||||
for (int k = 0; k < mesg_type::SIZE; ++k) {
|
||||
crc0.reset();
|
||||
crc1.reset();
|
||||
for (int i = 0; i < crc_bits; ++i)
|
||||
crc0(mesg[i].v[k] < 0);
|
||||
if (crc0() == 0) {
|
||||
crc1(mesg[i].v[k] < 0);
|
||||
if (crc1() == 0) {
|
||||
best = k;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,11 +273,11 @@ struct Encoder : public Common
|
|||
schmidl_cox();
|
||||
for (int i = 0; i < data_bits; ++i)
|
||||
mesg[i] = nrz(CODE::get_le_bit(data, i));
|
||||
crc0.reset();
|
||||
crc1.reset();
|
||||
for (int i = 0; i < data_bytes; ++i)
|
||||
crc0(data[i]);
|
||||
crc1(data[i]);
|
||||
for (int i = 0; i < 32; ++i)
|
||||
mesg[i+data_bits] = nrz((crc0()>>i)&1);
|
||||
mesg[i+data_bits] = nrz((crc1()>>i)&1);
|
||||
polar_encoder(code, mesg, frozen_bits, code_order);
|
||||
shuffle(perm, code, code_order);
|
||||
CODE::MLS seq1(mls1_poly);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue