What Goes On Inside The Computer: The Central Processing Unit
What Goes On Inside The Computer: The Central Processing Unit
CPU
Microprocessor
Intel Intel-compatible
• Pentium • Cyrix
• Celeron • AMD
• Xeon and Itanium
Types of
Microprocessors
• PowerPC
– Cooperative efforts of Apple, IBM, and
Motorola
– Used in Apple Macintosh family of PCs
– Found in servers and embedded systems
• Alpha
– Manufactured by Compaq
– High-end servers and workstations
Microprocessor
Components
• Control Unit – CU
• Arithmetic / Logic Unit – ALU
• Registers
• System clock
Data
Representation
On/Off
Binary number system is used
to represent the state of the
circuit
Bits, Bytes, Words
• BIT
– Binary DigIT
– On/off circuit
– 1 or 0
• BYTE
– 8 bits
– Store one alphanumeric character
• WORD
– Size of the register
– Number of BITS that the CPU processes as a unit
Coding Schemes
• ASCII
– Uses one 8 bit byte
– 28 = 256 possible combinations or characters
– Virtually all PCs and many larger computers
• EBCDIC
– Uses one 8 bit byte
– 28 =256 possible combinations or characters
– Used primarily on IBM-compatible mainframes
• Unicode
– Uses two 8 bit bytes (16 bits)
– 216 = 65,536 possible combinations or characters
– Supports characters for all the world’s languages
– Downward-compatible with ASCII
The CPU
Control Unit
CU
Addition
Subtraction
Multiplication
Division
Logical Operations
• Evaluates conditions
• Makes comparisons
• Can compare
– Numbers
– Letters
– Special characters
1 Bit ALU
Registers
Special-purpose
High-speed
Temporary storage
Located inside CPU
Process
D
C
B
A
One Program Counter
Time
A CPU can really run only ne process at a time, if there are 2 cores Each of them can
run only one process at a time
The Register Set
I-time
• CU fetches an instruction from memory and puts it
into a register
• CU decodes the instruction and determines the
memory location of the data required
Machine Cycle
E-time
• Execution
– CU moves the data from memory to registers in the
ALU
– ALU is given control and executes the instruction
– Control returns to the CU
• CU stores the result of the operation in memory
or in a register
Direct memory instruction
• Addresses refer directly to memory locations containing the
operands (data) on which the program operates
inputs from
environment
state variable
Fetch
Add Store
Load … Goto
… … … …
…
Add 1
to IP
The Fetch-and-
Execute Cycle
• the action required is to copy the word specified by the address part
of the instruction into the accumulator
2 a
1 c
3 b
r1 2
r2
r3
Logic Memory
r4
IR Load a into r1 Load a into r1 2005
Load b into r3 2006
IP 2005
r2 r1 + r3 2007
Store r2 into c 2008
CPU
Running the Program
2 a
1 c
3 b
r1 2
r2
r3 3
Logic Memory
r4
IR Load b into r3 Load a into r1 2005
Load b into r3 2006
IP 2006
r2 r1 + r3 2007
Store r2 into c 2008
CPU
Running the Program
2 a
1 c
3 b
r1 2
r2 5
r3 3
Logic Memory
r4
IR r2 r1 + r3 Load a into r1 2005
Load b into r3 2006
IP 2007
r2 r1 + r3 2007
Store r2 into c 2008
CPU
Running the Program
2 a
1 c
3 b
r1 2
r2 5
r3 3
Logic Memory
r4
IR Store r2 into c Load a into r1 2005
Load b into r3 2006
IP 2008
r2 r1 + r3 2007
Store r2 into c 2008
CPU
Running the Program
2 a
5 c
3 b
r1 2
r2 5
r3 3
Logic Memory
r4
IR Store r2 into c Load a into r1 2005
Load b into r3 2006
IP 2008
r2 r1 + r3 2007
Store r2 into c 2008
CPU
Finding Data in
Memory
• Clock speed
– Megahertz (MHz)
– Gigahertz (GHz)
• Number of instructions per second
– Millions of Instructions Per Second (MIPS)
• Performance of complex mathematical operations
– One million floating-point operations per second
(Megaflop )
Cache
Step 3
P Transfer to main CPU and cache
R
O
R
C
E Cache A
S
M
S
O Step 2
Go to address in main
R
memory and read
Step 1
Processor Next processor request
requests • Look first at cache
data or • Go to memory
instructions
Types of Cache
• Internal cache
– Level 1 (L1)
– Built into microprocessor
– Up to 128KB
• External cache
– Level 2 (L2)
– Separate chips
– 256KB or 512 KB
– SRAM technology
– Cheaper and slower than L1
– Faster and more expensive than memory
what is a TFLOP?
BUSES
Buses
• Concept is to link together multiple functional units
over a common data highway at a lower cost than
using multiple point to point links
E
E A
A
D
D OR Bus
B
B C
C
Number of Links = n * (n – 1) / 2
61
Computer Buses
More powerful
Larger bus width = computer
CPU can transfer more
data at a time = Faster computer
• Carries data
– Remember that there is no difference between
“data” and “instruction” at this level
• Width is a key determinant of performance
– 8, 16, 32, 64 bit
– What if the data bus is 8 bits wide but instructions
are 16 bits long?
– What if the data bus is 64 bits wide but
instructions are 16 bits long?
Address bus
84
Tri-State Logic
• The problem with connecting multiple “normal”
outputs together on a bus is that each has to be in
one logic state (0) or the other (1) - driving voltage
on each bus signal high or low
• This represents a conflict over the state of the signal
• We resolve this conflict with tri-state logic
Logically Electrically Truth Table
Device Bus
enableout
86
Tri-State Logic and Buses
87
Bus Width
• No clock
• Occurrence of one event on the bus follows and
depends on a previous event
• Requires tracking of state, hard to debug, but
potential for higher performance
Master sync
Slave = memory, ACK’s master sync
Master reads the data from the data bus
Slave sync
MEMORY
Memory
Types of Storage
• Secondary
– Data that will eventually be used
– Long-term
• Memory
– Data that will be used in the near future
– Temporary
– Faster access than storage
• Registers
– Data immediately related to the operation being executed
– Faster access than memory
Measuring
Storage Capacity
KB – kilobyte GB – gigabyte
• 1024 bytes • Billion bytes
• Some diskettes • Hard disks
• Cache memory • CDs and DVDs
MB – megabyte TB – terabytes
• Million bytes • Trillion bytes
• RAM • Large hard disks
Memory
Many Names
Primary storage
Primary memory
Main storage
Internal storage
Main memory
Main Types of Memory
RAM
Random Access Memory
ROM
Read Only Memory
RAM
• Operating System
• Program currently running
• Data needed by the program
• Intermediate results waiting to be output
ROM
• Non-volatile
• Instructions for booting the computer
• Data and instructions can be read, but not modified
• Instructions are typically recorded at factory
123
Memory
124
Introduction
• Memory Devices
(RAM,ROM,PROM,EPROM)
• Storage Devices (Auxiliary Storage
Devices-Magnetic Tape, Hard Disk, Floppy
Disk .Optical Disks: CD-R Drive,CD-RW
disks,DVD,Blue ray Discs)
125
126
Characteristics of
Storage Devices
• Speed
• Volatility
• Access method
• Portability
• Cost and capacity
127
Basic Units Of
Measurement
• Bit on OR off
Binary digit
Smallest unit of measurement
Two possible values 0 1
•Byte
•8 bits
128
Small Units Of
Measurement
(Processor And Memory
Speed)
130
Large Units Of
Measurement
(Memory, Storage)
131
Large Units Of
Measurement
(Memory, Storage)
132
RAM,ROM,PROM,
EPROM
• Memory Devices
– Memory: Is one or more sets of chips
that store data/program instructions,
either temporarily or permanently .
– It is critical processing component in
any computer
– PCs use several different types
133
RAM,ROM,PROM
,EPROM
• Memory Devices
– Two most important are
• RAM(Random Access Memory)
• ROM(Read-only Memory)
– They work in different ways and perform
distinct functions
– CPU Registers
– Cache Memory
134
RAM
20
Data input 2 Data Output
bytes of
RAM
(1 Mega-byte)
Write
8 bits (1 byte)
of data
RAM
• When you talk about the memory of a computer, most often you’re
talking about its RAM.
• If a program is stored in RAM, that means
that a sequence of instructions are stored in consecutively
addressed bytes in the RAM.
• Data values (variables) are stored anywhere in RAM, not necessarily
sequentially
• Both instructions and data are accessed from RAM using addresses
• RAM is one (crucial) part of the computer’s
overall architecture
Nonvolatile
Memories(ROM)
138
Nonvolatile
Memories(ROM)
• Types of ROMs
– Programmable ROM (PROM)
– Eraseable programmable ROM (EPROM)
– Electrically eraseable PROM (EEPROM)
– Flash memory (used in portable digital devices)
• Firmware (Program instruction used frequently)
– Program stored in a ROM
• Boot time code, BIOS (basic input/output
system)
• graphics cards, disk controllers.
139
Memory
140
Storage Vs. Memory
141
3. Storage Vs. Memory
144
Magnetic Drives
145
Magnetic Disk
146
1. Magnetic Drives: Storage Capacities
•Floppy disks
–~ 1 MB
•Hard drives
–~80 – 500 GB (TB is possible but very rare)
147
Floppy Disks
148
Structure Of Floppy
Disks
149
Hard Disks
cluster tracks
two or more data is recorded in
sectors concentric circular
combined bands 151
Optical Mass Storage
Devices
152
Optical Drives
154
DVD (Digital
Video Disk)
DVD-ROM
– Over 4 GB storage (varies with
format)
– DVD- ROM (read only)
– Many recordable formats (e.g.,
DVD-R, DVD-RW; ..)
– Are more highly compact than
a CD.
– Special laser is needed to read
them 155
Blu-ray Technology
• Name
Derived from the blue-violet laser used to read and
write data.
– Developed by the Blu-ray Disc Association with
more than 180 members.
• Dell
• Sony
• LG
156
Blu-ray Technology
Cont.
• Data capacity
– Because Blu-ray uses a
blue laser(405
nanometers) instead of a
red laser(650
nanometers) this allows
the data tracks on the
disc to be very compact.
– This allows for more
than twice as small pits
as on a DVD.
157
Blu-ray Technology
Cont.
Formats
• BD-ROM (read-only) - for pre-recorded content
• BD-R (recordable) - for PC data storage
• BD-RW (rewritable) - for PC data storage
• BD-RE (rewritable) - for HDTV recording
158
Lecture 2 Chapter 4
COMPUTER ARCHITECTURE
Computer
Architecture
Central Processing
Unit
CPU Input/
Output
Bus Devices
RAM
CPU Keyboard Display
Bus
Hard
CD-ROM
RAM Disk
The Bus
Bus
Bus
“Keyboard, did the user type anything?”
Bus
“Keyboard, did the user type anything?”
• Each device (except CPU) is a State Machine
that constantly checks to see what’s on the Bus.
The Bus
Bus
“Keyboard, did the user type anything?”
Keyboard notices that its name is on the Bus,
and reads info. Other devices ignore the info.
The Bus
Bus
“CPU: Yes, user typed ‘a’.”
The Bus
Bus
“CPU: Yes, user typed ‘a’.”
Computer
Architecture
Hard
CD-ROM
RAM Disk
Putting it all
together
Bus
Bus
Hard
CD-ROM
RAM Disk
• This cycle is
orchestrated by
the Control Unit
in the CPU.
Memory Registers
Register 0 Arithmetic
Register 1 / Logic
Unit
Register 2
Register 3
Control Unit
Instruction Register (State Machine)
Memory Registers
Register 0 Arithmetic
Register 1 / Logic
Unit
Register 2
Register 3
Control Unit
Instruction Register (State Machine)
Memory Registers
Register 0 Arithmetic
Register 1 / Logic
Unit
Register 2
Register 3
Control Unit
Instruction Register (State Machine)