Chapter 8 Coding and Error Control WenShyang Hwang

  • Slides: 30
Download presentation
Chapter 8. Coding and Error Control Wen-Shyang Hwang KUAS EE. 1

Chapter 8. Coding and Error Control Wen-Shyang Hwang KUAS EE. 1

Coping with Data Transmission Errors o Error detection codes n o o Detects the

Coping with Data Transmission Errors o Error detection codes n o o Detects the presence of an error Automatic repeat request (ARQ) protocols n Block of data with error is discarded n Transmitter retransmits that block of data Error correction codes, or forward correction codes (FEC) n Designed to detect and correct errors 2

Error Detection Probabilities o Definitions n Pb : Probability of single bit error (BER)

Error Detection Probabilities o Definitions n Pb : Probability of single bit error (BER) n P 1 : Probability that a frame arrives with no bit errors n n o P 2 : While using error detection, the probability that a frame arrives with one or more undetected errors P 3 : While using error detection, the probability that a frame arrives with one or more detected bit errors but no undetected bit errors With no error detection o F = Number of bits per frame 3

Error Detection Process o Transmitter n n o For a given frame, an error-detecting

Error Detection Process o Transmitter n n o For a given frame, an error-detecting code (check bits) is calculated from data bits Check bits are appended to data bits Receiver n n Separates incoming frame into data bits and check bits Calculates check bits from received data bits Compares calculated check bits against received check bits Detected error occurs if mismatch 4

Parity Check o Parity bit appended to a block of data o Even parity

Parity Check o Parity bit appended to a block of data o Even parity n o Odd parity n o Added bit ensures an even number of 1 s Added bit ensures an odd number of 1 s Example, 7 -bit character [1110001] n Even parity [11100010] n Odd parity [11100011] 5

Cyclic Redundancy Check (CRC) o Transmitter n n o For a k-bit block, transmitter

Cyclic Redundancy Check (CRC) o Transmitter n n o For a k-bit block, transmitter generates an (n-k)-bit frame check sequence (FCS) Resulting frame of n bits is exactly divisible by predetermined number Receiver n Divides incoming frame by predetermined number n If no remainder, assumes no error 6

CRC using Modulo 2 Arithmetic o o Exclusive-OR (XOR) operation Parameters: n n n

CRC using Modulo 2 Arithmetic o o Exclusive-OR (XOR) operation Parameters: n n n T = n-bit frame to be transmitted D = k-bit block of data; the first k bits of T F = (n – k)-bit FCS; the last (n – k) bits of T P = pattern of n–k+1 bits; this is the predetermined divisor Q = Quotient R = Remainder o For T/P to have no remainder, start with o Divide 2 n-k. D by P gives quotient and remainder o Use remainder as FCS 7

CRC using Modulo 2 Arithmetic o Does R cause T/P have no remainder? o

CRC using Modulo 2 Arithmetic o Does R cause T/P have no remainder? o Substituting, n No remainder, so T is exactly divisible by P 8

CRC using Polynomials o All values expressed as polynomials n o Dummy variable X

CRC using Polynomials o All values expressed as polynomials n o Dummy variable X with binary coefficients Widely used versions of P(X) n n CRC– 12 o X 12 + X 11 + CRC– 16 o X 16 + X 15 + CRC – CCITT o X 16 + X 12 + CRC – 32 o X 32 + X 26 + + X 2 + X 3 + X 2 + X + 1 X 2 + 1 X 5 + 1 X 23 + X 22 + X 16 + X 12 + X 11 + X 10 + X 8 + X 7 + X 5 + X 4 1 9

CRC using Digital Logic o Dividing circuit consisting of: n n XOR gates o

CRC using Digital Logic o Dividing circuit consisting of: n n XOR gates o Up to n – k XOR gates o Presence of a gate corresponds to the presence of a term in the divisor polynomial P(X) A shift register o String of 1 -bit storage devices o Register contains n – k bits, equal to the length of the FCS 10

11

11

Wireless Transmission Errors o o Error detection requires retransmission Detection inadequate for wireless applications

Wireless Transmission Errors o o Error detection requires retransmission Detection inadequate for wireless applications n n Error rate on wireless link can be high, results in a large number of retransmissions Long propagation delay compared to transmission time 12

Block Error Correction Codes o Transmitter n n o Forward error correction (FEC) encoder

Block Error Correction Codes o Transmitter n n o Forward error correction (FEC) encoder maps each k-bit block into an n-bit block codeword Codeword is transmitted; analog for wireless transmission Receiver n n Incoming signal is demodulated Block passed through an FEC decoder 13

FEC Decoder Outcomes o No errors present n o o o Codeword produced by

FEC Decoder Outcomes o No errors present n o o o Codeword produced by decoder matches original codeword Decoder detects and corrects bit errors Decoder detects but cannot correct bit errors; reports uncorrectable error Decoder detects no bit errors, though errors are present 14

Block Code Principles o Hamming distance – for 2 n-bit binary sequences, the number

Block Code Principles o Hamming distance – for 2 n-bit binary sequences, the number of different bits n E. g. , v 1=011011; v 2=110001; d(v 1, v 2)=3 o Redundancy – ratio of redundant bits to data bits o Code rate – ratio of data bits to total bits o Coding gain – the reduction in the required Eb/N 0 to achieve a specified BER of an error-correcting coded system compared to an uncoded system using the same modulation. 15

Hamming Code o o Designed to correct single bit errors Family of (n, k)

Hamming Code o o Designed to correct single bit errors Family of (n, k) block error-correcting codes with parameters: n n o Block length: n = 2 m – 1 Number of data bits: k = 2 m – 1 Number of check bits: n – k = m Minimum distance: dmin = 3 Single-error-correcting (SEC) code n SEC double-error-detecting (SEC-DED) code 16

Hamming Code Process o o Encoding: k data bits + (n -k) check bits

Hamming Code Process o o Encoding: k data bits + (n -k) check bits Decoding: compares received (n -k) bits with calculated (n -k) bits using XOR n Resulting (n -k) bits called syndrome word n Syndrome range is between 0 and 2(n-k)-1 n Each bit of syndrome indicates a match (0) or conflict (1) in that bit position 17

Cyclic Codes o o o Can be encoded and decoded using linear feedback shift

Cyclic Codes o o o Can be encoded and decoded using linear feedback shift registers (LFSRs) For cyclic codes, a valid codeword (c 0, c 1, …, cn-1), shifted right one bit, is also a valid codeword (cn-1, c 0, …, cn-2) Takes fixed-length input (k) and produces fixed-length check code (n-k) n In contrast, CRC error-detecting code accepts arbitrary length input for fixed-length check code 18

BCH Codes o For positive pair of integers m and t, a (n, k)

BCH Codes o For positive pair of integers m and t, a (n, k) BCH code has parameters: n Block length: n = 2 m – 1 n Number of check bits: n – k £ mt n Minimum distance: dmin ³ 2 t + 1 o Correct combinations of t or fewer errors o Flexibility in choice of parameters n Block length, code rate 19

Reed-Solomon Codes o Subclass of nonbinary BCH codes o Data processed in chunks of

Reed-Solomon Codes o Subclass of nonbinary BCH codes o Data processed in chunks of m bits, called symbols o An (n, k) RS code has parameters: n Symbol length: m bits per symbol n Block length: n = 2 m – 1 symbols = m(2 m – 1) bits n Data length: k symbols n Size of check code: n – k = 2 t symbols = m(2 t) bits n Minimum distance: dmin = 2 t + 1 symbols 20

Block Interleaving o o Data written to and read from memory in different orders

Block Interleaving o o Data written to and read from memory in different orders Data bits and corresponding check bits are interspersed with bits from other blocks At receiver, data are deinterleaved to recover original order A burst error that may occur is spread out over a number of blocks, making error correction possible 21

Convolutional Codes o Generates redundant bits continuously o Error checking and correcting carried out

Convolutional Codes o Generates redundant bits continuously o Error checking and correcting carried out continuously n n (n, k, K) code o Input processes k bits at a time o Output produces n bits for every k input bits o K = constraint factor o k and n generally very small n-bit output of (n, k, K) code depends on: o Current block of k input bits o Previous K-1 blocks of k input bits 22

Convolutional Encoder 23

Convolutional Encoder 23

Decoding o Trellis diagram – expanded encoder diagram o Viterbi code – error correction

Decoding o Trellis diagram – expanded encoder diagram o Viterbi code – error correction algorithm n n n Compares received sequence with all possible transmitted sequences Algorithm chooses path through trellis whose coded sequence differs from received sequence in the fewest number of places Once a valid path is selected as the correct path, the decoder can recover the input data bits from the output code bits 24

Automatic Repeat Request o o Mechanism used in data link control and transport protocols

Automatic Repeat Request o o Mechanism used in data link control and transport protocols Relies on use of an error detection code (such as CRC) Flow Control Error Control 25

Flow Control o o Assures that transmitting entity does not overwhelm a receiving entity

Flow Control o o Assures that transmitting entity does not overwhelm a receiving entity with data Protocols with flow control mechanism allow multiple PDUs in transit at the same time o PDUs arrive in same order they’re sent o Sliding-window flow control n n o Transmitter maintains list (window) of sequence numbers allowed to send Receiver maintains list allowed to receive Reasons for breaking up a block of data before transmitting: n n n Limited buffer size of receiver Retransmission of PDU due to error requires smaller amounts of data to be retransmitted On shared medium, larger PDUs occupy medium for extended period, causing delays at other sending stations 26

Flow Control 27

Flow Control 27

Error Control o o Mechanisms to detect and correct transmission errors Types of errors:

Error Control o o Mechanisms to detect and correct transmission errors Types of errors: n n Lost PDU : a PDU fails to arrive Damaged PDU : PDU arrives with errors 28

Error Control Requirements o Error detection n o Positive acknowledgement n o Destination returns

Error Control Requirements o Error detection n o Positive acknowledgement n o Destination returns acknowledgment of received, error-free PDUs Retransmission after timeout n o Receiver detects errors and discards PDUs Source retransmits unacknowledged PDU Negative acknowledgement and retransmission n Destination returns negative acknowledgment to PDUs in error 29

Go-back-N ARQ o Acknowledgments n n o RR = receive ready (no errors occur)

Go-back-N ARQ o Acknowledgments n n o RR = receive ready (no errors occur) REJ = reject (error detected) Contingencies n n n Damaged PDU Damaged RR Damaged REJ 30