Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
INTRODUCTION
The Architect views the machine as a collection of
functional units and their interconnection
The functional units include subsystems such as: Central Processing Unit (CPU)
The system Memory, which might include high-speed
semiconductor Random Excess Memory (RAM), as
well as disk and tape drives
input and output equipments e. g Keyboard and Printers
Main
Memory
(M)
ArithmeticLogic Unit
(ALU)
I/O
Equip
ment
(I,O)
Program
Control Unit
(CU)
CPU - Details
Arithmetic Logic Unit (ALU): Carries all arithmetic and logic operations
It contains a great deal of mathematical
structure
Registers
CPU uses Registers as its working space (temporary
storage)
Number and function vary between processor designs
User Visible Registers are: General Purpose Registers: Accumulator (a), Base (b), Control (c)
and Data (D)
Data Registers (D7 D0)
Address Registers (A7 A0)
Condition Codes Registers
Program Counter
Instruction Decoding Register
Memory Address Register
Memory Buffer Register
Registers
CPU uses Registers as its working space (temporary
storage)
Number and function vary between processor designs
Some architectures provide a set of registers which can be
used without restrictions as operands for any opcode and
as address registers; these are so called general-purpose
registers
User Visible Registers are:
Accumulator (a)
General Purpose Registers:Base (b), Count (c) and Data (D)
Data Registers (D7 D0)
Address Registers (A7 A0)
Condition Codes Registers
Register Organization
Control & Status Registers
Program Counter
Instruction Decoding Register
Memory Address Register
Memory Buffer Register
Status Registers are also called Flag Registers
The set of registers within the CPU represents the
top level of the memory hierarchy inside the computer system
- User visible registers: can be accessed by assembly language
programmers.
- Control and Status registers: used by the Control
Unit to control the operation of the CPU; not directly accessible by
the programmer.
9
Some Trade-offs
A large number of general purpose registers
large number of bits for encoding register operands;
specialization of registers reduces this need.
Too small number of registers creates problems to
the programmer and leads to an increased memory
traffic.
The number of general-purpose or data registers is
often between 8 - 32.
11
Registers
address registers: registers used only for address
representation and computation:
base registers
index registers
stack pointer etc.
In some architectures address registers can be
specialized for some of the previous functions.
12
13
A set of bits
Includes Condition Codes
Sign of last result
Zero
Carry
Equal
Overflow
Interrupt enable/disable
Supervisor
14
15
CPU must
Generally CPU must:
Fetch instructions
Interpret instructions
Fetch data
IR is examined
If indirect addressing, indirect cycle is performed
Right most N bits of MBR transferred to MAR
Control unit requests memory read
Result (address of operand) moved to MBR
Process data
Write data
16
Execute
Result Store
Next Instruction
17
18
19
20
Memory read/write
Input/Output
Register transfers
ALU operations
21
MEMORY
Is the section where information is stored.
The information could be: Programs
Data to be processed
Results of computation
Hard disks
Magnetic tapes/disks
Floppy diskettes
Compact disks (CDs)
22
MEMORY Characteristics
Location
Capacity
Unit of transfer
Access method
Performance
Physical type
Physical characteristics
Organisation
23
MEMORY Characteristics 1
Location; [CPU, Internal, External]
Capacity;
Word size (The natural unit of organisation)
Number of words (or Bytes)
Unit of transfer
Internal; (Usually governed by data bus width)
External; (Usually a block which is much larger than a
word)
Addressable unit
Smallest location which can be uniquely addressed
Word internally
Cluster on M$ disks
24
MEMORY Characteristics 2
Access method
Sequential
Start at the beginning and read through in order
Access time depends on location of data and
previous location
e.g. tape
Direct
Individual blocks have unique address
Access is by jumping to vicinity plus sequential
search
Access time depends on location and previous
location
e.g. disk
25
MEMORY Characteristics 3
Access method
Random
Individual addresses identify locations exactly
Access time is independent of location or previous
access
e.g. RAM
Associative
Data is located by a comparison with contents of a
portion of the store
Access time is independent of location or previous
access
e.g. cache
26
Performance
Access time
Time between presenting the address and
getting the valid data
Transfer Rate
Rate at which data can be moved
27
Physical Types
Semiconductor
RAM
Magnetic
Disk & Tape
Optical
CD & DVD
Others
Bubble
Hologram
28
Physical Characteristics
Decay
Volatility
Erasable
Power consumption
29
Organisation
Physical arrangement of bits into words
Not always obvious
e.g. interleaved
30
Memory Hierarchy
Programmers want unlimited amount of fast
memory
An economic solution to that desire is a memory
hierarch, which takes advantage of locality and
cost/performance of memory
Locality principle says: most programs do not access
all code or data uniformly
31
Increasing
access time,
Increasing
capacity
32
A CACHE
Is a small, fast memory located close to the CPU that
holds the most recently accessed code or data
It is capable of keeping up with the CPU
It act as a buffer between the CPU and the slower Main
Memory. ( A buffer is a temporarily storage area)
Traffic to and from CPU is in the form of words
Traffic between the cache and the main memory is in
the form of blocks referred to as cache lines
** The Cache Mapping Function Diagram
33
Cache Design
Size
Mapping Function
Replacement Algorithm
Write Policy
Block Size
Number of Caches
36
Direct mapping
If each block has only one place it can appear in the
cache
Placement Policies
How is a block found if it is in the cache?
Cache has an address tag on each block from
that gives the block address
The tag of every cache block that might contain
the desired information is checked to see if it
matches the block address from CPU
To know that a cache does not have a valid
information, valid bit is added to tag ta say
whether or not this entry contains a valid
address
If the bit is not set, there cannot be a match on
this address.
38
Memory Field
Block offset field selects the desired data
from the block
The index field selects the set
The tag field compared against it for a hit
Block Address
Tag
Index
Block
offset
39
REPLACEMENT POLICIES
Which block should be replaced on a cache
miss?
40
REPLACEMENT POLICIES
Strategies employed for selecting which block to
replace
Random: To spread allocation uniformly, candidates
blocks are randomly selected
Least Recently Used (LRU):
To reduce the chance of throwing out information that will be
needed soon, accesses to blocks are recorded
If recently used blocks are likely to be used again, then the
best candidate for disposal is the least recently used block
Write Policy
Must not overwrite a cache block unless
main memory is up to date
Multiple CPUs may have individual caches
I/O may address main memory directly
42
Write back
Updates initially made in cache only
Update bit for cache slot is set when update occurs
If block is to be replaced, write to main memory only if
update bit is set
Modified cache block is written to the main memory
only when it is replaced
43
Write back
To reduce the frequency of writing back
blocks on replacement a feature called dirty
bit is employed
When dirty bit is set indicates that the block
has been modified while is in the cache, and
the block is written back to main memory
Otherwise the block has not been modified
44
Write miss
The block may be brought into the cache, and then
updated, termed write allocate
The block may be updated in main memory and not
brought into the cache, termed write-no-allocation
45
46
47
48
49
MEMORY UNIT
Two types of memories
Main memory (also called internal memory or
primary memory)
Random Access Memory (RAM)
Read Only Memory (ROM)
Hard disks
Magnetic tapes/disks
Floppy diskettes
Compact disks (CDs)
50
MAIN MEMORY
Is a smaller segment of memory used for
temporary storage of programs, data and
information.
Are made using electronic elements which uses
materials called semiconductor: hence referred
to as SEMICONDUCTOR MEMORIES
Is divided into elementary units called cells or
location
They are two-state devices having 1 and 0:
Binary scheme
Measured in Bytes: a byte hold one character
51
52
RAM
Is a Random access memory
Read/Write memory: data can be read and
written from this memory
Running programs, data to be processed and
results are held here
Volatile: data stored are normally lost with the
loss of power
It is referred as the memory capacity of the
computer e. g 1 MB, 32 MB
Temporary storage
Static or dynamic
53
54
56
DRAM Operation
Address line active when bit read or written
Transistor switch closed (current flows)
Write
Voltage to bit line
High for 1 low for 0
Read
Address line selected
transistor turns on
57
58
59
State 0
C2 high, C1 low
T2 T3 off, T1 T4 on
SRAM v DRAM
Both volatile
Power needed to preserve data
Dynamic cell
Static
Faster
Cache
61
ROM
Is a Read-Only-Memory
Programs and data are permanently stored
and can only be read
Nonvolatile: information cannot lost with
the lost of power
Information cannot be erased, changed or
altered through regular program instruction
Information and data can only be changed
or altered by changing the circuitry
Programs are written at the factory
62
Types of ROM
Written during manufacture
Very expensive for small runs
Programmable (once)
PROM
Needs special equipment to program
Read mostly
Erasable Programmable (EPROM)
Erased by UV
Flash memory
Erase whole memory electrically
63
SECONDARY MEMORY
Large quantities of information can be stored
permanently, although they can be erased when
desired
Used for long term storage of information that is
not in use, e. g. it holds programs, files of data and
files of information
Employs storage on magnetic media such as
magnetic tapes, magnetic disks and magnetic
drums.
Examples are:
Magnetic Disks
Magnetic Tapes
Hard Disks
Floppy Diskette
Compact Disks (CDs)
64
Optical
CD Compact Disk
Magnetic Tape
65
Magnetic disks
68
69
70
Movable head
One read write head per side
Mounted on a movable arm
72
Removable or Not
Removable disk
Can be removed from drive and replaced with
another disk
Provides unlimited storage capacity
Easy data transfer between systems
Nonremovable disk
Permanently mounted in the drive
73
Multiple Platter
One head per side
Heads are joined and aligned
Aligned tracks on each platter form
cylinders
Data is striped by cylinder
reduces head movement
Increases speed (transfer rate)
74
Multiple Platters
75
Floppy Disk
8, 5.25, 3.5
Small capacity
Up to 1.44Mbyte (2.88M never popular)
Slow
Universal
Cheap
Obsolete?
77