170 likes | 185 Views
CS 3501 - Chapter 2. Dr. Clincy Professor of CS. 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
E N D
CS 3501 - Chapter 2 Dr. Clincy Professor of CS Lecture 4
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 4 2
How does the computer multiply integers (shifting) ? Computer doesn’t actually multiply – it adds and shifts Dr. Clincy Lecture Lecture 4 3
Examples of Integer Multiplication by 2 Dr. Clincy Lecture 4 4
Another Example of Integer Multiplication by 2 Dr. Clincy Lecture 4 5
Examples of Integer Division by 2 Dr. Clincy Lecture 4 6
Booth’s Algorithm – Faster 2’s Complement Multiplication Dr. Clincy Lecture 4 7
Booth’s Algorithm Concept Dr. Clincy Lecture 4 8
Booth’s Algorithm Concept Dr. Clincy Lecture 4 9
Booth’s Algorithm Standard Approach Booth’s Algorithm Approach This is where 2’s complement comes into play Dr. Clincy Lecture 4 10
Booth’s Algorithm Only consider the first 16 bits – ignore beyond the 16th bit Dr. Clincy Lecture 4 11
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. Lecture 4
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 16-bit system that can encode the characters of every language in the world Lecture 4
ASCII Lecture 4
EBCDIC Lecture 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. Lecture 4
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 16-bit system that can encode the characters of every language in the world Lecture 4