Cyclic Redundancy Check Codes. More...
#include <itpp/comm/crc.h>
Public Member Functions | |
CRC_Code () | |
Default Constructor. More... | |
CRC_Code (const std::string &code) | |
Set CRC code to one of the standardpolynomials using the string value. More... | |
void | set_generator (const bvec &poly) |
Set an arbitary polynomial in bvec form. Start with highest order terms. More... | |
void | set_code (const std::string &code) |
Set CRC code to one of the standardpolynomials using the string value. More... | |
void | parity (const bvec &in_bits, bvec &out) const |
Calulate the parity bits. More... | |
bool | check_parity (const bvec &coded_bits) const |
Return true if parity checks OK otherwise flase. More... | |
void | encode (const bvec &in_bits, bvec &out) const |
Calculate and add parity to the in_bits. More... | |
bvec | encode (const bvec &in_bits) const |
Returns the in_bits vector with parity added. More... | |
bool | decode (const bvec &coded_bits, bvec &out) const |
Return true if parity checks OK otherwise flase. Also returns the message part in out. More... | |
bool | decode (bvec &bits) const |
Return true if parity checks OK otherwise flase. Also returns the message part in bits. More... | |
Cyclic Redundancy Check Codes.
This class will add the CRC bits after each input word. With b(i) denoting the i-th input bit and p(i) the i-th parity check bit, the order of the outbut bits will be:
When the WCDMA CRC polynomials are used, this class will reverse the order of the parity check bits in order to comply to the WCDMA standard. Thus for the polynomials WCDMA-8, WCDMA-12, WCDMA-16, and WCDMA-24 the output will be:
Usage:
|
inline |
void itpp::CRC_Code::set_generator | ( | const bvec & | poly | ) |
Set an arbitary polynomial in bvec form. Start with highest order terms.
Definition at line 37 of file crc.cpp.
References it_assert, and itpp::poly().
Referenced by set_code().
void itpp::CRC_Code::set_code | ( | const std::string & | code | ) |
Set CRC code to one of the standardpolynomials using the string value.
Definition at line 70 of file crc.cpp.
References it_assert, itpp::poly(), and set_generator().
void itpp::CRC_Code::parity | ( | const bvec & | in_bits, |
bvec & | out | ||
) | const |
Calulate the parity bits.
Definition at line 87 of file crc.cpp.
References itpp::concat(), itpp::reverse(), and itpp::zeros_b().
Referenced by encode().
bool itpp::CRC_Code::check_parity | ( | const bvec & | coded_bits | ) | const |
Return true if parity checks OK otherwise flase.
Definition at line 106 of file crc.cpp.
References itpp::concat(), itpp::reverse(), and itpp::zeros_b().
Referenced by decode().
void itpp::CRC_Code::encode | ( | const bvec & | in_bits, |
bvec & | out | ||
) | const |
Calculate and add parity to the in_bits.
Definition at line 130 of file crc.cpp.
References itpp::concat(), and parity().
Referenced by encode().
bvec itpp::CRC_Code::encode | ( | const bvec & | in_bits | ) | const |
bool itpp::CRC_Code::decode | ( | const bvec & | coded_bits, |
bvec & | out | ||
) | const |
Return true if parity checks OK otherwise flase. Also returns the message part in out.
Definition at line 144 of file crc.cpp.
References check_parity().
bool itpp::CRC_Code::decode | ( | bvec & | bits | ) | const |
Return true if parity checks OK otherwise flase. Also returns the message part in bits.
Definition at line 154 of file crc.cpp.
References check_parity().
Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.4