Transcript Lecture 5

CS 3510 - Chapter 2 (3 of 5)
Dr. Clincy
Professor of CS
Dr. Clincy
Lecture 3
Slide 1
Recap Signed Numbers
• Sign-Magnitude
• 1’s Complement
• 2’s Complement
Dr. Clincy
Lecture 9 and 10
2
Multiplication in base 2 – dealing with negative numbers
• By hand – signed case – best to use 2’s complement
• If both numbers are negative, perform as if both numbers are positive
• If one is negative and one number is positive, see below – extend out
left-most bit
Dr. Clincy
Lecture
Lecture
9 and 10
3
How does the computer multiply (shifting) ?
• Computer doesn’t actually multiply – it adds and shifts
Will cover Booth’s Algorithm in a later lecture
Dr. Clincy
Lecture
Lecture
9 and 10
4
Character Codes
• Calculations aren’t useful until their results can
be displayed in a manner that is meaningful to
people.
• We also need to store the results of calculations,
and provide a means for data input.
• Thus, human-understandable characters must be
converted to computer-understandable bit
patterns using some sort of character encoding
scheme.
Dr. Clincy
Lecture 9 and 10
5
Character Codes
• Binary-coded decimal (BCD) was one of these
early codes. It was used by IBM mainframes in the
1950s and 1960s.
• In 1964, BCD was extended to an 8-bit code,
Extended Binary-Coded Decimal Interchange
Code (EBCDIC).
• Until recently, ASCII was the dominant character
code outside the IBM mainframe world.
• Many of today’s systems embrace Unicode, a 16bit system that can encode the characters of every
language in the world
Dr. Clincy
Lecture 9 and 10
6
ASCII
Dr. Clincy
Dr. Clincy
- CS2350
Lecture 9 and 10
77
EBCDIC
Lecture
Dr.
Clincy
9 and 10
8
Error Detection Vs Error Correction
• Error Detection – determining if an error occurred or
not
• Error Correction – given an error has occurred,
correcting the error – much more complex than error
detection
– (Method 1) Fix the error by retransmitting the frame that is in
error - Rx ask the Tx to retransmit
– (Method 2) Forward error control – fixing the error on the Rx
side (complex)
Dr. Clincy
Lecture 9 and 10
9
Error Control Techniques
Trade off between detection probability and
processing requirements
Approaches
Detection
• Simple Parity (Double Parity)
• Cyclic Redundancy Checksum
Error correction
• Hamming Approach
Dr. Clincy
Lecture 9 and 10
10
Error Detection: Single Parity
• Bit added to each character to make all bits add up to an even
number (even parity) or odd number (odd parity)
• Good for detecting single-bit errors only
• High overhead (one extra bit per 7-bit character=12.5%)
Examples of parity bits
•What’s the disadvantage ?: what happens for 2 bit
errors ?
.
Dr. Clincy
Lecture
Lecture
9 and 10
11
Do Some Examples w/students
•Even, 110101
•Odd, 110110
•Odd, 1010101
•Even, 11111
Dr. Clincy
Lecture
Lecture
9 and 10
12
Parity Bit Concept
•
•
•
•
•
Given the word: 1011011 – add “parity bit”
Even Parity: even # of 1’s: 11011011
Odd Parity: odd # of 1’s: 01011011
What’s the disadvantage ?: what happens for 2 bit errors ?
Another Example:
•
•
Encode 1100 in (a), even parity added in (b), Error in AC in (c)
NOW, do we see how we can use the Parity Bit Concept to Detect Errors
Dr. Clincy
Lecture
13
Error Detection: Double Parity
•
•
•
•
•
Uses horizontal and longitudinal parity
Individual characters are grouped together in a block
Each row (character) would have a parity bit
Each column would have a parity bit
The group of parity bits formed by the rows and columns
1101011 1
1111111 1
0101010 1
0011001 1
Parity
bits (B)
If 1 bit is in error,
(B) catches it, if 2
bits are in error, (A)
catches it
0100111 0
Parity
bits (A)
Dr. Clincy
Lecture
14
Do some examples w/students
Even
• 111101
• 101010
• 110011
Even
• 110001
• 100010
• 110011
Odd
• 10001
• 11010
• 11100
Odd
• 11101
• 11010
• 11000
Dr. Clincy
Lecture
15