Framing and Encoding EECS 122 Lecture 26 Department

  • Slides: 31
Download presentation
Framing and Encoding EECS 122: Lecture 26 Department of Electrical Engineering and Computer Sciences

Framing and Encoding EECS 122: Lecture 26 Department of Electrical Engineering and Computer Sciences University of California Berkeley April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures

Last Time n We assumed that the link carries frames FH Payload n bits

Last Time n We assumed that the link carries frames FH Payload n bits n n EDC k bits Error detecting code part contains bits that add redundancy Natural Questions: q q q How do physical media transport the frames? Why are some links faster than others? What limits the amount of information we can send on a link? April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 2

Today n n n Link Functions and Components The role of Noise and Bandwidth

Today n n n Link Functions and Components The role of Noise and Bandwidth in determining link rate Encoding: Converting bits to analog signals q n Physical Layer Function Framing: Establishing the conventions that denote boundaries q Data Link Layer Function April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 3

Link Functions Signal Adaptor: convert bits into physical signal and physical signal back into

Link Functions Signal Adaptor: convert bits into physical signal and physical signal back into bits n 1. 2. 3. 4. 5. 6. Functions Construct Frame with Error Detection Code Encode bit sequence into analog signal Transmit bit sequence on a physical medium (Modulation) Receive analog signal Convert Analog Signal to Bit Sequence Recover errors through error correction and/or ARQ April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 4

Link Components NRZI April 25, 2003 A. Parekh, EE 122 S 2003. Revised and

Link Components NRZI April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 5

Link Properties n n Function q Duplex/Half Duplex q One stream, multiple streams Characteristics

Link Properties n n Function q Duplex/Half Duplex q One stream, multiple streams Characteristics q Bit Error Rate q Data Rate (this sometimes mistakenly called bandwidth!) q Degradation with distance Cables and Fibers q CAT 5 twisted pair: 10 -100 Mbps, 100 m q Coax: 10 -100 Mbps, 200 -500 m q Multimode Fiber: 100 Mbps, 2 km q Single Mode Fiber: 100 -2400 Mbps, 40 km Wireless April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 6

Example: Optical Links April 25, 2003 A. Parekh, EE 122 S 2003. Revised and

Example: Optical Links April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 7

Link rate and Distance Links become slower with distance because of attenuation of the

Link rate and Distance Links become slower with distance because of attenuation of the signal Amplifiers and repeaters can help April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 8

Noise n A signal s(t) sent over a link is generally q Distorted by

Noise n A signal s(t) sent over a link is generally q Distorted by the physical nature of the medium n q Affected by random physical effects n n n q Shot noise Fading Multipath Effects Also interference from other links n n n This distortion may be known and reversible at the receiver Wireless Crosstalk Dealing with noise is what communications engineers do April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 9

Noise limits the link rate n n Suppose there were no noise q E.

Noise limits the link rate n n Suppose there were no noise q E. g. Send s(t) always receive s(t+Δ) q Take a message of N bits say b 1 b 2…. b. N, and send a pulse of amplitude of size 0. b 1 b 2…. b. N q Can send at an arbitrarily high rate q This is true even if the link distorts the signal but in a known way In practice the signal always gets distorted in an unpredictable (random) way q Receiver tries to estimate the effects but this lowers the effective rate One way to mitigate noise is to jack up the power of the signal Signal to Noise ratio (SNR) measures the extent of the distortion effects April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 10

Bandwidth affects the data rate n n n There is usually a fixed range

Bandwidth affects the data rate n n n There is usually a fixed range of frequencies at which the analog wave can traverse a link The physical characteristics of the link might govern this Example: q n n Voice Grade Telephone line 300 Hz – 3300 Hz The bandwidth is 3000 Hz For the same SNR, a higher bandwidth gives a higher rate April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 11

Sampling Result (Nyquist) n Suppose a signal s(t) has a bandwidth B. Sampling Result:

Sampling Result (Nyquist) n Suppose a signal s(t) has a bandwidth B. Sampling Result: Suppose we sample it (accurately) every T seconds. n If T≤ 1/2 B then it is possible to reconstruct the s(t) correctly n q q n n Only one signal with bandwidth B has these sample points There are multiple signals with these sample points for signals with bandwidth greater than B Increasing the bandwidth results in a richer signal space No noise allowed in the sampling result April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 12

Sampling Continued But now assume noise that is distributed uniformly over the frequency band.

Sampling Continued But now assume noise that is distributed uniformly over the frequency band. n Then the richer signal space will enable more information to be transmitted in the same amount of time. n Higher bandwidth Higher rate (for the same SNR) n April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 13

The Frequency Spectrum is crowded… April 25, 2003 A. Parekh, EE 122 S 2003.

The Frequency Spectrum is crowded… April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 14

Fundamental Result n n n The affect of noise on the data is modeled

Fundamental Result n n n The affect of noise on the data is modeled probabilistically. It turns out that there is a maximum possible reliable rate for most channels called the capacity C: q There is a scheme to transmit at C with almost no errors q Finding this scheme is tricky but it exists For a commonly observed kind of noise called Additive White Gaussian Noise (AWGN) the capacity is given by: q C = Wlog 2(1 + S/N) bits/sec (Shannon) q Example: Voice grade line: S/N = 1000, W=3000, C=30 Kbps q Technology has improved S/N and W to yield higher speeds such as 56 Kb/s April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 15

Encoding n Goal: send bits from one node to another node on the same

Encoding n Goal: send bits from one node to another node on the same physical media q n This service is provided by the physical layer Problem: specify a robust and efficient encoding scheme to achieve this goal April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 16

Assumptions We use two discrete signals, high and low, to encode 0 and 1

Assumptions We use two discrete signals, high and low, to encode 0 and 1 n The transmission is synchronous, i. e. , there is a clock used to sample the signal n q n In general, the duration of one bit is equal to one or two clock ticks If the amplitude and duration of the signals is large enough, the receiver can do a reasonable job of looking at the distorted signal and estimating what was sent. April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 17

Non-Return to Zero (NRZ) n 1 high signal; 0 low signal n Disadvantages: when

Non-Return to Zero (NRZ) n 1 high signal; 0 low signal n Disadvantages: when there is a long sequence of 1’s or 0’s q q Sensitive to clock skew, i. e. , difficult to do clock recovery Difficult to interpret 0’s and 1’s (baseline wander) 0 0 1 0 1 1 0 NRZ (non-return to zero) Clock April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 18

Non-Return to Zero Inverted (NRZI) 1 make transition; 0 stay at the same level

Non-Return to Zero Inverted (NRZI) 1 make transition; 0 stay at the same level n Solve previous problems for long sequences of 1’s, but not for 0’s n 0 0 1 0 1 1 0 NRZI (non-return to zero intverted) Clock April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 19

Manchester n n n 1 high-to-low transition; 0 low-to-high transition Addresses clock recovery and

Manchester n n n 1 high-to-low transition; 0 low-to-high transition Addresses clock recovery and baseline wander problems Disadvantage: needs a clock that is twice as fast as the transmission rate q Efficiency of 50% 0 0 1 0 1 1 0 Manchester Clock April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 20

4 -bit/5 -bit (100 Mb/s Ethernet) n n Goal: address inefficiency of Manchester encoding,

4 -bit/5 -bit (100 Mb/s Ethernet) n n Goal: address inefficiency of Manchester encoding, while avoiding long periods of low signals Solution: q q q Use 5 bits to encode every sequence of four bits such that no 5 bit code has more than one leading 0 and two trailing 0’s Use NRZI to encode the 5 bit codes Efficiency is 80% April 25, 2003 4 -bit 5 -bit 0000 0001 0010 0011 0100 0101 0110 0111 11110 01001 10100 101010 01011 01110 01111 1000 1001 1010 1011 1100 1101 1110 1111 10010 10011 10110 10111 11010 11011 11100 11101 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 21

Modulation n The function of transmitting the encoded signal over a link, often by

Modulation n The function of transmitting the encoded signal over a link, often by combining it with another (carrier signal) q E. g. Frequency Modulation (FM) n q Combine the signal with a carrier signal in such a way that the instantaneous frequency of the received signal contains the information of the carrier E. g. Frequency Hopping (OFDM) n n April 25, 2003 Signal transmitted over multiple frequencies Sequence of frequencies is pseudo random A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 22

Framing n Goal: send a block of bits (frames) between nodes connected on the

Framing n Goal: send a block of bits (frames) between nodes connected on the same physical media q This service is provided by the data link layer Use a special byte (bit sequence) to mark the beginning (and the end) of the frame n Problem: what happens if this sequence appears in the data payload? n April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 23

Byte-Oriented Protocols: Sentinel Approach 8 STX n n 8 Text (Data) ETX STX –

Byte-Oriented Protocols: Sentinel Approach 8 STX n n 8 Text (Data) ETX STX – start of text ETX – end of text Problem: what if ETX appears in the data portion of the frame? Solution If ETX appears in the data, introduce a special character DLE (Data Link Escape) before it q If DLE appears in the text, introduce another DLE character before it q n Protocol examples q BISYNC, PPP, DDCMP April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 24

Byte-Oriented Protocols: Byte Counting Approach Sender: insert the length of the data (in bytes)

Byte-Oriented Protocols: Byte Counting Approach Sender: insert the length of the data (in bytes) at the beginning of the frame, i. e. , in the frame header n Receiver: extract this length and decrement it every time a byte is read. When this counter becomes zero, we are done n April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 25

Bit-Oriented Protocols 8 Start sequence n n Text (Data) End sequence Both start and

Bit-Oriented Protocols 8 Start sequence n n Text (Data) End sequence Both start and end sequence can be the same q n 8 E. g. , 01111110 in HDLC (High-level Data Link Protocol) Sender: inserts a 0 after five consecutive 1 s Receiver: when it sees five 1 s makes decision on the next two bits q q if next bit 0 (this is a stuffed bit), remove it if next bit 1, look at the next bit n n April 25, 2003 If 0 this is end-of-frame (receiver has seen 01111110) If 1 this is an error, discard the frame (receiver has seen 01111111) A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 26

Clock-Based Framing (SONET) SONET (Synchronous Optical NETwork) n Developed to transmit data over optical

Clock-Based Framing (SONET) SONET (Synchronous Optical NETwork) n Developed to transmit data over optical links n Example: SONET ST-1: 51. 84 Mbps q Many streams on one link q n SONET maintains clock synchronization across several adjacent links to form a path q This makes the format and scheme very complicated April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 27

SONET Multiplexing FH STS-1 n n n FH STS-3 c has the payloads of

SONET Multiplexing FH STS-1 n n n FH STS-3 c has the payloads of three STS-1’s byte-wise interleaved. STS-3 is a SONET link w/o multiplexing For STS-N, frame size is always 125 microsec q q STS-1 frame is 810 bytes STS-3 frame is 810 x 3 =2430 bytes April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 28

STS-1 Frame n n n First two bytes of each frame contain a special

STS-1 Frame n n n First two bytes of each frame contain a special bit pattern that allows to determine where the frame starts No bit-stuffing is used Receiver looks for the special bit pattern every 810 bytes q Size of frame = 9 x 90 = 810 bytes 9 rows overhead Data (payload) SONET STS-1 Frame 90 columns April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 29

Clock-Based Framing (SONET) n Details: Overhead bytes are encoded using NRZ q To avoid

Clock-Based Framing (SONET) n Details: Overhead bytes are encoded using NRZ q To avoid long sequences of 0’s or 1’s the payload is XOR-ed with a special 127 -bit patter with many transitions from 1 to 0 q April 25, 2003 A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 30

Summary n n Links are subject to random noise For a given probabilistic model

Summary n n Links are subject to random noise For a given probabilistic model of the noise it may be possible to compute its capacity q n Generally depends on SNR and Bandwidth Encoding – specifies how bits are represented on in the analog signal q Challenge – achieve: n n n Efficiency – ideally, bit rate = clock rate Robust – avoid de-synchronization between sender and receiver when there is a large sequence of 1’s or 0’s Framing – specify how blocks of data are transmitted q Challenge n n April 25, 2003 Decide when a frame starts/ends Differentiate between the true frame delimiters and delimiters appearing in the payload data A. Parekh, EE 122 S 2003. Revised and enhanced F'02 Lectures 31