1 chapter 2 hardware building block encoding framing error detection

36
1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Upload: ferdinand-ramsey

Post on 13-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

1

CHAPTER 2

HARDWARE BUILDING BLOCKENCODING

FRAMINGERROR DETECTION

Page 2: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

2

HARDWARE BUILDING BLOCK

Node: Assume general-purpose (programmable)computers; e.g., workstations. Sometimes replaced with special-purpose hardware – Finite memory – Connects to network via

a network adaptor– Fast processor,

slow memory

CPU

Cache

Memory

NetworkAdapter

I/O Bus

(Network)

Page 3: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

3

HARDWARE BUILDING BLOCK

• Link : Analog and Digital

Page 4: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

4

Link Digital

Page 5: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

5

Communication Modes

• Simplex : only 1 way transmission, sender and receiver can not transmit data at the same time

• Half duplex : 2 way transmission, but sender and receiver can not transmit data at the same time. If sender wants to transmit data then only sender’s path is active

• Full duplex :2 way transmission, both sender and receiver can transmit data at the same time

Page 6: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

6

Link …cont’d

Media Bandwidth Distance

Cat 5 UTP 10 – 100 Mbps 100 m

50-ohm coax (ThinNet) 10 – 100 Mbps 200 m

75-ohm coax (ThickNet) 10 – 100 Mbps 500 m

Multimode fiber 100 Mbps 2 km

Single-mode fiber 100 – 2400 Mbps 40 km

Sometimes you install your own:

Page 7: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

7

Link …cont’d

Sometimes leased from the phone company:

Services Bandwidth

ISDN 64 Kbps

T1 1,544 Mbps

T3 44,763 Mbps

STS-1 51,840 Mbps

STS-3 155,251 Mbps

STS-12 622,080 Mbps

STS-24 1,244160 Gbps

STS-48 2,488320 Gbps

Page 8: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

8

Encoding

A. Overview– Signals propagate over a physical medium.– Digital signals– Analog signals– Data can be either digital or analog;

we're interested in digital data.

Problem: Encode the binary data that the source node wants to send to the destination node into the signal that propagates over to the destination node

Page 9: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

9

Encoding

bits

Page 10: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

10

Encoding

NRZ (Non-Return to Zero)– Problem: Consecutive 1s or 0s– Low signal (0) may be interpretted as no signal– High signal (1) leads to baseline wander– Unable to recover clock

Bits

NRZ

0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

Page 11: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

11

Encoding

• NRZI (Non-Return to Zero Inverted)

– Make a transition from the current signal to encode a one

– stay at the current signal to encode a zero

– solves the problem of consecutive ones.

– But doesn’t solve the problem of consecutive zeros

Page 12: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

12

Encoding

• Manchester– Merging the clock with the signal by

transmitting the exclusive-OR of the NRZ-encoded data and the clock

– bit 1 encoded as high-to-low transition– bit 0 encoded as low-to-high transition – bit rate is half of baud rate, so the encoding

considered only 50 % efficient

Page 13: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

13

Encoding (cont’d)

0 0 11 1 1 0 1 1 0 1 0 0 00

NRZ

clock

NRZ-I

Manchester

Page 14: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

14

Encoding

• 4B/5B– Idea:

Every 4 bits of data is encoded in a 5-bit code, with the 5-bit codes selected to have no more than one leading 0 and no more than two trailing 0 (i.e., never get more than three consecutive 0s).

– Resulting 5-bit codes are then transmitted using the NRZI encoding.

– Achieves 80% efficiency.

Page 15: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

15

Page 16: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

16

Framing

A. Overview

• Problem: Breaking sequence of bits into a frame• Must determine first and last bit of the frame• Typically implemented by network adaptor• Adaptor fetches (deposits) frames out of (into)

host memory

Adaptor

Node A

Adaptor

Node BBits

Frames

Page 17: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

17

Framing

B. Byte-Oriented Protocol• Sentinel approach :

a) BISYNC b)IMP-IMP

SY

N

SY

N

SO

H

HeaderS

TX

ETX CRCBody

a)

SY

N

SY

N

DLE Header

DLE

ETX CRCBody

b)

STX

8 8 8 8 8 16

8 8 8 8 128 8 8 16

Page 18: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

18

Byte-Oriented Protocol

• Problem: ETX character might appear in the data portion of the frame.

• Solution:– escape the ETX character with a DLE

character in BISYNC– escape the DLE character with a DLE

character in IMP-IMP

Page 19: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

19

Byte-Oriented Protocol

• Byte Counting Approach : DDCMP

– Problem: Count field is corrupted (framing error).

– Solution: Catch when CRC fails

SY

N

SY

N

Cla

ss

Header CRCBody

8 8 8 14 16

Count

42

Page 20: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

20

Framing

C. Bit-Oriented Protocol• HDLC: High-Level Data Link Control

(also SDLC and PPP)• Delineate frame with a special bit-sequence:

01111110

Header CRCBody

8 16

BeginningSequence

16 8

EndingSequence

Page 21: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

21

Bit-Oriented Protocol

Bit Stuffing

• Sender: any time five consecutive 1s have been transmitted from the body of the message, insert a 0.

• Receiver: should five consecutive 1s arrive, look at next bit(s):

• if next bit is a 0: remove it

• if next bits are 10: end-of-frame marker

• if next bits are 11: error

Page 22: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

22

Framing

D. Clock-based Framing• SONET: Synchronous Optical Network

• ITU standard for transmission over fiber

• STS-1 (51.84 Mbps)

9 b

aris

PayloadOverhead

90 kolom

Page 23: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

23

Clock-based Framing

• Byte-interleaved multiplexing

Each frame is 125ms long.

Hdr

STS-1 Hdr

STS-1 Hdr

STS-1

STS-3Header

Page 24: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Error Detection

• CRC

• Internet Checksum

• Parity24

Page 25: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Error Detection

• Original message : 10011010 C(x) = x3+ x2 + 1

• message to be sent?

25

Page 26: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

26

Cyclic Redundancy Check

Sender: • multiply M(x) by xk; example:

x10 + x7 + x6 + x4 (10011010000);

• divide result by C(x) (1101);

• Send 10011010000 - 101 = 10011010101, since this must be exactly divisible by C(x);

• Want to ensure that C(x) does not divide evenly into polynomial E(x).

Page 27: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

27

Cyclic Redundancy Check

1 0 0 1 1 0 1 0 0 0 01011

1011

1 0 0 1

1 0 0 0

1011

1011

1 0 1 1

1011

1 1 0 0

1011

1 0 0 0

1011

1 0 1

1 1 1 1 1 0 0 1

1011C(x) M(x)

Remainder

Page 28: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Cyclic Redundancy Check

• Message to be sent is : 10011010101

Receiver :

Divide 10011010101 by 1101

28

Page 29: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

29

Cyclic Redundancy Check

Detection :• All single-bit errors, as long as the xk and x0

terms have non-zero coefficients.• All double-bit errors, as long as C(x) has a

factor with at least three terms.• Any odd number of errors, as long as C(x)

contains the factor (x + 1).• Any “burst” error (i.e sequence of consecutive

errored bits) for which the length of the burst is less than k bits.

• Most burst errors of larger than k bits can also be detected.

Page 30: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

30

Cyclic Redundancy Check

Common polynomials for C(x):

Page 31: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

31

Error Detection

B. Two-Dimensional Parity– Idea : adds bit 1 to data for

balancing the total sum of bit 1– Odd Parity : total sum of bit 1

of (data + parity) is odd– Even Parity : total sum of bit 1

of (data + parity) is even

Page 32: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

32

Error Detection

C. Internet Checksum– Idea : sum (ones complement) all the words which

transmitted and send the summation result to destination node

– The summation result called checksum

– The destination node has to sum the received data, compares the result with checksum value sent by source node

– If the result doesn’t match, it means that the data has error (include checksum)

– Disadvantage : can’t detect miss position bits

Page 33: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Exercise

• Assuming a framing protocol that uses bit stuffing, show the bit sequence transmitted over the link when the frame contains the following bit sequence:

11010 11111 01011 11111 10111 1110

33

Page 34: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Exercise

• Suppose we want to transmit the message 11001001 and protect it from errors using the CRC polynomial x3 + 1.– Use the polynomial long division to determine

the message that should be transmitted– Suppose the leftmost bit of the message is

inverted due to noise on the transmission link. What is the result of the receiver’s CRC calculation? How does the receiver know that an error has occurred?

34

Page 35: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Exercise

• A series of 12 bit message blocks (110110110111) is to be transmitted across a data link using a CRC for error detection. A generator polynomial of C(x)=x4+x3+1 is to be used. Find the final message that will be transmitted over the link!

35

Page 36: 1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION

Exercise

1 1 0 0 1 0

0 1 1 0 1 1

1 0 1 1 0 1

1 0 1 1 1 1

1 0 0 0 0 1

0 1 1 1 1 0

36

Fill the empty space using 2 dimensional odd-parity!