40
1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak www.cse.cuhk.edu.hk/~stmak

1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

Embed Size (px)

Citation preview

Page 1: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

1

CSCI2510 Computer Organization

Introduction

Terrence Sui-tung Mak

www.cse.cuhk.edu.hk/~stmak

Page 2: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

Overview

What is a Computer? What is a Computer used for? Basic components

– CPU– Memory– Performance measure– Architectures– Networks-on-chip

2

Page 3: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

3

Why do we study computer organization? • To maximize the efficiency of computer• To design NEW computers

Why maximize efficiency? • Programs and data are getting bigger and bigger• Save costs

How to maximize efficiency?• Understand the constraints and capabilities of

hardware• Write good software

Page 4: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

4

Apple Macintosh “Personal Computer” (ca. 1990)

What is a Computer?

Page 5: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

5

What is a Computer?

Thinking Machines “Connection Machine”

Page 6: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

6

What is a Computer?

Page 7: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

Evolution of Computing The First Generation

– First transistor, UNIAC, ENIVAC

The Second Generation– First integrated circuit,

The Third Generation– Microprocessor, Intel, Apple,

IBM … The Forth Generation

– Embedded systems

Page 8: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

8

What are Computers used for? Word processing Image processing Art

– Music/ Pictures/ Movies Creation and Distribution Entertainment

– Games, Virtual Reality, Movie Special Effects Artificial Intelligence

– Face Detection, Robotics, Computer Games Simulation

– Aeroplane Design, Nuclear Reactor Controller Training, Traffic Modelling, Flight Simulation

Communications– Chat, Email, Instant Message, Video Conferencing

Page 9: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

9

What are Computers used for? Computer-Aided Design Air-Traffic Control Weather Prediction Weapons Design Drugs Oil Exploration Human Genome Project Financial Markets Nuclear Reactor Control Exploring Space Art: Music, Pictures, Movies,

creation and distribution

Email Internet Browsing Games Databases Word Processing Spreadsheets Desktop/ Web Publishing Accounts/ Stock Control/ Banking Payroll Education Machines/ Appliances/ Electronic

Devices

Page 10: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

10

Computers & Central Processing Units

COMPUTER

Apple

Power Macintosh

7100/66

CPU

Motorola

PowerPC 601/66

Page 11: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

11

CPUs

Intel Pentium Motorola/ IBM PowerPC AMD K7 ARM StrongArm Compaq (DIGITAL) Alpha Zilog Z80 Motorola 68000 MOS Tech 6502 (Apple II) MIPS

Interesting details about CPUs: http://en.wikipedia.org/wiki/Cpu

Plus… Marketing Gimmicks

Intel Core2 Duo/ Centrino/ Pentium MMotorola DragonBallSun UltraSparc T2 (OpenSparc T2)etc.

Company namesBrand namesProcessor family/ seriesSpecific product names

Page 12: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

12

Math Quiz!

Try to answer the following questions

1. 4 x 7 + 5 = ?A: 19 B: 48 C: 33 D: 29

2. 3 – 3 x 2 + 9 = ?A: 3 B: 6 C: 9 D: 12

3. 6 + 5 x 8 – 1 x (-3) = ?A: 10 B: 43 C: 91 D: 49

Page 13: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

13

Course Aims

instructions

I/O Processor/ CPU

Output

Memory

Input

andArithmetic

logic

Control

Registers

In this course, we shall focus on the Organisation and Operation of the CPU. This involves computer architecture and assembly language programming

Page 14: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

Computer Organization Binary numbers – Radixes (2,16), conversions and

arithmetic Data representation – Integers, integer arithmetic, real, text Main memory organization – Byte-ordering, alignment,

interleaving CPU organization and operation – Instructions, registers,

fetch-execute cycle CPU and programming – Registers, addressing modes,

high-level programs Input/Output control – Devce types, polling, interrupts,

device driven

14

Page 15: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

15

Analogy: A Student Taking a Math Quiz Input: Math question (4 x 7 + 5) Output: Multiple-choice answers Memory: Arithmetic rules (x before +)

Multiplication tableKeeping numbers 4, 7 and 5

Register: Temporary sum (4 x 7 = 28) ALU: Computation (28 + 5 = 33) Control: Execute rules

Decide when to read input,when to compute and stop

Page 16: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

16

Input/ Output Unit Overview

Input units– Keyboard, mouse, microphone, CDROM, etc.

Output units– Graphical display, printer, etc.

The collective term input/ output (I/O) units– Input units, output units, disk drives, etc.

Page 17: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

17

Memory Unit Overview

Memory is used to store programs and data

[Low-level] Unit of access is an n-bit word– Unique location is its address– Retrieval is in units of words– Commonly 32-bit today, moving to 64-bits– Typically 16-bit – 64-bit machines nowadays

Primary storage: random-access memory (RAM)

Secondary storage: hard disk, CDROM, etc.

Page 18: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

18

Processor Overview

Registers– Small but fast storage of intermediate values in a computation

Arithmetic logic unit (ALU): performs computations – e.g. arithmetic operations: add, subtract, multiply, divide, etc.– e.g. logical operations: and, or, not, xor, etc.– c.f. calculator– Operands taken from registers

Control– Orchestrates the transfer of data and sequencing of operations

between memory, registers, ALU, I/O devices

Page 19: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

19

CPU

Memory bus

Main Memory

I/O Controller

1

I/O

Controller 2

DMA bus(Direct Memory Access)

I/O busI/O bus

DiskKeyboard

Connecting the Components with Dedicated/ Multiple Buses

Buses are connecting paths between components in a computer, and even between computers.

http://en.wikipedia.org/wiki/Computer_bus

Page 20: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

20

Connecting the Components with Shared-Bus Structure

MemoryI/O Controller Processor 2I/O Controller

•All devices have same address structure

•All devices can be controlled by common machine instructions

•Only two devices can do data communication simultaneously

Information carried along a bus: address, data , control

Example:

printer

Example:

keyboard

Processor 1

Page 21: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

21

Bus

Allows computer to be customized for different applications e.g. different peripherals

Design criteria – speed, cost, etc.

Word length can be different depending on application– E.g. USB is serial (1-bit), PCI bus is 32-bit

Page 22: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

22

Let's Take a Break

Page 23: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

23

Computer Memory

Page 24: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

24

Memory Hardware: Chips and Modules

Page 25: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

25

Digital (Binary) Memory

• Primary storage, main storage, main memory• Fast Access (when compared to I/O)

Unitsbit (1 binary digit, a value of 0 or 1)

Byte (1 byte = 8 bits)

WordManipulation of data by CPU is in words.A single access results in one word of data being

transferred.

Word length is specified in number of bits/ bytes:for example, 8-bit, 16-bit, 32-bit, 64-bit, 4-byte, etc.

Page 26: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

26

Main Memory (MM) Organization

•In a main memory with m-bit addresses, 0 to 2m-1 words are available.

•Each word stores n bits

•m, n are independent

•m specifies the number of units; n specifies the unit size

•What is the total number of bits?

word 0word 1word 2

:::

word i

word 2 m -1

012

i

2m -1

address

m bits n bits

Page 27: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

27

A word can store information. For example,

1. Four English characters, each encoded in a common 8-bit codeASCII: American Standard Code for Information Interchange

orEBCDIC: Extended Binary Coded Decimal Interchange Code

Memory: Contents of a Word (I)

b31 b30 b1 b0

32 bits (word length)

Here is an example of a 32-bit word.

char 3: 8-bit char 2: 8-bit char 1: 8-bit char 0: 8-bit

Page 28: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

28

2. Two Chinese characters

3. A 32-bit Signed integer

b31=0 means positive integer, b31=1 means negative integermagnitude = b30230 + … + b0 20

4. A 32-bit machine instruction

16 bits 16 bitsBig5/GB code

b31 b30 b1 b0

sign bit

8 bits 12 bits12 bitsoperation code address field address field

Memory: Contents of a Word (II)

Page 29: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

29

Central Processing Unit (CPU)

IBM Power PC

Intel Pentium

ARM 9

Digital signal processor IC

Page 30: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

30

Some Intel CPUs4004800880808088/ 8086 [x86]8018680286 [286]80386 [386]80486 [486]Pentium [586]Pentium MMXPentium PRO [686]Pentium IIPentium IIIPentium 4Core2 Duo

Page 31: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

31

CPU on a Chip Microprocessor

http://micro.magnet.fsu.edu/chipshots/index.html

Page 32: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

32

CPU What does a CPU do?

It executes programs.

What is a program?Program = Instruction + Data

Where are the instructions and data? In Memory – when they are not being processedIn CPU – when they are being processed

Page 33: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

33

Let's Take a Break

Page 34: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

34

Performance Measurement

Computer architects use performance estimates to evaluate the effectiveness of new features– Practice is to use benchmarks available to all

manufacturers– e.g. SPEC benchmark (www.spec.org)

Benchmark figures are for comparing real computers

Page 35: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

35

SPEC Benchmark

SPEC CPU2006 uses a historical Sun system, the "Ultra Enterprise 2" which was introduced in 1997, as the reference machine (SPEC FAQ Q.23)

The reference machine uses a 296 MHz UltraSPARC II processor

Each benchmark runs a set of program to measure the execution times. These times are then used in the SPEC calculations

Value indicates a machine how much faster than the reference machine– e.g. SPEC rating of 10 means it is 10 faster than the reference machine

Page 36: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

36

How a program is executed

Program and data reside on secondary storage such as CDROM or hard disk are transferred to the memory

Data (stored in memory) is fetched under program control (also in memory) into ALU and processed

Processed information sent back to I/O unit

All activities directed by control unit

Page 37: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

37

Mem

ory

co

ntro

ller

Con

trol u

nit

MAR

MDR

R/W

MFC

ADDRESS

INSTRUCTION / DATA

CPU and MEMORY

Memory bus: Control bus, Data bus and Address bus

Page 38: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

38

The following is the Memory Read Operation:

CPU(Read)

CONTROLLER

MEMORY

(RAM)

ADDRESS (MAR)

Control Signal (READ)

DATA (MDR)

Control Signal (MFC) T2

T2

T1

T1

Data can be assumed to have arrived when the control unit receives the MFC (Memory Function Completed) signal!

CPU and MEMORY

Page 39: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

39

CPU(Write)

CONTROLLER

MEMORY

(RAM)

ADDRESS (MAR)

Control signal (WRITE)

MFC (CONTROL)

Data T1

T2

T1

T1

CPU and MEMORY

The following is the Memory Write Operation:

Page 40: 1 CSCI2510 Computer Organization Introduction Terrence Sui-tung Mak stmak

40

Summary

Overview of the functional components and the bus structures of a modern microcomputer system

Basic structure and operation of a CPU

Overview of the Main Memory organization

Interaction of the CPU and the Main Memory