CRC
divisor calculation
cyclic redundancy check
error detection
data integrity

CRC divisor calculation

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Cyclic Redundancy Check (CRC) is a popular error-detecting code that is commonly used in digital networks and storage devices to detect accidental changes to raw data. Each transmission or storage operation computes a short, fixed-size binary sequence known as a checksum or CRC value for a block of data. If any bits are changed in the data during transmission or storage, recalculating the CRC value with the new data sequence will yield a different checksum value, thus revealing the presence of errors.

CRC Basics

Before diving into CRC divisor calculation, it is essential to understand the basic components of a CRC:

  1. Data (Message): The raw binary data that needs error-check detection.
  2. Generator Polynomial: A polynomial, typically denoted as G(x)G(x), that serves as a divisor in calculating CRC. The coefficients of the polynomial are either 0 or 1.
  3. CRC Codeword: The outcome after combining original data with the calculated CRC value to assure data integrity.

CRC Divisor Calculation

Understanding Generator Polynomial

A generator polynomial G(x)G(x) can be represented as a binary number. The degree of the polynomial determines the length of the CRC value. For instance, if the polynomial is of degree 3, the CRC value will be 4 bits long.

Calculation Process

The calculation of CRC involves binary division without carrying, using the generator polynomial as the divisor. The steps are as follows:

  1. Append Zeros: Append nn zeros to the end of the data, where nn is the degree of the polynomial.
  2. Binary Division: Divide the data appended with zeros by the generator polynomial.
  3. Obtain Remainder: The remainder of this division is the CRC value.
  4. Form CRC Codeword: Append the CRC value to the original data to create the complete CRC codeword.

Example Calculation

Let’s explore a simple example to understand CRC divisor calculation:

Example Data

Original Message: 1101 • Generator Polynomial: 1011 (Representing x3+x+1x^3 + x + 1)

Steps:

  1. Append Zeros: • Message: 1101 + 000 (Three zeros are appended since the polynomial degree is 3) • Result: 1101000
  2. Binary Division: Divide 1101000 by 1011 using binary XOR operation:
    • Perform binary subtraction: • 1101 (first 4 bits of 1101000) \oplus 1011 = 0110 • Bring down the next bit: 0110 1 = 01101 • 01101 \oplus 1011 = 0100 • Continue the operation until all bits are processed or you reach a lesser degree than the divisor.
  3. Get the Remainder: • The final remainder is the CRC value. In this case: 100
  4. Form CRC Codeword: • Append the CRC value to the original message: 1101 + 100 = 1101100

Key Points

• Division operation in CRC involves XOR operation rather than simple subtraction. • The appended zeros are based on the degree of the polynomial. • CRC is generally optimized for hardware implementations using shift registers and XOR gates.

Common CRC Types and Generator Polynomials

CRC can be characterized by the size of the CRC value, which also influences the choice of generator polynomial. Here are some common CRC standards:

CRC TypeGenerator PolynomialPolynomial Representation
CRC-8100000111x8+x2+x+1x^8 + x^2 + x + 1
CRC-1611000000000000101x16+x15+x2+1x^{16} + x^{15} + x^2 + 1
CRC-32100000100110000010001110110110111x32+x26+x23+x22++1x^{32} + x^{26} + x^{23} + x^{22} + \ldots + 1

Enhancing CRC Computations

Polynomial Selection

Length: Longer polynomials can detect more extended error patterns but require more computation. • Choice: The choice of polynomial affects the error detection capability. Common choices like CRC-32 have been optimized for typical error patterns.

Implementations & Use-cases

Networking Protocols: Ethernet uses CRC-32 for error detection. • File Formats: PNG and ZIP files use CRCs to verify file integrity. • Error Probabilities: Proper selection of polynomial can significantly reduce undetected error probabilities.

Conclusion

CRC remains a cornerstone in error detection thanks to its simplicity and effectiveness. Understanding the fundamentals of CRC computation, specifically the role of the generator polynomial and effective divisor calculation, can greatly aid in implementing robust systems capable of detecting errors during data transmission or storage. The selection of the polynomial and the specific CRC variation should align with the anticipated error conditions and the system's integrity requirements.


Course illustration
Course illustration

All Rights Reserved.