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:
- Data (Message): The raw binary data that needs error-check detection.
- Generator Polynomial: A polynomial, typically denoted as , that serves as a divisor in calculating CRC. The coefficients of the polynomial are either 0 or 1.
- 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 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:
- Append Zeros: Append zeros to the end of the data, where is the degree of the polynomial.
- Binary Division: Divide the data appended with zeros by the generator polynomial.
- Obtain Remainder: The remainder of this division is the CRC value.
- 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 )
Steps:
- Append Zeros: • Message: 1101 + 000 (Three zeros are appended since the polynomial degree is 3) • Result: 1101000
- Binary Division: Divide 1101000 by 1011 using binary XOR operation:• Perform binary subtraction: • 1101 (first 4 bits of 1101000) 1011 = 0110 • Bring down the next bit: 0110
1= 01101 • 01101 1011 = 0100 • Continue the operation until all bits are processed or you reach a lesser degree than the divisor. - Get the Remainder: • The final remainder is the CRC value. In this case: 100
- 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 Type | Generator Polynomial | Polynomial Representation |
| CRC-8 | 100000111 | |
| CRC-16 | 11000000000000101 | |
| CRC-32 | 100000100110000010001110110110111 |
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.

