Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nguyen Le CS147.  2.4 Signed Integer Representation  2.4.1 – Signed Magnitude  2.4.2 – Complement Systems  2.4.3 – Unsigned Versus Signed Numbers.

Similar presentations


Presentation on theme: "Nguyen Le CS147.  2.4 Signed Integer Representation  2.4.1 – Signed Magnitude  2.4.2 – Complement Systems  2.4.3 – Unsigned Versus Signed Numbers."— Presentation transcript:

1 Nguyen Le CS147

2  2.4 Signed Integer Representation  2.4.1 – Signed Magnitude  2.4.2 – Complement Systems  2.4.3 – Unsigned Versus Signed Numbers  2.4.4 – Computers, Arithmetic, and Booth’s Algorithm  2.4.5 – Carry Versus Overflow Section overview

3 Unsigned integer representation  1 1 1 1  carries  0 1 0 1 1 1 0 0  0 1 1 0 1 0 1 1  1 1 0 0 0 1 1 1

4 3 methods of representation  Signed magnitude  One’s complement   Two’s complement

5 Signed magnitude  Signed magnitude representation includes a sign as the first bit of the storage location. A “1” in the high-order bit (or left- most bit) indicates a negative number and the rest of the remaining bits represent the number itself. Ex: +1 and -1 in an 8-bit word would be  0 0 0 0 0 0 0 1 (+1)  1 0 0 0 0 0 0 1 (-1)

6 Signed magnitude addition  1 1 1 1  carries  0 1 0 0 1 1 1 1  0 0 1 0 0 0 1 1  0 1 1 1 0 0 1 0

7 Overflow  Overflow in signed numbers occurs when the sign of the result is incorrect. The sign bit is used only for the sign, so we can’t carry into it.  1 1 1 1 1  carries  0 1 0 0 1 1 1 1 (79)  0 1 1 0 0 0 1 1 (99)  0 0 1 1 0 0 1 0 (50) 79 + 99 =/= 50

8 Signed magnitude subtraction  0 1 1 2  borrows  0 1 1 0 0 0 1 1 (99)  0 1 0 0 1 1 1 1 (79)  0 0 0 1 0 1 0 0 (20)   99 – 79 = 20

9 One’s compliment  1  1 1 1 1 1  carries  0 0 0 1 0 1 1 1 (23)  1 1 1 1 0 1 1 0 (-9)  0 0 0 0 1 1 0 1  + 1  0 0 0 0 1 1 1 0 (14) Flip the bits for all negative numbers. The last carry is added to the sum.

10 Two’s compliment  0 0 0 0 1 0 0 1 (9)  1 1 1 0 1 0 0 1 (-23)  1 1 1 1 0 0 1 0 (-14) Flip the bits for all negative numbers. Add 1. 23 = 00010111 -23 = 11101000 + 1 = 11101001

11  2.6Character Codes  2.6.1 – Binary-Coded Decimal  2.6.2 – EBCDIC  2.6.3 – ASCII  2.6.4 – Unicode Section overview

12 Character codes  We’ve gone over how digital computers use the binary system to represent and manipulate numeric values, but have yet to consider how these internal values can be converted to a form that is meaningful to humans. This is done through a coding system used by the computer and how the values are stored and retrieved.

13 BCD  Binary Coded Decimal (BCD) is very common in electronics, particularly those that display numerical data, such as alarm clocks and calculators.  4-bit binary form later extended to 6  1265 = 0000 0001 0010 0110 0101 1101

14 EBCDIC  Extended Binary Coded Decimal Interchange Code (EBCDIC) used in IBM mainframe and midrange computer systems  8-bit binary form  1265 = 1111 0001 1111 0010 1111 0110 1101 0101

15

16 ASCII  The American Standard Code for Information Interchange (ASCII) was created to better transmit data between systems.  Defines codes for 32 control characters, 10 digits, 52 letters (upper and lower- case), 32 special characters, and more.

17

18 Unicode  16-bit base coding with the capacity to encode the majority of characters used in every language of the world.  Unicode also defines an extension mechanism that will allow for the coding of an additional million characters.  Default character set of the Java programming language.


Download ppt "Nguyen Le CS147.  2.4 Signed Integer Representation  2.4.1 – Signed Magnitude  2.4.2 – Complement Systems  2.4.3 – Unsigned Versus Signed Numbers."

Similar presentations


Ads by Google