Sunteți pe pagina 1din 21

371-1-0291: An Introduction to

Computer Networks
Homepage
http://help.cse.bgu.ac.il/cse/Courses/list.asp

Handout #12: Physical Layer Signaling, Coding and


Clocking

Additional Reading
Text book: Chap. 2.1-2.5

Lect-10-2: Physical Computer Networks 1


Layer
Outline

 Signaling bits on a link


 Encoding bits for clock-recovery
 Elasticity buffers

Lect-10-2: Physical Computer Networks 2


Layer
Signaling bits on a link
Most electrical and optical networks signal bits
using two distinct voltage/power levels called NRZ
(Non-Return to Zero).
Rise and fall times Power
1 1 1 10mW 1 1
5
Volts
0 0 0 0 0
0 0mW
time time

Physical media that propagate signals (electromagnetic waves)

Coaxial cable
Twisted pair Optical Fiber
Lect-10-2: Physical Computer Networks 3
Layer
Signaling bits on a link
All links have a maximum bandwidth that limits fast data
bits can be generated. Thus, limits the maximum
capacity or data rate of the link.

Bandwidth Bandwidth

Frequency Frequency
Lect-10-2: Physical Computer Networks 4
Layer
Maximum Capacity/Data Rate
Shannon Capacity:

C  B log 2 (1  S / N )
Bandwidth of link Signal-to-Noise ratio

For example:
 Bandwidth of voice grade telephone lines carry
frequencies between 300-3300 Hz. Thus, its
bandwidth is approx 3 KHz
 Signal-to-noise ratio is approx 30dB = 10log10(S/N)
 Therefore, C = 3000*log2(1001) ~= 30kb/s

Lect-10-2: Physical Computer Networks 5


Layer
Outline

 Signaling bits on a link


 Encoding bits for clock-recovery
 Elasticity buffers

Lect-10-2: Physical Computer Networks 6


Layer
Encoding for clock recovery
Problem:
 Different hosts use locally-generated clocks of nominally
the same frequency, but slightly different.
E.g. 10MHz +/- 100ppm (“parts per million”)1.
 The receiver needs to “recover” the senders clock from
the data stream, for example:
Sender Receiver
Flip- Network Flip- Flip-
Flop Link Flop Flop

10MHz clock Sender’s Clock


10MHz clock
+/- 100ppm Clock Recovery +/- 100ppm
Unit
Elasticity buffer

1) OneLect-10-2:
part per million equals 10-4%.
Physical Computer Networks 7
Layer
If we don’t know the sender’s clock

TTx

TX Clock
1 2 3 4
Data Missed!

1 2 3
RX Clock
TRx
Sampling points are in the middle
If the RX clock is p ppm slower than the TX clock, then: TRx  TTx (1  106 p).

After
0.5
6
bit times, the RX clock will miss a bit. (The bit times sum up to
10 p 0.5 frame)

Lect-10-2: Physical Computer Networks 8


Layer
Encoding for clock recovery
 To decode a signal, a RCV averages the signal
power it has been observed so far
 If the signal is > a threshold it decodes “1”
 Otherwise, it decodes “0”
 Clock sync are recovered when a RCV notices a
transition between two levels
 Long sequences of “1” or of “0” jeopardize clock
recovery
 Thus, we want to prevent them by special encoding

Lect-10-2: Physical Computer Networks 9


Layer
Encoding for clock recovery
NRZ Inverted (NRZI)

 To encode “1”, switch from current level


 To encode “o”, stay at current level
 Takes care of long “1”’s but not on long “0”

Manchester Encoding

 Merges the local alternating clock with the data


by transmitting their XOR
 Used in 10Mb/s Ethernet

Lect-10-2: Physical Computer Networks 10


Layer
NRZ
Data 0 1 1 0 1 0 1 1

Clock
cycle
Manchester
Encoding

 “1” is a “low-2-high” transition and “0” a “high-2-low”


 Because both bits result in transitions, clock can be
recovered effectively
 XOR at the RCV with a sync clock decodes the
transmitted bits

Lect-10-2: Physical Computer Networks 11


Layer
Manchester Encoding Disadvantage

 Half the bit rate that can sent on the media


 A transition needs to be detected rather than the power
level

Lect-10-2: Physical Computer Networks 12


Layer
$B/5B Encoding for clock recovery
Example #2: FDDI
 Insert extra bit to break up long sequences of “1” or “0”
 Blocks of 4 bits are encoded in to blocks of 5 bits:
Each block has no more than 1 leading 0

 And no more than 2 trailing 0’s

 No pair of blocks has more than 3 consecutive 0’s

4-bit data 5-bit code


0000 11110
0001 01001
0010 10100
… …
 The 5B blocks are transmitted with the NRZI encoding
Lect-10-2: Physical Computer Networks 13
Layer
Advantages of 4b/5b encoding:
 More bandwidth efficient (only 25% overhead).
 Allows extra codes to be used for control information.

Disadvantages
 Fewer transitions can make clock recovery harder.

 Solved by the NRZI encoding

Lect-10-2: Physical Computer Networks 14


Layer
Outline

 Signaling bits on a link


 Encoding bits for clock-recovery
 Elasticity buffers

Lect-10-2: Physical Computer Networks 15


Layer
The need for an elasticity buffer

Problem:
 The sender’s clock may be slower or faster than the
receiver’s clock.
E.g. 10MHz +/- 100ppm (“parts per million”).
 How big should the FIFO be?

Sender B Receiver
Flip- Network Flip- Flip-
Flop Link Flop Flop

10MHz clock Sender’s Clock


10MHz clock
+/- 100ppm Clock Recovery +/- 100ppm
Unit
Elasticity buffer
Lect-10-2: Physical Computer Networks 16
Layer
Sizing an elasticity buffer

Receiver clock
slower: Elasticity
Receiver clock
Cumulative bytes

buffer overflows
faster: Elasticity
buffer
underflows

BxRate

time
Lect-10-2: Physical Computer Networks 17
Layer
Sizing an elasticity buffer
B

1. At start of new packet, allow buffer to fill


to B/2.
2. Size buffer so that it does not overflow or
underflow before packet completes.
3. Ensure that the inter-packet gap is long enough
to allow buffer to drain before next packet arrives.

Lect-10-2: Physical Computer Networks 18


Layer
Preventing overflow
Received bytes
Cumulative bytes

Transmitted bytes

Inter-packet
gap > B/2Rmax

Max
Packet
Size, Pmax Rmax
Rmin
B/2

B/2R Filling rate 2nd half time


 Rmax  Rmin   Rmax  Rmin 
 
 max 
P  Pmax  B / 2 To prevent overflow:
 R max   R 
Max filling time
Lect-10-2: Physical Computer Networks 19
Layer
Preventing underflow
Cumulative bytes Received bytes
Transmitted bytes

Inter-packet
gap > B/2Rmax

Max
Packet
Size, Pmax Rmin
Rmax

B/2Rmin time
B/2R Draining rate 1st half
 Rmax  Rmin   Rmax  Rmin 
 
 max 
P  Pmax  B / 2 To prevent underflow:
 R max   R 
Max draining time
Lect-10-2: Physical Computer Networks 20
Layer
Sizing an elasticity buffer
Example: FDDI

Maximum packet size 4500bytes


Clock tolerance +/- 50ppm
 Rmax  Rmin  6
= 2x50 ppm
   100  10
 R 
 B  2(4500  8 100 106 )  7bits
Therefore,
1. Buffer larger than 7 bits
2. Wait for at least 3.5 bits before draining buffer
3. Inter-packet gap at least 3.5bits

Lect-10-2: Physical Computer Networks 21


Layer

S-ar putea să vă placă și