Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

SPUC::CRC_Code Class Reference
[Forward Error Correcting Codes]

Cyclic Redundancy Check Codes. More...

#include <crc.h>

List of all members.

Public Member Functions

 CRC_Code ()
 Default Constructor.
 CRC_Code (const 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 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.


Detailed Description

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:

 [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);


Constructor & Destructor Documentation

SPUC::CRC_Code::CRC_Code  )  [inline]
 

Default Constructor.

SPUC::CRC_Code::CRC_Code const string &  code  )  [inline]
 

Set CRC code to one of the standardpolynomials using the string value.

Parameters:
code Possible values: CRC-4, CRC-7, CRC-8, CRC-12, CRC-24, CRC-32, CCITT-4, CCITT-5, CCITT-6, CCITT-16, CCITT-32, WCDMA-8, WCDMA-12, WCDMA-16, WCDMA-24, ATM-8, ANSI-16, SDLC-16

Here is the call graph for this function:


Member Function Documentation

bool CRC_Code::check_parity const bvec &  coded_bits  ) 
 

Return true if parity checks OK otherwise flase.

bool CRC_Code::decode bvec &  bits  ) 
 

Return true if parity checks OK otherwise flase. Also returns the message part in bits.

bool CRC_Code::decode const bvec &  coded_bits,
bvec &  out
 

Return true if parity checks OK otherwise flase. Also returns the message part in out.

bvec CRC_Code::encode const bvec &  in_bits  ) 
 

Returns the in_bits vector with parity added.

void CRC_Code::encode const bvec &  in_bits,
bvec &  out
 

Calculate and add parity to the in_bits.

void CRC_Code::parity const bvec &  in_bits,
bvec &  out
 

Calulate the parity bits.

void CRC_Code::set_code const string &  code  ) 
 

Set CRC code to one of the standardpolynomials using the string value.

void CRC_Code::set_generator const bvec &  poly  ) 
 

Set an arbitary polynomial in bvec form. Start with highest order terms.


The documentation for this class was generated from the following files:
Generated on Fri Sep 16 11:07:39 2005 for spuc by  doxygen 1.4.4