Introduction to
Computer Organization I
September 5, 2017
1
Why do we study computer organization
and assembly languages?
To understand how a computer works internally.
To maximize the efficiency of computer software.
To build NEW! Computers.
Why maximize efficiency?
Programs and data are getting bigger and bigger
Save costs
How to maximize efficiency?
Understand the limits of hardware
Write good software
2
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
Optimization
Scheduling, EDA (to design new computers!), financial engineering
Simulation
Aeroplane Design, Traffic Modelling, Flight Simulation
Communications
Chat, Email, Instant Message, Video Conferencing 3
What are computers used for?
Email Computer-Aided Design
Internet Browsing Air-Traffic Control
Games Weather Prediction
Databases Weapons
Word Processing Design Drugs
Spreadsheets Oil Exploration
Desktop/ Web Publishing Human Genome Project
Accounts/ Stock Control/ Banking Financial Markets
Payroll Nuclear Reactor Control
Education Exploring Space
Machines/ Appliances/ Electronic Art: Music, Pictures, Movies,
Devices creation and distribution
4
Math Quiz!
Try to answer the following questions
1. 4x7+5=?
A: 19 B: 48 C: 33 D: 29
2. 33x2+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
5
Basic Functional Units of a Computer
Registers
Input
Arithmetic
and
Memory logic
Output
Control
I/O Processor/ CPU
Instructions 6
Analogy: A student taking a Math quiz
Input: Math question (4 x 7 + 5)
Output: Multiple-choice answers
Memory: Arithmetic rules (x before +)
Multiplication table
Keeping 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
7
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.
8
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 or 64-bits today
Typically 32-bit 64-bit machines nowadays
Primary storage: random-access memory (RAM)
Secondary storage: hard disk, CDROM, etc. 9
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
Control the transfer of data and sequencing of operations between
memory, registers, ALU, I/O devices
10
Connecting the Components with Dedicated/ Multiple Buses
Keyboard Disk
I/O
I/O
I/O bus
CPU I/O bus Controller 1
Controller 2
Memory DMA bus
bus (Direct Memory Access)
Buses are connecting
paths between Main
components in a Memory
computer, and even
between computers.
11
[Link]
Connecting the Components
Example: Example:
with Shared-Bus Structure
keyboard printer
I/O Controller I/O Controller 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
12
Computer Memory
13
Memory Hardware: Chips and Modules
14
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.
15
SI Prefix (International System of Units)
[Source: [Link]
[See also: [Link]
10n Prefix Symbol Short Scale Long Scale Decimal Equivalent
1012 tera- T Trillion Billion 1 000 000 000 000
Milliard
109 giga- G Billion 1 000 000 000
(thousand million)
106 mega- M Million 1 000 000
103 kilo- k Thousand 1 000
102 hecto- h Hundred 100
101 deca- da Ten 10
100 (none) (none) One 1
101 deci- d Tenth 0.1
102 centi- c Hundredth 0.01
103 milli- m Thousandth 0.001
106 micro- Millionth 0.000 001
109 nano- n Billionth Milliardth 0.000 000 001
1012 pico- p Trillionth Billionth 0.000 000 000 001
1015 femto- f Quadrillionth Billiardth 0.000 000 000 000 001
16
Main Memory (MM) Organization
Address
0 word 0
In a main memory with 1 word 1
m-bit addresses, 2 word 2
:
0 to 2m-1 words are available. :
:
i word i
Each word stores n bits
m, n are independent
m specifies the number of units; 2 m -1 word 2 m -1
n specifies the unit size
m bits n bits
What is the total number of bits?
17
Memory Unit: Addressability
The smallest unit addressable in a machine instruction is the addressability of the computer.
Most modern computers are byte addressable although their word length is 32 bits or greater.
Addressability is associated with a CPU, not the main memory!
Main Memory
byte byte
CPU
byte word word word
byte
addressability word length
18
Memory: Contents of a Word (I)
Hereisanexampleofa32bitword.
b31 b30 b1 b0
32bits(wordlength)
[Link],
[Link],eachencodedinacommon8bit code
ASCII:AmericanStandardCodeforInformationInterchange
or
EBCDIC:ExtendedBinaryCodedDecimalInterchangeCode
char3:8bit char2:8bit char1:8bit char0:8bit
19
Memory: Contents of a Word (II)
[Link]
16bits 16bits
Big5/GBcode
3.A32bitSignedinteger
b31 b30 b1 b0
signbit
b31=0meanspositiveinteger,b31=1meansnegativeinteger
magnitude=b30x230++b0x20
4.A32bitmachineinstruction
8bits 12bits 12bits
operationcode addressfield addressfield 20
Central Processing Unit (CPU)
Intel Pentium
IBM Power PC
Digital signal
processor IC
ARM 9
21
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
22
CPU on a Chip Microprocessor
[Link]
23
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
24
Performance Measurement
The performance of a CPU can be measured in MIPS:
10
It can also be measured by the number of clock ticks per
second. For example, a 2.2GHz chip has a clock running
at 2.2x109 ticks per second.
25
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.
26