Issues in HW - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Issues in HW

Description:

1'Complement Subtraction. To calculate M-N do the following. Let Q = 1's complement of N ... 2's Complement Subtraction. Example: Calculate S = -1610 1410. ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 14
Provided by: sta107
Category:

less

Transcript and Presenter's Notes

Title: Issues in HW


1
Issues in HW1
2
1Complement Subtraction
  • To calculate M-N do the following
  • Let Q 1s complement of N
  • Let S M Q
  • If there is and end carry in step 2, then Answer
    Add 1 to the LSB of S
  • If there is no end-carry in step 2, then Answer
    -1 x (1s complement of S)

3
1Complement Subtraction
  • Example Calculate 1210 1410.
  • Lets use 5 bit representation
  • M 12 01100 and N 14 01110
  • Q 10001
  • S M Q 11101
  • Since there was no end-carry
  • Answer - 00010 (-2)10

4
1Complement Subtraction
  • Example Calculate 810 310.
  • Lets use 6 bit representation
  • M 8 001000 and N 3 000011
  • Q 111100
  • S M Q 000100 with an end carry as 1
  • Since there was an end-carry
  • Answer 00100 00001 00101 (5)10

5
2s Complement Numbers
  • 3-bit example

6
2s Complement Subtraction
  • Example Calculate 1210 1410.
  • Assume 8 bit representation.
  • M 12 00001100, N1400001110
  • 1210 1410 (12)10 (-14)10
  • P -14 11110010
  • S MP 11111110
  • 11111110 (-2)10 in 2s complement

7
2s Complement Subtraction
  • Example Calculate 1610 1410.
  • Assume 8 bit representation.
  • M 16 00010000, N00001110
  • 1610 1410 (16)10 (-14)10
  • P -14 11110010
  • S MP 00000010 with end-carry1
  • Disregard the end carry
  • 00000010 (2)10 in 2s complement

8
2s Complement Subtraction
  • Example Calculate S -1610 1410.
  • Assume 8 bit representation.
  • M 16 00010000, N1400001110
  • -1610 1410 (-16)10 (-14)10
  • O -16 11110000, P -14 11110010
  • S OP 11100010 with end-carry1
  • Disregard the end carry
  • 11100010 - 3010 in 2s complement

9
2s Complement of fraction
  • Find 2s complement of 100.00101
  • N 100.00101
  • n3
  • Let P denote 2s complement of N
  • P 23 100.00101 1000 100.00101
  • Thus P 011.11011

10
1s Complement of fraction
  • Find 1s complement of 100.00101
  • N 100.00101
  • n3, m5
  • Let Q denote 1s complement
  • Q 23 2-5 - 100.00101
  • Or Q 1000 0.00001 - 100.00101
  • Thus Q 011.11010

n
m
11
10s complement
  • 10s complement of an n digit number N is
    defined as
  • 10n N
  • 8 ? 10 8 2 for one digit representation
  • 21 ? 100 21 79 for 2 digit representation
  • 098 ? 1000 098 002 for 2 digit
  • 008 ? 1000 008 992 for 3 digit

12
10s complement
  • Calculate 86 9 using 10s complement
  • Lets use 2 digit representation
  • 86 9 86 09
  • 09 ? 100 09 91 in 10s complement
  • 86 91 77 with end-carry 1
  • Disregard the end-carry
  • Answer 77

13
10s complement
  • Calculate 9 86 using 10s complement
  • Lets use 3 digit representation
  • 9 86 009 086
  • 086 ? 1000 086 914 in 10s complement
  • 009 914 923 with no end-carry
  • Take 10s complement and multiply by -1
  • 923 ? 1000 923 077
  • Answer -077 or -77
Write a Comment
User Comments (0)
About PowerShow.com