Presentation is loading. Please wait.

Presentation is loading. Please wait.

1.6 Signed Binary Numbers. 1 - Sign and Magnitude representation 2 - 1’s Complement Representation 3 - 2’s Complement Representation 1 - The previous.

Similar presentations


Presentation on theme: "1.6 Signed Binary Numbers. 1 - Sign and Magnitude representation 2 - 1’s Complement Representation 3 - 2’s Complement Representation 1 - The previous."— Presentation transcript:

1 1.6 Signed Binary Numbers

2 1 - Sign and Magnitude representation 2 - 1’s Complement Representation 3 - 2’s Complement Representation 1 - The previous representation are the same for positive numbers and different for negative numbers 2 - For a signed binary number the most significant bit is used for representing the sign of the number We use 0 for positive numbers and 1 for negative numbers Notes Example : represent +76

3 Representing negative numbers in the previous three systems 1’s Complement of a negative number can be obtained by flipping all bits of the positive binary number 2’s Complement of a negative number can be obtained by adding 1 to the 1’s Complement or by flipping bits of the positive binary number after the first one from the right Example : represent -76

4 Arithmetic Addition with Comparison The addition of two numbers in the signed mgnitude system follow the rules of ordinary arithmetic. If the signed are the same, we add the two magnitudes and give the sum the common sign. If the signed are different, we subtract the smaller magnitude from the larger and give the difference the sign of the larger magnitude. EX. (+25) + (-38) = -( ) = -13 Arithmetic Addition

5 Arithmetic Addition without Comparison The addition of two signed binary number with negative numbers represented in signed 2’s complement form is obtained from the addition of the two numbers, including their signed bits. A carry out of the signed bit position is discarded (note that the 4th case).

6 Arithmetic Addition without Comparison                        6

7 Arithmetic Subtraction (+/-) A – (+B)= (+/-) A + (-B) (+/-) A – (-B)= (+/-) A + (+B) Example (-6) – (-13)= +7 In binary: ( – )= ( ) = after removing the carry out the result will be :

8 1.7 Binary Codes

9 Binary Coded Decimal (BCD)

10 in this system each digit is represented in 4 bits For example : to represent in BCD

11 BCD Addition Example : Evaluate the following operations in BCD System 1 – –

12 BCD Addition Example : Evaluate the following operations in BCD System 1 – – Error We must add 6 (0110) to the result

13 BCD Addition Example : Evaluate the following operations in BCD System 1 – –

14 1 – In BCD Addition, we add (0110)=(6) if the result value was greater than (1001)=(9) or if the result was more than 4 digits Notes In previous Example we added 0110 when the result was 1 - greater than 9 (1001) 2 - more than 4 digits (10000) Note : result more than 4 digit is greater than 9(1001)

15 Decimal Arithmetic Addition for signed numbers Example: (+375) + (- 240) = in BCD Apply 10‘s complement to the negative number only. Addition is done by summing all digits,including the sign digit,and discarding the end carry

16 Decimal Arithmetic Subtraction for signed and unsigned numbers Apply 10‘s complement to the subtrahend and apply addition (same as binary case)

17 (ex-3) is like (BCD) in the way of representing number i.e. each digit is represented in 4 bits Except that : each digit is firstly incremented by three Excess-3 (ex-3) Excess-three (ex-3)is another system to represent a number For example : to represent in ex-3

18

19 Gray Code

20 ASCII code is used to represent characters, Symbols, … ASCII code consists of 7-bits (to represent 128 character) ASCII character code ASCII : American Standard Code for Information Interchange Upper case Letters are represented by ASCII (65 : 90) Lower case Letters are represented by ASCII (97 : 122) #ASCIICh A B Z a b z

21

22 Error Detecting Code with even parity with odd parity ASCII A ASCII T

23

24 For more information about Number Systems and Conversations between them Check these 1 – Our Logic Book 2 - Computer Organization's Lectures 3 – Any other References


Download ppt "1.6 Signed Binary Numbers. 1 - Sign and Magnitude representation 2 - 1’s Complement Representation 3 - 2’s Complement Representation 1 - The previous."

Similar presentations


Ads by Google