220 likes | 718 Views
Encoding. Objectives. Understand basic encoding schemes Understand basic framing schemes Know bit stuffing Ethernet lab introduction. Non-Return to Zero (NRZ). Problem: Consecutive 1s or 0s Low signal (0) may be interpreted as no signal High signal (1) leads to baseline wander
E N D
Objectives • Understand basic encoding schemes • Understand basic framing schemes • Know bit stuffing • Ethernet lab introduction
Non-Return to Zero (NRZ) • Problem: Consecutive 1s or 0s • Low signal (0) may be interpreted as no signal • High signal (1) leads to baseline wander • Unable to recover clock 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 Bits NRZ
NRZI and Manchester • Non-return to Zero Inverted (NRZI): Make a transition from the current signal to encode a one, and stay at the current signal to encode a zero; • solves the problem of consecutive ones. • Manchester: Transmits the XOR of the NRZ encoded data and the clock; only 50% efficient.
Example Manchester encoding allows the clocks to be synchronized NRZI eliminates consecutive 1s and baseline wander Consecutive zeros can still make it difficult to recover clock Bits 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 NRZ Clock Mancester NRZI
4B/5B • Problem: consecutive zeros • 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. • We already dealt with consecutive 1s with NRZI
4B/5B • At most one zero on each end • data • 1111 1000 0011 1101 • 4B/5B • 11101 10010 10101 11011 • NRZI • 0 10110 11100 11001 01101
Overview • Problem: Breaking sequence of bits into a frame • Must determine first and last bit of the frame • Typically implemented by network adapter • Adapter fetches (deposits) frames out of (into) host memory
Four Approaches • Clock Based • fixed length frames, high reliability required • Sentinels • Special character to delineate frames, replace character in data stream • Character Count • Frame length at certain position in frame • Physical layer invalid codes • requires physical layer redundancy
Byte-Oriented Protocols • Sentinel Approach • PPP protocol uses 0x7e=01111110 as the flag byte to delimit a frame • When a 0x7e is seen in the payload, it must be escaped to keep it from being seen as an end of frame 16 8 8 8 14 8 Addr Flag Prot Payload Checksum Flag Cont
PPP Escape Character • To escape a character first send the escape character '}'. Then send the character to be escaped XORed with 001000002. To escape '~', send the escape character '}' followed by the ASCII value of '~' (011111102) XORed with 001000002.
8 16 16 8 Beginning Ending Header Body CRC Sequence Sequence Bit-Oriented Protocols • HDLC: High-Level Data Link Control (also SDLC and PPP) • Delineate frame with a special bit-sequence: 01111110
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
State Machine 0 1 0 1 0 1 0 1 0 1 Insert 0
Bit stuffing Example • Original Data • 001111111000011111100 • Bit Stuffed • 00111110110000111110100 • Receiver • 0011111011000011111010001111110 End of Frame
Overview • History • Developed by Xerox PARC in mid-1970s • Roots in Aloha packet-radio network • Standardized by Xerox, DEC, and Intel in 1978 • Similar to IEEE 802.3 standard • Manchester encoding, synchronous transmission
Frame Format Addresses: • Unique, 48-bit unicast address assigned to each adaptor • Example: 8:0:2b:e4:b1:2 • Broadcast: all 1s • Multicast: first bit is 1
Reading "GIVE ATTENDANCE TO READING" by Brad Wilcox, Associate Professor, Brigham Young University Have you ever read a book and then seen a movie made from the book? Were you disappointed? Most people are. That's because reading is a mentally active experience while watching TV or movies is a mentally passive one. When we watch TV or a video, we do not have to imagine the setting. It is shown to us. We do not have to imagine what the main characters look like. They are shown to us. We do not even have to imagine the kissing scenes because--like it or not--those are shown to us too. On the other hand, reading allows us to use our brains and become involved intellectually.
Reading If you are a reader you are following Paul's counsel to "give attendance to reading" in your youth (1 Timothy 4:13). Keep up the great work. Keep reading magazines, newspapers, cereal boxes, bumper stickers--anything you can get your eyes on. Keep reading good books--famous ones, fun ones, sad ones, spiritual ones. Keep reading and you will come to understand why the comedian Groucho Marx once said, "Outside of a dog, man's best friend is a book; inside of a dog, it's too dark to read.“ This applies in particular to the CS460 Book. Make it your friend.