During transmission, physical electromagnetic signals are vulnerable to interference, noise, and attenuation. These impairments can change the logical values of bits, leading to data corruption that must be systematically managed.
In physical transmission media, thermal noise, transient electromagnetic interference, and signal attenuation can alter the state of transmitted bits. Error control represents a suite of protocols and mathematical techniques designed to preserve data integrity across unreliable channels.
Errors are classified into two primary categories based on the distribution and alignment of corrupted bits:
Original Data: [ 1 ] [ 0 ] [ 1 ] [ 1 ] [ 0 ] [ 1 ] [ 1 ] [ 0 ]
| (Noisy Spike)
v
Corrupted Data: [ 1 ] [ 0 ] [ 1 ] [ 0 ] [ 0 ] [ 1 ] [ 1 ] [ 0 ]
^ (Only 1 bit altered)Original: [ 1 ] [ 0 ] [ 1 ] [ 1 ] [ 0 ] [ 1 ] [ 1 ] [ 0 ] [ 1 ] [ 0 ]
| |
+---------------+ | (Electromagnetic Burst)
v v
Corrupted: [ 1 ] [ 1 ] [ 1 ] [ 1 ] [ 1 ] [ 1 ] [ 1 ] [ 1 ] [ 1 ] [ 0 ]
^ ^
|<------------ Burst Length L = 8 ----------->|To detect or correct errors, additional, non-payload bits must be transmitted alongside the raw data. These are referred to as redundant bits. The mapping process is executed by an encoder at the sender site, and the validation/extraction is performed by a decoder at the receiver site.
Sender Site Receiver Site
+------------------+ +--------------------+
| Dataword | | Decoded Dataword |
+--------+---------+ +---------^----------+
| |
v | (If no error
+--------+---------+ | or corrected)
| Encoder | |
+--------+---------+ +---------+----------+
| |
v (Codeword) | (Syndrome
+--------+---------+ | Calculation)
| Transmitter | +---------+----------+
+--------+---------+ | Decoder |
| +---------^----------+
| |
v |
~~~~~~~~~~~~~~~~~ Noisy Physical Link ~~~~~~~~~~~~~
| |
+----------------------------------------+ (Received Codeword)In block coding, the continuous bitstream is partitioned into blocks of bits, designated as datawords. The encoder appends redundant bits to each dataword, producing an -bit block called a codeword, where:
The total number of possible datawords is . The total number of possible codewords is . Because , only of the possible codewords are codewords. The remaining bit patterns represent codewords.
If a receiver receives an invalid codeword, it immediately knows an error occurred. If the corrupted codeword maps to a different, valid codeword, the error remains undetected.
The robust mathematical foundation of block coding rests upon the metric of distance between distinct binary sequences.
The Hamming distance between two binary words and of equal length is defined as the number of positions at which the corresponding bits differ. Mathematically, this is equivalent to the number of s (Hamming weight) in the bitwise exclusive-OR () of the two words:
For example, to find the Hamming distance between and :
The number of s in is , meaning .
The minimum Hamming distance () of a block code is the smallest Hamming distance between all possible pairs of valid codewords in the code set:
where and are valid codewords in the code.
To guarantee the detection of up to errors in any transmission, the minimum Hamming distance of the code must satisfy:
If the minimum distance between any two valid codewords is , changing up to bits in a valid codeword will yield an invalid codeword . It is geometrically impossible for errors to shift far enough to reach another valid codeword , since the closest valid codeword is at least steps away. Thus, the invalid codeword will fall in the "empty space" between valid codewords and will be detected by the decoder.
[ Valid Codeword C_1 ] <------- Distance d_min >= s + 1 -------> [ Valid Codeword C_2 ]
|
| (s bit errors occur)
v
[ Received Word C' ] (Guaranteed to be Invalid)To guarantee the correction of up to errors in any transmission, the minimum Hamming distance of the code must satisfy:
If we construct a "sphere of correction" with a radius of around each valid codeword, any received word containing up to errors will fall uniquely within the sphere of its original codeword. To prevent these spheres of radius from overlapping, the distance between any two valid codewords (the centers of the spheres) must be strictly greater than the sum of their radii:
If were less than , a word with errors could fall within the overlapping region of two spheres, making unique correction impossible.
Sphere of Radius t Sphere of Radius t
/-------------------------\ /-------------------------\
/ \ / \
| * Valid Codeword C_1 | | * Valid Codeword C_2 |
| \ | | |
\ \ t errors / \ /
\------------v------------/ \------------------------/
Received Word C'A block code is classified as a linear block code if and only if the exclusive OR (addition modulo-2) of any two valid codewords in the code yields another valid codeword.
Let be a linear block code. Then:
A critical consequence of this linearity is that the minimum Hamming distance of a linear block code is equal to the minimum Hamming weight (the number of non-zero bits) among all non-zero codewords:
The simplest linear block code is the simple parity-check code , which appends a single redundant bit () to a -bit dataword.
The syndrome computed at the receiver is:
If , the transmission is assumed to be error-free. If , an odd number of errors has occurred.
Hamming codes are a highly structured class of linear block codes designed with a minimum Hamming distance . This allows them to guarantee the correction of any single-bit error () or the detection of up to double-bit errors ().
The structural parameters of Hamming codes are governed by the number of parity bits :
Let us analyze the standard code where . Here, and . The bits of the codeword are labeled from left to right as (corresponding to positions ).
The redundant bits are placed at positions that are powers of two:
The data bits are mapped to the remaining positions:
The parity generator equations (using even parity) are:
At the receiver, the decoder calculates a 3-bit syndrome using the received bits :
If , no single-bit error is present. If , the binary value of the syndrome directly indicates the decimal index of the corrupted bit position (1 to 7).
| Syndrome | Corrupted Position | Error Type | | :---: | :---: | :---: | | | None | No Error | | | 1 | Parity bit | | | 2 | Parity bit | | | 3 | Data bit | | | 4 | Parity bit | | | 5 | Data bit | | | 6 | Data bit | | | 7 | Data bit |
Cyclic codes are a specialized category of linear block codes that possess an additional structural property: if a codeword is cyclically shifted (rotated), the resulting sequence is also a valid codeword.
In cyclic code analysis, binary bit patterns are represented as polynomials in a single dummy variable . The powers of correspond to the positional indices of the bits, and the coefficients ( or ) represent the bit values.
For example, the binary sequence contains bits. It is represented as:
All mathematical operations on these polynomials are executed using modulo-2 arithmetic:
The most common application of cyclic codes is the Cyclic Redundancy Check (CRC).
where is the quotient and is the remainder of degree less than . 5. The remainder represents the cyclic redundant bits. The transmitted codeword polynomial is constructed as:
Because is constructed by subtracting (or ing) the remainder from the dividend, is guaranteed to be perfectly divisible by without remainder.
Sender CRC Encoder Division
1101 (Quotient q(x))
----------------
Generator g(x) -> 1011 | 1001000 (Dataword appended with r = 3 zeros)
(x^3 + x + 1) 1011
----
0100
0000
----
1000
1011
----
0110
0000
----
110 (Remainder s(x) = 3 redundant bits)The computed remainder is appended to the dataword , yielding the transmitted codeword: .
The receiver gets a sequence represented by the polynomial . The validation process involves dividing by the known generator polynomial :
The remainder polynomial is the syndrome.
An error pattern can be represented as an error polynomial , such that:
The syndrome division yields:
Since is perfectly divisible by , the syndrome is determined entirely by the error polynomial:
An error goes undetected if and only if is perfectly divisible by . This mathematical property allows us to design generator polynomials with highly specific detection capabilities:
The checksum is a low-overhead, software-friendly error detection method primarily employed at the network and transport layers of the TCP/IP suite (e.g., in IPv4, UDP, and TCP headers), rather than at the hardware-centric data link layer.
In -bit one's complement arithmetic:
Let us add () and () in a 4-bit one's complement system:
Wrap the leftmost carry bit () to the least significant position:
Alternatively, subtracting () from the normal sum () yields the same result.
The negative of a number in one's complement is found by bitwise inversion (notting every bit):
The sender and receiver apply a structured process to calculate and verify the checksum.
Sender Site Receiver Site
+---------------------------------+ +---------------------------------+
| Split data into k-bit words | | Split data into k-bit words |
| (checksum field set to 0) | | (includes received checksum) |
+----------------+----------------+ +----------------+----------------+
| |
v v
+---------------------------------+ +---------------------------------+
| Add all words using 1's comp. | | Add all words using 1's comp. |
+----------------+----------------+ +----------------+----------------+
| |
v v
+---------------------------------+ +---------------------------------+
| Complement the resulting sum | | Complement the resulting sum |
| (This is the Checksum) | | (The Syndrome value) |
+----------------+----------------+ +----------------+----------------+
| |
v v
+---------------------------------+ +---------------------------------+
| Transmit packet with checksum | | If 0: Accept data |
+---------------------------------+ | Else: Discard packet |
+---------------------------------+Suppose our payload data consists of four 8-bit blocks (): 0xF0, 0x34, 0x12, and 0xAB.
Apply end-around carry:
Add :
Add :
The final one's complement sum is 1110 0010.
2. Invert the sum to compute the checksum:
The sender transmits the data words along with the checksum 0x1D.
0xF0, 0x34, 0x12, 0xAB, and the checksum 0x1D):
Since the syndrome is 0x00, the receiver confirms that no errors were detected and accepts the packet.
A single-bit error alters exactly one bit in a data unit, whereas a burst error alters two or more adjacent or non-adjacent bits within a specific span.
The Hamming distance between two binary words is the number of differences between corresponding bits. The minimum Hamming distance ($d_{\min}$) of a code determines its error-detection and error-correction capabilities.
A class of error-control codes where the exclusive OR (modulo-2 addition) of any two valid codewords yields another valid codeword.
An error-detection mechanism based on cyclic codes and binary division, where a generator polynomial divides the data polynomial to compute a remainder used as redundant bits.
An error-detection mechanism where data is divided into equal-sized words, added using one's complement addition, and then complemented to form a checksum appended to the transmission.
Test your understanding with 5 questions
To guarantee the detection of up to s errors and the correction of up to t errors, what must be the minimum Hamming distance of a block code?
Why is a simple parity-check code incapable of correcting errors, even though it can detect single-bit errors?
Which of the following generator polynomials g(x) will fail to detect single-bit errors?
In a 4-bit one's complement arithmetic system, what is the result of adding the binary values 1011 (decimal 11) and 1100 (decimal 12)?
For a Hamming code with m redundant bits, if the total length of the codeword is n = 2^m - 1, what is the maximum number of data bits k that can be carried?
6 Modules
6 Modules