Computer Science 210 Computer Organization - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Computer Science 210 Computer Organization

Description:

Computer Science the study of algorithms, including. Their formal ... Often used by people who need to see the internal representation of data, programs, etc. ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 28
Provided by: tomwh
Category:

less

Transcript and Presenter's Notes

Title: Computer Science 210 Computer Organization


1
Computer Science 210Computer Organization
  • Course Introduction
  • Binary Integers

2
A Definition of Computer Science
  • Computer Science the study of algorithms,
    including
  • Their formal and mathematical properties
  • Their hardware realizations
  • Their linguistic realizations
  • Their applications
  • Gibbs and Tucker, A Model Curriculum for a
    Liberal Arts Degree in Computer Science, Comm.
    Of the ACM 29, no. 3(March,1986)

3
Our Core Requirements
CS210 Computer Organization(Their hardware
realizations)
CS211Data Structures andAlgorithms(Their
mathematical properties)
Algorithms
CS313 Theory of Computation(Their formal
properties)
CS312Programming LanguageDesign(Their
linguistic realizations)
4
Their Applications
  • Interactive Computer Graphics
  • Image Processing
  • Database Management
  • Artificial Intelligence
  • Genetic Algorithms
  • etc.

5
Topics for Course
  • Internal representation of data and instructions
  • Major components of computer - overview
  • Low level programming of computer assembly and
    machine language
  • High level programs as seen by computer
  • Logic gates and computer circuitry
  • Detailed look at major components

6
Why?
  • General education as a computer science
    professional
  • Better understanding of high level programming
  • More efficient use of computer
  • Better understanding of compilers, operating
    system issues
  • May have need to operate at low levels from time
    to time

7
Review of Binary SystemsHumans use
  • Decimal Numbers (base 10)
  • Decimal Fractions (23.27)
  • Letters for text

8
Computers
  • Binary Numbers (base 2)
  • Binary fractions and floating point
  • ASCII (or Unicode) codes for characters (A?65)

9
Why binary?
  • Information is stored in computer via voltage
    levels.
  • Using decimal would require 10 distinct and
    reliable levels for each digit.
  • This is not feasible with reasonable reliability
    and financial constraints.
  • Everything in computer is stored using binary
    numbers, text, programs, pictures, sounds,
    videos, ...

10
Decimal Non-negatives
  • Base 10
  • Uses decimal digits 0,1,2,3,4,5,6,7,8,9
  • Positional System - position gives power
  • Example 3845 3x103 8x102 4x101 5x100
  • Positions 543210

11
Binary Non-negatives
  • Base 2
  • Uses binary digits (bits) 0,1
  • Positional system
  • Example 1101 1x23 1x22 0x21 1x20

12
Conversions
  • External Internal(Human)
    (Computer) 25 11001
    A 01000001
  • Humans want to see and enter numbers in decimal.
  • Computers must store and compute with bits.

13
Binary to Decimal Conversion
  • Algorithm
  • Expand binary number using positional scheme.
  • Perform computation using decimal arithmetic.
  • Example110012 ? 1x24 1x23 0x22 0x21
    1x20 24 23 20 16 8
    1 2510

14
Decimal to Binary
  • Algorithm 1 Set A to 0 (all bits 0) While N ?
    0 do Find largest P with 2P ? N Set bit in
    position P of A to 1 Set N to N - 2P

15
Decimal to binary - Example
  • Example Convert 32410 to binary N
    Power P A .
    324 256 8 100000000 68
    64 6 101000000 4 4 2
    101000100 0
  • 32410 1010001002

16
Decimal to Binary
  • Algorithm 2 While N ? 0 do Set N to N/2
    (whole part) Record the remainder (1 or 0) Set
    A to remainders in reverse order

17
Decimal to binary - Example
  • Example Convert 32410 to binary N
    Rem N Rem 324 162 0 5 0
    81 0 2 1 40 1 1 0 20 0 0 1 10 0
  • 32410 1010001002

18
Binary Addition
  • One bit numbers 0 1 0 0
    1 1 1 10
  • Example 1111 1 110101 (53)
    101101 (45) 1100010 (98)

19
Overflow
  • In a given type of computer, the size of integers
    is a fixed number of bits.
  • 16 or 32 bits are popular choices
  • It is possible that addition of two n bit numbers
    yields a result requiring n1 bits.
  • Overflow is the term for an operation whose
    results exceeds the size allowed for a number.

20
Negatives Twos complement
  • With N bit numbers, to compute negative
  • Invert all the bits
  • Add 1
  • Example -25 in 8-bit twos complement
  • 25 ? 00011001
  • Invert bits 11100110
  • Add 1 1 11100111

21
2s Complement Examples
  • Compute negative of -25 (8-bits)
  • We found -25 to be 11100111
  • Invert bits 00011000
  • Add 1 00011001
  • Recognize this as 25 in binary
  • Add -25 and 37 (8-bits)
  • 11100111 (-25) 00100101 (
    37) (1)00001100
  • Recognize as 12

22
Facts about 2s Complement
  • Leftmost bit tells whether number is positive or
    negative
  • 2s complement is same as before for positives

23
2s complement to decimal (examples)
  • Assume 8-bit 2s complement
  • X 11011001 -X 00100110 1 00100111
    32421 39 (decimal) So, X -39
  • X 01011001Since X is positive, we have X
    641681 89

24
Ranges for N-bit numbers
  • Unsigned (positive)
  • 000000 or 0
  • 111111 which is 2N-1
  • For N8, 0 - 255
  • 2s Complement
  • 100000 which is -2N-1
  • 011111 which is 2N-1 - 1
  • For N8, -128 to 127

25
Octal Numbers
  • Base 8 Digits 0,1,2,3,4,5,6,7
  • Not so many digits as binary
  • Easy to convert to and from binary
  • Often used by people who need to see the internal
    representation of data, programs, etc.

26
Octal Conversions
  • Octal to Binary
  • Simply convert each octal digit to a three bit
    binary number.
  • Example 5368 101 011 1102
  • Binary to Octal
  • Starting at right, group into 3 bit groups
  • Convert each group to an octal digit
  • Example 110111111010102 011 011 111 101
    010 337528

27
Hexadecimal
  • Base 16 Digits 0,,9,A,B,C,D,E,F
  • Hexadecimal ? Binary
  • Just like Octal, only use 4 bits per digit.
  • Example 98C316 1001 1000 1100 00112
  • Example110100111010112 0011 0100 1110 1011
    34EB
Write a Comment
User Comments (0)
About PowerShow.com