#include <itpp/comm/crc.h>
Public Member Functions | |
CRC_Code () | |
Default Constructor. | |
CRC_Code (const std::string &code) | |
Set CRC code to one of the standardpolynomials using the string value. | |
void | set_generator (const bvec &poly) |
Set an arbitary polynomial in bvec form. Start with highest order terms. | |
void | set_code (const std::string &code) |
Set CRC code to one of the standardpolynomials using the string value. | |
void | parity (const bvec &in_bits, bvec &out) |
Calulate the parity bits. | |
bool | check_parity (const bvec &coded_bits) |
Return true if parity checks OK otherwise flase. | |
void | encode (const bvec &in_bits, bvec &out) |
Calculate and add parity to the in_bits. | |
bvec | encode (const bvec &in_bits) |
Returns the in_bits vector with parity added. | |
bool | decode (const bvec &coded_bits, bvec &out) |
Return true if parity checks OK otherwise flase. Also returns the message part in out. | |
bool | decode (bvec &bits) |
Return true if parity checks OK otherwise flase. Also returns the message part in bits. |
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:
[b(1), b(2), ..., b(k), p(1), p(2), ..., p(n-k)]
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:
[b(1), b(2), ..., b(k), p(n-k), ..., p(2), p(1)]
Usage:
CRC_Code crc(string("CRC-4")); bvec bits = randb(10), coded_bits, decoded_bits; bool error; coded_bits = crc.encode(bits); error = crc.decode(rec_bits, decoded_bits);
Definition at line 67 of file crc.h.
|
Default Constructor.
|
|
Set CRC code to one of the standardpolynomials using the string value.
Definition at line 80 of file crc.h. References set_code(). |
|
Set an arbitary polynomial in bvec form. Start with highest order terms.
Definition at line 40 of file crc.cpp. References it_assert, and itpp::poly(). |
|
Set CRC code to one of the standardpolynomials using the string value.
Definition at line 73 of file crc.cpp. References itpp::poly(). Referenced by CRC_Code(). |
|
Calulate the parity bits.
Definition at line 90 of file crc.cpp. References itpp::concat(), and itpp::zeros_b(). Referenced by encode(). |
|
Return true if parity checks OK otherwise flase.
Definition at line 109 of file crc.cpp. References itpp::concat(), and itpp::reverse(). Referenced by decode(). |
|
Calculate and add parity to the in_bits.
Definition at line 132 of file crc.cpp. References itpp::concat(), and parity(). Referenced by encode(). |
|
Returns the in_bits vector with parity added.
Definition at line 139 of file crc.cpp. References encode(). |
|
Return true if parity checks OK otherwise flase. Also returns the message part in out.
Definition at line 146 of file crc.cpp. References check_parity(). |
|
Return true if parity checks OK otherwise flase. Also returns the message part in bits.
Definition at line 155 of file crc.cpp. References check_parity(). |
Generated on Thu Apr 19 14:20:03 2007 for IT++ by Doxygen 1.4.6