The von Neumann Model - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

The von Neumann Model

Description:

Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP 2610 Signed Integers Thus, for simplicity of hardware we use the two s complement ... – PowerPoint PPT presentation

Number of Views:102
Avg rating:3.0/5.0
Slides: 11
Provided by: ncc124
Category:

less

Transcript and Presenter's Notes

Title: The von Neumann Model


1
1
Bits, Data types, and Operations Chapter 2
COMP 2610
Dr. James Money COMP 2610
2
Signed Integers
  • Thus, for simplicity of hardware we use the twos
    complement representation
  • How do we compute twos complement?
  • Write the magnitude of the number in binary
  • Compute the ones complement, that is flip the
    bits
  • Add one to the result

3
Signed Integers
  • How do we reverse twos complement?
  • We apply it again!
  • That is
  • twos complement(twos complement(N)) N

4
Signed Integers
  • If the following 6 bits number is in twos
    complement form, what is the number?
  • (101001)2
  • Compute ones complement (010110)2
  • Add one (010111)2 (23)10
  • Thus, the number is -23

5
Binary to Decimal Conversion
  • We now systematically look at convert from binary
    to decimal for twos complement stored integers
  • We assume the binary number is in the form
  • M(bn bn-1 b2 b1 b0)2
  • where bi is either 0 or 1.

6
Binary to Decimal Conversion
  • Consider the leading bit bn. If it is zero, the
    integer is positive or zero. If it is one, the
    integer is negative.
  • If bn1, then compute the twos complement of
    bn-1b1b0. Then
  • bn-1x2n-1 b2x22 b1x21 b0x20
  • is the magnitude of the value
  • If the leading bit bn was 1, then add the
    negative sign.

7
Binary to Decimal Conversion
  • Convert the following twos complement
    representations to their decimal values
  • 1100 0011
  • 0011 0110
  • 1111 1110

8
Decimal to Binary Conversion
  1. Take the magnitude of the decimal number
  2. Convert the magnitude of the number to binary
    form
  3. If the number is negative, compute the twos
    complement of the number

9
Review of Unsigned Integers
  • To convert from positive decimal number M to
    binary
  • Set xM, k0
  • Compute x2 y R bk
  • Set xy, kk1
  • Go to 2 if x?0 and repeat
  • The bits are the remainders listed right to left
    b3b2b1b0

10
Decimal to Binary Conversion
  • Convert the following decimal numbers to their
    twos complement forms for 8 bits
  • 45
  • -34
  • -2
  • 0
Write a Comment
User Comments (0)
About PowerShow.com