CSE 311:
Data Communication & Computer Networks
Instructor:
Md. Al-Amin Sany
Lecturer, CSE @UAP
Courtesy:
Dr. Md. Monirul Islam
Asst. Professor, CSE @BUET
Digital-to-Digital Conversion:
Line Coding, Block Coding and
Scrambling
From
Data Communications and Networking, 5th Edition
By Behrouz A. Forouzan
(2.5+3.2+2.8+3)/4=2.875 1-> +5v
0 -> 0.0 v
Line Coding and Decoding
2.5 volt
Line Coding
3.2v => 1
• converts digital data elements to digital signal elements 3.3v => 1
3.4v=> 1
• Example: baseline = 2.67v 2.8v => 0
1 → +V new signal = 3.8v 3.0v => 1
0 → -V 2.7v => 0
Data Element and Signal
Element
• data element
– smallest entity to represent a piece of information
– 0, 1, etc,
• signal element
– shortest unit of a digital signal
– Each represents one or more data element
Data Element and Signal
Element
• data element
– smallest entity to represent a piece of information
– 0, 1, etc,
• signal element
– shortest unit of a digital signal
– Each represents one or more data element
• signal element is carrier, data element is carried
Data Element and Signal
Element
• data element
– smallest entity to represent a piece of information
– 0, 1, etc,
• signal element
– shortest unit of a digital signal
– Each represents one or more data element
• signal element is carrier, data element is carried
• r = No. of data element is carried by each signal element
Data Element and Signal
Element
Data Rate and Signal Rate
• data rate, N
– No. of data elements sent in 1 second
– Other names: bit rate
S signals per 1 sec
1 sec —- r*S data elems
• signal rate, S N = r * S => r = N/S
– No. of signal elements sent in 1 second
– Other names: baud rate, pulse rate, modulation rate
• r = N/S alternately, S = N/r
Data Rate and Signal Rate
• r = N/S alternately, S = N/r
• Average Signal rate
Savg = c × N × (1 r) baud
Line Coding Guidelines
• r should be higher, S = N/r should be lower
• Minimize Baseline wandering:
– Running average of incoming signal power is baseline
– Baseline is compared with incoming signal for decoding
– Long runs of 0 or 1 drifts the baseline
Line Coding Guidelines
• Minimize DC components:
– Constant voltage for long period
– increases low frequency components
– bandpass channels do NOT support low frequencies
Line Coding Guidelines
• Self synchronization
– Sender’s and receiver’s clock must have same bit interval
– Different intervals may misinterpret incoming signal
Line Coding Guidelines
Illustration of lack of synchronization
Line Coding Guidelines
• Built-in Error Detection
– Error occurs during transmission
– Must be able to detect and/or correct them
– Example: certain type of signal transition (change) is NOT part of
the coding
Line Coding Guidelines
• Higher Noise immunity
– certain line coding prevents noises to be added to the signal
– It is better than error detection
Line Coding Guidelines
• Complexity
– Simpler is better
– A coding with FOUR signal levels is more difficult to interpret than one
that uses TWO signal levels
Line Coding Schemes
Unipolar
• All signal levels are on one side of the time axis - either
above or below
• Example: Non Return to Zero (NRZ)
– The signal level does not return to zero at middle of the bit
Unipolar: NRZ
• Pros
– Simple
• Cons
– Baseline wandering, DC components
– No synchronization or error detection
r=1
Polar
• signal levels are on BOTH sides of the time axis
• Polar NRZ
– Uses two different voltage: +V and –V
– Two versions: NRZ-Level (NRZ-L) and NRZ-Inversion (NRZ-I)
Polar: NRZ-L and NRZ-I
• Polar NRZ-L
+V: 0 and –V: 1
• Polar NRZ-I
Inversion: next bit is 1, No Inversion: next bit 0
Polar: NRZ-L and NRZ-I
• Pros
– Simple
• Cons
– Baseline wandering, DC components, worse in NRZ-L
– No synchronization or error detection
r=1
Polar: Return to Zero (RZ)
• 3 signal levels: +V, -V, 0
• Signal transition in the middle of the bit
– bit 0: -V to 0 bit 1: +V to 0
Polar: Return to Zero (RZ)
• Pros
– NO Baseline wandering, NO DC components
– Self synchronization: transition synchronizes both sender and receiver
• Cons
– More complex: 3 voltage levels to identify
– No error detection
r=
⅟2
Polar: Biphase-Manchester and
Differential Manchester
• 2 signal levels: +V, -V
• Signal transition always in the middle of the bit, similar to RZ
• Manchester
– Combines NRZ-L and RZ
• Differential Manchester
– Combines NRZ-I and RZ
Polar: Biphase-Manchester and
Differential Manchester
• Manchester
– Level determines bits
• Differential Manchester Manchester
– Inversion/no inversion
determines bits
Polar: Biphase-Manchester and
Differential Manchester
• Pros
– 2 signal elements
– NO Baseline wandering, NO DC components
– Self synchronization
Manchester
• Cons
– r = 1/2
– No error detection
Bipolar
• 3 signal levels: 0, +V, -V
• 2 variations: alternate mark inversion (AMI) and Pseudoternary
• AMI
– bit 0: signal level 0
– bit 1: successively alternates between +V and -V
• Pseudoternary
– bit 1: signal level 0
– bit 0: successively alternates between +V and -V
Bipolar
• AMI
– bit 0: signal level 0
– bit 1: successively alternates between +V and -V
• Pseudoternary
– bit 1: signal level 0
– bit 0: successively alternates between +V and -V
Bipolar
• Pros
– r=1
• Cons
– 3 signal elements
– NO synchronization
– NO error detection
Self Study
Multilevel Schemes
• Target: to increase r or bit rate
• Individual bit is NOT coded
• rather a sequence of m bits is coded by a sequence of n signal
elements
• Assuming, No. of signal levels is L
– Possible data patterns: 2m
– Possible signal patterns: Ln
2m data patterns → Ln signal patterns
Multilevel Schemes
2m data patterns → Ln signal patterns
• 2m >Ln : mapping is NOT possible
• 2m =Ln : exact mapping is possible
• 2m <Ln :
– Redundant signal patterns
– Very flexible mapping is possible
– Better noise immunity and error detection
Multilevel Schemes
• Coding symbol: short representation is
mBnL
• L is replace by character code
– L = 2 : B meaning Binary
– L = 3 : T meaning Ternary
– L = 4 : Q meaning Quaternary
11 00 01 11 10
2B1Q Scheme +3
Rules +1
00: -3 -1
01: -1
10: +3 -3
11: +1
Multilevel Schemes
• Pros
– r=2
– Used in DSL to provide high speed connection to the Internet
• Cons
– 4 signal elements,
– Baseline wandering, DC components are possible
– NO redundancy, NO error detection
11 00 01 11 10
+3
2B1Q Scheme
+1
Rules
00: -3 -1
01: -1
10: +3 -3
11: +1
Multilevel Schemes: 8B6T
• 28 = 256 different data patterns
• 36 = 729 different signal patterns of 3 levels, +V, -V and 0
• No. of redundant signal patterns 729-256 = 473
• Flexible pattern mapping
• Synchronization and error detection by 473 redundant signal
patterns
Multilevel Schemes: 8B6T
• All mapped signal patterns have weight +1 or 0 dc values
Mapping Table
Data patterns Signal patterns weight
00010001 –0–0++ 0
01010011 –+–++0 +1
01010000 +––+0+ +1
• NO signal patterns have weight -1
• DC balance is maintained by inverting polarity of signal pattern
if necessary + – – + 0 + is replaced by - + + - 0 -(WEIGHT: -1)
Multilevel Schemes: 8B6T
Let, we have to send data sequence
000100010101001101010000
00010001 01010011 01010000
-0-0++ -+-++0 +--+0+
Weight: 0 Weight: +1 Weight was +1
Now it is -1
to ensure DC balance
Multilevel Schemes: 4D-PAM5
• 4 Dimensional: 4 signal elements, each sent through separate wire
• Pulse Amplitude Modulation 5: 5 different levels -2, -1, 0, +1, +2
• Used signal levels: -2, -1, +1, +2
• Total signal patterns: 44 = 256, which support 256 binary data
patterns
• 4D-PAM5 is equivalent to linear 8B4Q
Multilevel Schemes: 4D-PAM5
• 1 Gbps Gigabit LAN through 4 copper wires of 125 Mbaud each
• Self synchronization, NO DC components
Multitransition: MLT-3
• Similar to differential coding like NRZ-I and differential Manchester
• Uses more than 2 signal levels, MLT-3 uses 3 levels: +V, 0, -V
• Complex transition rules
– If next bit = 0, no transition
– If next bit = 1 and current level = ±V, transition to level 0
– If next bit = 1 and current level = 0, transition to opposite of last nonzero level
Multitransition: MLT-3
• Complex transition rules
• r=1
• No synchronization for long sequence bit
0’s
Multitransition: MLT-3
Nonperiodic to periodic signal
with a period of 4× bit duration
Repeating pattern: +V0-V0
Line Coding summary
Polar
Block Coding: mB/nB
• replaces m bits by n bits, where m < n
• increaes redundancy and synchronization
• Done before line coding
using 3 steps
– division
– substitution
– combination
Block Coding: 4B/5B
• Done in combination with NRZ-I which has sync problem for long
sequence of 0’s
• 4B/5B ensures no more than 3 consecutive 0’s
Block Coding: 4B/5B
• 16 data sequences
• 32 available encoding sequences
• redundant sequences are for error
detection, overhead control
• Maximum 1 leading 0 and 2
trailing 0’s
Block Coding: 8B/10B
• More redundancy and better error detection than 4B/5B
• Actually done by combination of 5B/6B and 3B/4B to
simplify mapping table
Search for Best Line Coding:
Scrambling
• Characteristics of a good line coding
– No increase in b/w for self sync
– NO DC
• Biphase scheme
– High bandwidth (r < 1)
• NRZ + block coding
– DC still exists
• Bipolar AMI
– NO sync for long sequence of 0’s
– Other characteristics are OK
Search for best line coding:
Scrambling
• Bipolar AMI
– NO sync for long sequence of 0’s
– Other characteristics are OK
• Scrambling uses AMI but inserts nonzero pulses in long
sequence of 0’s
Search for best line coding:
Scrambling
• Bipolar AMI
– NO sync for long sequence of 0’s
– Other characteristics are OK
• Scrambling uses AMI but inserts nonzero pulses in long
sequence of 0’s
• Thus AMI’s rules are violated on the fly
decoding
Scrambling: B8ZS
• Bipolar 8 Zeros (B8ZS)
– Replaces 8 zeros by 0 0 0 V B 0 V B
– V means Violation to AMI rules
– B means normal polarity according to AMI rules
Scrambling: B8ZS
• Bipolar 8 Zeros (B8ZS)
– Replaces 8 zeros by 0 0 0 V B 0 V B
– V means Violation to AMI rules
– B means normal polarity according to AMI rules
Scrambling: B8ZS
• Bipolar 8 Zeros (B8ZS)
– Replaces 8 zeros by 0 0 0 V B 0 V B
– V means Violation to AMI rules
– B means normal polarity according to AMI rules
Scrambling: B8ZS
• Bipolar 8 Zeros (B8ZS)
– Replaces 8 zeros by 0 0 0 V B 0 V B
– V means Violation to AMI rules
– B means normal polarity according to AMI rules
Scrambling: HDB3
• High Definition Bipolar 3-Zero (HDB3)
• Replaces 4 zeros by
– 0 0 0 V if No. of nonzero pulses after last substitution is ODD
– B 0 0 V if No. of nonzero pulses after last substitution is EVEN
Scrambling: HDB3
• High Definition Bipolar 3-Zero (HDB3)
• Replaces 4 zeros by
– 0 0 0 V if No. of nonzero pulses after last substitution is ODD
– B 0 0 V if No. of nonzero pulses after last substitution is EVEN
Scrambling: HDB3
• High Definition Bipolar 3-Zero (HDB3)
• Replaces 4 zeros by
– 0 0 0 V if No. of nonzero pulses after last substitution is ODD
– B 0 0 V if No. of nonzero pulses after last substitution is EVEN
Scrambling: HDB3
• High Definition Bipolar 3-Zero (HDB3)
• Replaces 4 zeros by
– 0 0 0 V if No. of nonzero pulses after last substitution is ODD
– B 0 0 V if No. of nonzero pulses after last substitution is EVEN
Scrambling: HDB3
• High Definition Bipolar 3-Zero (HDB3)
• Replaces 4 zeros by
– 0 0 0 V if No. of nonzero pulses after last substitution is ODD
– B 0 0 V if No. of nonzero pulses after last substitution is EVEN
Odd
Scrambling: HDB3
• High Definition Bipolar 3-Zero (HDB3)
• Replaces 4 zeros by
– 0 0 0 V if No. of nonzero pulses after last substitution is ODD
– B 0 0 V if No. of nonzero pulses after last substitution is EVEN
Even
Scrambling: HDB3
• High Definition Bipolar 3-Zero (HDB3)
• Replaces 4 zeros by
– 0 0 0 V if No. of nonzero pulses after last substitution is ODD
– B 0 0 V if No. of nonzero pulses after last substitution is EVEN
Even