Computer Organization

advertisement
CSCI2510 Computer Organization
Introduction
Terrence Sui-tung Mak
www.cse.cuhk.edu.hk/~stmak
1
Overview



What is a Computer?
What is a Computer used for?
Basic components
– CPU
– Memory
– Performance measure
– Architectures
– Networks-on-chip
2

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
3
What is a Computer?

Apple Macintosh “Personal Computer”
(ca. 1990)
4
What is a Computer?

Thinking Machines “Connection Machine”
5
What is a Computer?
6
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
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
8
What are Computers used for?












Email
Internet Browsing
Games
Databases
Word Processing
Spreadsheets
Desktop/ Web Publishing
Accounts/ Stock Control/ Banking
Payroll
Education
Machines/ Appliances/ Electronic
Devices










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
9
Computers & Central Processing Units
COMPUTER
Apple
Power Macintosh
7100/66
CPU
Motorola
PowerPC 601/66
10
CPUs
Plus… Marketing Gimmicks










Intel Pentium
Motorola/ IBM PowerPC
AMD K7
ARM StrongArm
Compaq (DIGITAL) Alpha
Zilog Z80
Motorola 68000
MOS Tech 6502 (Apple II)
MIPS
Intel Core2 Duo/ Centrino/ Pentium M
Motorola DragonBall
Sun UltraSparc T2 (OpenSparc T2)
etc.
Company names
Brand names
Processor family/ series
Specific product names
Interesting details about CPUs:
http://en.wikipedia.org/wiki/Cpu
11
Math Quiz!

1.
2.
3.
Try to answer the following questions
4x7+5=?
A: 19 B: 48 C: 33 D: 29
3–3x2+9=?
A: 3 B: 6 C: 9 D: 12
6 + 5 x 8 – 1 x (-3) = ?
A: 10 B: 43 C: 91 D: 49
12
Course Aims
In this course, we shall focus on the Organisation
and Operation of the CPU. This involves computer
architecture and assembly language programming
Registers
Input
Memory
Arithmetic
and
logic
Output
Control
I/O
Processor/ CPU
instructions
13
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
Analogy: A Student Taking a Math Quiz






Input:
Output:
Memory:
Register:
ALU:
Control:
Math question (4 x 7 + 5)
Multiple-choice answers
Arithmetic rules (x before +)
Multiplication table
Keeping numbers 4, 7 and 5
Temporary sum (4 x 7 = 28)
Computation (28 + 5 = 33)
Execute rules
Decide when to read input,
when to compute and stop
15
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.
16
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.
17
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
18
Connecting the Components with Dedicated/ Multiple Buses
Disk
Keyboard
I/O
Controller 2
I/O bus
CPU
I/O bus
DMA bus
(Direct Memory Access)
Memory
bus
Buses are connecting
paths between
components in a
computer, and even
between computers.
I/O
Controller 1
Main
Memory
19
http://en.wikipedia.org/wiki/Computer_bus
Example:
Example:
keyboard
printer
I/O Controller
I/O Controller
Connecting the Components
with Shared-Bus Structure
Memory
Processor 1
Processor 2
Information carried along a bus: address, data , control
•All devices have same address structure
•All devices can be controlled by common machine instructions
•Only two devices can do data communication simultaneously
20
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
21
Let's Take a Break
22
Computer Memory
23
Memory Hardware: Chips and Modules
24
Digital (Binary) Memory
•
•
Primary storage, main storage, main memory
Fast Access (when compared to I/O)
Units
bit (1 binary digit, a value of 0 or 1)
Byte (1 byte = 8 bits)
Word
Manipulation 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.
25
Main Memory (MM) Organization
•In a main memory with
m-bit addresses,
0 to 2m-1 words are available.
•Each word stores n bits
address
0
1
2
i
word 0
word 1
word 2
:
:
:
word i
•m, n are independent
•m specifies the number of units;
n specifies the unit size
2 m -1
word 2 m -1
m bits
n bits
•What is the total number of bits?
26
Memory: Contents of a Word (I)
Here is an example of a 32-bit word.
b31
b30
b1
b0
32 bits (word length)
A word can store information. For example,
1. Four English characters, each encoded in a common 8-bit code
ASCII: American Standard Code for Information Interchange
or
EBCDIC: Extended Binary Coded Decimal Interchange Code
char 3: 8-bit
char 2: 8-bit
char 1: 8-bit
char 0: 8-bit
27
Memory: Contents of a Word (II)
2. Two Chinese characters
16 bits
16 bits
Big5/GB code
3. A 32-bit Signed integer
b31 b30
b1
b0
sign bit
b31=0 means positive integer, b31=1 means negative integer
magnitude = b30230 + … + b0 20
4. A 32-bit machine instruction
8 bits
12 bits
operation code
address field
12 bits
address field
28
Central Processing Unit (CPU)
Intel Pentium
IBM Power PC
Digital signal
processor IC
ARM 9
29
Some Intel CPUs
4004
8008
8080
8088/ 8086 [x86]
80186
80286 [286]
80386 [386]
80486 [486]
Pentium [586]
Pentium MMX
Pentium PRO [686]
Pentium II
Pentium III
Pentium 4
Core2 Duo
30
CPU on a Chip  Microprocessor
http://micro.magnet.fsu.edu/chipshots/index.html
31
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 processed
In CPU – when they are being processed
32
Let's Take a Break
33
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
34
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
35
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
36
CPU and MEMORY
Memory bus: Control bus, Data bus and Address bus
ADDRESS
Control unit
R/W
MFC
MDR
Memory controller
MAR
INSTRUCTION / DATA
37
CPU and MEMORY
The following is the Memory Read Operation:
ADDRESS (MAR)
CPU
(Read)
T1
Control Signal (READ)
T1
DATA (MDR)
T2
Control Signal (MFC)
T2
C
O
N
T
R
O
L
L
E
R
M
E
M
O
R
Y
(RAM)
Data can be assumed to have arrived when the control unit
receives the MFC (Memory Function Completed) signal!
38
CPU and MEMORY
The following is the Memory Write Operation:
ADDRESS (MAR)
Control signal (WRITE)
CPU
(Write)
MFC (CONTROL)
Data
T1
T1
T2
T1
C
O
M
N
E
T
M
R
O
O
R
L
Y
L (RAM)
E
R
39
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
40
Download