Docsity

Understanding Negative Binary Numbers: Signed Magnitude, One's Complement, and Two's Compl, Slides of Microprocessors

Partial preview of the text

Download Understanding Negative Binary Numbers: Signed Magnitude, One's Complement, and Two's Compl and more Slides Microprocessors in PDF only on Docsity!

  • In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative
  • The same is true for binary numbers a computer won’t understand that
  • What happens in memory then?

Negative Binary Numbers

  • There are several representations - Signed magnitude - One’s complement - Two’s complement
  • Two’s complement is the system used in microprocessors
  • Most significant bit becomes important

Binary Negative Numbers

  • Method: Invert the ones and zeros
  • 11 10

10

  • 0 in MSB implies positive
  • 1 in MSB implies negative

One’s Complement

  • Method: Take the one’s complement and add 1
  • 11 10
  • - 1110 = 11110100 one’s comp
  • - 1110 = 11110101 two’s comp

Two’s Complement

  • Consider 10 – 6 using binary subtraction
  • 00001010 10
  • 00000110 6
  • 00000100 subtract gives 4

Subtraction by Addition

  • Consider 10 – 6 using two’s complement
  • 0001010 10
  • 11111010 6
  • (1) 00000100 adding gives 4

Subtraction by Addition

  • Only need one type of hardware/process to add both signed and unsigned numbers. .

Why two’s complement