computer systems organization cs 1428 foundations of computer science

23
Computer Systems Organization CS 1428 Foundations of Computer Science

Upload: jeffery-hancock

Post on 12-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Systems Organization CS 1428 Foundations of Computer Science

Computer Systems Organization

CS 1428 Foundations of Computer Science

Page 2: Computer Systems Organization CS 1428 Foundations of Computer Science

2

Objectives

In this section, you will:

Review binary data representation

Put all the pieces together – the Von Neumann architecture

Why getting more memory will help your computer run faster

Learn how C++ programs are run by the computer

Page 3: Computer Systems Organization CS 1428 Foundations of Computer Science

Software

Programs are stored in a binary format that is specific to the processor (or virtual machine, in the case of Java)

High-level language programs must be “compiled” into machine language that is targeted toward a specific processor or operating system

3

Page 4: Computer Systems Organization CS 1428 Foundations of Computer Science

From a High-level Program to an Executable File

Slide 1- 4

Source Code

Preprocessor

ModifiedSource Code

Compiler

Object Code

Linker

Executable Code

Page 5: Computer Systems Organization CS 1428 Foundations of Computer Science

5

Representing integers

Decimal integers are converted to binary integers

Given k bits, the largest unsigned integer is 2k - 1

Given 4 bits, the largest is 24-1 = 15

Signed integers must also represent the sign (positive or negative)

Integers often represented in two’s complement

Binary Representation of Numeric and Textual Information

Page 6: Computer Systems Organization CS 1428 Foundations of Computer Science

6

Characters are mapped onto binary numbers ASCII code set

8 bits per character; 256 character codes

What is the numeric code for a capital A? In binary?

UNICODE code set

16 bits per character; 65,536 character codes

Text strings are sequences of characters in some encoding

Binary Representation of Numeric and Textual Information (continued)

Page 7: Computer Systems Organization CS 1428 Foundations of Computer Science

7

Representing real numbers Approximations

Not possible to store all real numbers

Real numbers may be put into binary scientific notation: a x 2b

Example: 101.11 x 20

Number then normalized so that first significant digit is immediately to the right of the binary point

Example: .10111 x 23

Mantissa and exponent then stored

Binary Representation of Numeric and Textual Information (continued)

Page 8: Computer Systems Organization CS 1428 Foundations of Computer Science

8

Representing other data

Almost any analog information can be “digitized” to store on a computer Sound Pictures Video

Page 9: Computer Systems Organization CS 1428 Foundations of Computer Science

9

The Components of a Computer System

Von Neumann architecture has four functional units: Memory Input/Output Arithmetic/Logic unit Control unit

Sequential execution of instructions Stored program concept

Page 10: Computer Systems Organization CS 1428 Foundations of Computer Science

10

Components of the Von Neumann Architecture

Bus

Cache

Page 11: Computer Systems Organization CS 1428 Foundations of Computer Science

11

Memory and Cache

RAM (Random Access Memory) Memory made of addressable 8 bit “cells”

Memory address

Unsigned binary number N bits long

Address space is then 2N cells

Fetch/store controller Fetch: retrieve a value from memory

Store: store a value into memory

Page 12: Computer Systems Organization CS 1428 Foundations of Computer Science

12

Memory and Cache (continued)

Memory register

Very fast storage location

Given a name, not an address

Serves some special purpose

Modern computers have dozens or hundreds of registers

Page 13: Computer Systems Organization CS 1428 Foundations of Computer Science

13

Cache Memory

Memory access is much slower than processing time

Faster memory is too expensive to use for all memory cells

Locality principle

Once a value is used, it is likely to be used again

Small size, fast memory just for values currently in use speeds computing time

Page 14: Computer Systems Organization CS 1428 Foundations of Computer Science

CPU

Control Unit Manages execution

Arithmetic and Logic Unit (ALU) Does calculations

14

Page 15: Computer Systems Organization CS 1428 Foundations of Computer Science

15

The Control Unit

Manages stored program execution

Task

Fetch from memory the next instruction to be executed

Decode instruction: determine what is to be done

Execute instruction: issue appropriate command to ALU, memory, and I/O controllers

Decode

Execute

Fetch

Instruction Cycle

Page 16: Computer Systems Organization CS 1428 Foundations of Computer Science

16

Control Unit Registers And Circuits

Parts of control unit Links to other subsystems Instruction decoder circuit Three special registers:

Program Counter (PC) Stores the memory address of the next instruction to

be executed

Instruction Register (IR) Stores the code for the current instruction

Accumulator (ACC) Where the results of all arithmetic operations and

loads is stored.

Page 17: Computer Systems Organization CS 1428 Foundations of Computer Science

17

The Arithmetic/Logic Unit

Actual computations are performed

Primitive operation circuits Arithmetic (ADD, etc.)

Comparison (CE, etc.)

Logic (AND, etc.)

Data inputs and results stored in registers

Multiplexor selects desired output

Page 18: Computer Systems Organization CS 1428 Foundations of Computer Science

18

Machine Language Instructions

Can be decoded and executed by control unit Always in binary!!

Parts of instructions

Operation code (op code)

Unique unsigned-integer code assigned to each machine language operation

Address field(s)

Memory addresses of the values on which operation will work

Page 19: Computer Systems Organization CS 1428 Foundations of Computer Science

19

Machine Language Instructions (continued)

Operations of machine language

Data transfer

Move values to and from memory and registers

Arithmetic/logic

Perform ALU operations that produce numeric values

Page 20: Computer Systems Organization CS 1428 Foundations of Computer Science

20

Machine Language Instructions (continued)

Operations of machine language (continued)

Compares

Set bits of compare register to hold result

Branches

Jump to a new memory address to continue processing

Page 21: Computer Systems Organization CS 1428 Foundations of Computer Science

21

Pippin ViewAssembly language(Closer to Human Language)

Machine Language(Only thing a computer understands.)

Copyright Notice©2003 PWS Publishing Company, All

Rights Reserved.

Page 22: Computer Systems Organization CS 1428 Foundations of Computer Science

22

Program:LOD #00000011ADD 10000000STO 10000011HLT

Note the error in the documentation. The STO op code is really 0000 0101.

Page 23: Computer Systems Organization CS 1428 Foundations of Computer Science

23

Summary Computer organization examines different

subsystems of a computer: memory, input/output, arithmetic/logic unit, and control unit

Machine language gives codes for each primitive instruction the computer can perform, and its arguments

Von Neumann machine: sequential execution of stored program