Cao 5
Cao 5
Address Address
0 0
1 1
2 1 0 0 0 1000 2 1 0 0 0 Reading data
Writing data
3 3
4 4
5 5
6 6
n–1 n–1
n n
Based on
principle of operation
Read only memory (ROM) Read/write memory (RAM)
Based on
mode of access
Sequential Random
Based on
terminology
used for
fabrication
Bipolar MOS
Secondary storage
devices
Magnetic tape
Magnetic Magneto
Optical disk
disk optical disk
Write Once
Floppy Hard Zip CD-ROM Read Many
disk disk disk read-only (WORM) disk
Increasing CPU Increasing Increasing
size speed cost per bit
Primary
cache
Secondary
cache
Main
memory
Main
memory
I/O
processor
Magnetic Magnetic
tapes disks
Auxiliary memory
I : Instruction flow
D : Data flow
I I
Main Secondary
CPU memory memory
D D
M1 M2
I
I I - cache I
Main Secondary
CPU memory memory
D D
D D - cache
M2 M3
M1
(b) Three - level
I I I I
Level 1 Level 2 Main Secondary
CPU memory memory
cache cache
D D D D
M1
M2 M3
M4
(c) Four - level
b b'
T1 T2
X Y
T1
T2
Word line
Bit lines
T1 T2 T1 T2
b b
b
b
VDD
b b'
T3 T4
T1 T2
(T 3 , T5 ) X Y
(T4 , T6 )
T5 T6
T1
Word line
T2
Bit lines
T1 T2
T1 T2
T1 T2
T1 T2 .
T3
T6 T4 T5
T3 T6 T4 T5
b
Sense line
Storage
capacitor
Control
line
Bit line VCC
Word line
VDD
MOSFET
switch
Data line
Fuse
Output bit
Quartz window
Ultraviolet light
( 200 A
25 V
n-data lines
k-address
lines Memory
unit
k
Read 2 word
n-bit per word
Write
2k 2 10
16 8 128 bits
2 11
2 18 262144
D0
D1
D7 D4 D3 D0
I/O3 I/O0 I/O3 I/O0
A0 A0
A9 1K4 A9 1K4
CS WR RD CS WR RD
Chip select
Write
Read
A0
A11
D0
D7
RD
WR
A12 0
24 1
Decoder
2
A13
3
61
Data
2
6 to 64
out
1
A6 A5 A4 A2 A1 A0
64 128 8192
W0
FF FF
W1
A0
A1
Address Memory
decoder cells
A2
A3
W15
R/W
Sense/write Sense/write Sense/write
circuit circuit circuit
CS
ON 0
1
Tunnel Control gate
oxide
Floating gate
Bit line
Source Drain
n+ n+
p - substrate
SRAM DRAM
Cache
controller
Number of hits
100 %
Total number of bus cycles
1400
100
1400 100
Total wait states 300
Number of memory bus cycles 1500
Cache
M1
Main
CPU memory
Cache Block M2
access replacement
Main-memory
access
System bus
M1
M2
M2 M1
Cache
M1
Cache Block
access replacement
Main Main
Cache memory
CPU memory
controller M2
controller
Main
memory
access
System bus
Main Main
memory memory
address
1001001110 D4
1001001101 67
1001 0011 39 D4 67 2C
1001001100 2C
1001001011 C3
1001 0001 B2 5A 00 40
1001001010 9A
1001001001 35
1001001000 1A
1001000111 B2
1001000110 5A
1001000101 00 Data
Tag selector
1001000100 40 comparator
Data
5A
OUT
Address in
1001 0001 10
Main Main
memory memory
address
1001001110 D4
1001001101 67
1001 0011 39 D4 67 2C
1001001100 2C
1001001011 C3
1001 0001 B2 E6 00 40
1001001010 9A
1001001001 35
1001001000 1A
1001000111 B2
1001000110 5A
1001000101 00 Data
Tag selector
1001000100 40 comparator
Data
IN E6
Address in
1001 0001 10
Block 0
Block 1
Block 0
27
Main memory
Block 0
Block 1
12 bits Cache
memory
Tag
Block 0
Tag
Block 1 Block i
Tag Block 127
Block j
Tag
12
Word
4
Main memory address Block 4095
Main memory
Block 0
Block 1
Block belongs
to set 0 Page 0
Tag 0
Block 63
Block 64
Block 65
Cache memory Cache memory
Set 0 Tag Tag Page 1
Set 1 Tag
Block 0
Tag
Block 0
Tag 1
Block 1 Block 1
Block 127
Set 62 Tag Tag Block 62
Set 63 Tag Tag
Block 63 Block 63 Block 4032
Block 4033
Tag Set Word
Page 63
Block belongs
6 6 4
Tag 63
to set 63
Block 4095
24
( 2 8 256)
TAG WORD
27 128
Cache size 1K
Words in each block 4
2048
4
512
2
17 bits
log 2 128
Cache size 1K
Words in each block 128
log 2 8
log 2 64 K log 2 2 16
TAG BLOCK WORD
16 - bits
2 12
2 10
2 10 2 10 147
Other bus Other bus
master master Cache
Main
memory
Other bus
master
Non-cacheable
80386 Decode
Main
memory Cacheable
Decode
Reads
Program
Writes
Program Write miss rate Write miss penalty
Memory accesses
Miss rate Miss penalty
Program
Instructions Misses
Miss penalty
Program Instruction
CPU time with stalls I CPI stall clock cycle
CPU time with perfect cache I CPI perfect clock cycle
Address space
Page 0 1 K words
Page 1
Page 2
Page 5 Block 1
Page 6 Block 2
Page 7 Block 3
13 12
8K=2 4K=2
2 24
2 16
001 10 1 Block 0
101 0
110 11 1 MBR
111 0
01 1
Page 1
Page 2
Page 3
Block 0
Page 4
Block 1
Page 5
Block 2
Page 6
Block 3
Page 7
Memory space
12
Address space M=4K=2
13
N=8K=2
Initial 4 2 0 1 2 6 1 4 0 1 0 2 3 5 7
Least 4 4 4 4 4 0 0 2 6 6 6 4 1 0 2
recently 2 2 2 0 1 2 6 1 4 4 1 0 2 3
used
0 0 1 2 6 1 4 0 1 0 2 3 5
1 2 6 1 4 0 1 0 2 3 5 7
Initial 4 2 0 1 2 6 1 4 0 1 0 2 3 5 7
4 4 4 4 4 2 2 0 0 0 0 1 6 4 2
2 2 2 2 0 0 1 1 1 1 6 4 2 3
0 0 0 1 1 6 6 6 6 4 2 3 5
1 1 6 6 4 4 4 4 2 3 5 7
Logical address
Block Word
Physical address
2K
2K
Physical
memory
Linear address Translation lookaside HIT
buffer (TLB)
+
Block Word
1 1
0 0
Block Word
12-bits 12-bits
Physical address
Local bus Main
Processor Cache memory
Local I/O
controller
System bus
Expansion
Network SCSI Modem Serial
bus interface
Expansion bus
Local I/O
controller
System bus
Expansion
FAX Modem Serial
bus interface
Expansion bus
1 0 1 0 1 0
Logical 1 (+5 V)
Crystal
Logical 0 (0 V)
oscillator
t0
t0 t1
t1
t2
Bus clock
Address
bus
Data bus
RD
t0 t1 t2
Bus cycle
t1
t2
t1
Bus clock
Address
bus
Data bus
WR
t0 t1 t2
Bus cycle
Bus clock
Address
tDM
Data
tDS
t0 t1 t2 Time
t0
t AM
t1
t DS
t DM t2 t 2 t DM
t2
t2 – t0
1 2 3 4
Clock
Address
Data
Slave-ready
RD
Address bus
RD
Master-ready / Ready
Slave-ready / Accept
Data bus
t0 t1 t2 t3 t4 t5
Bus cycle
Address bus
Data bus
WR
Master-ready / Ready
Slave-ready / Accept
t0 t1 t2 t3 t4 t5
Bus cycle
Data bus
Source Destination
unit Strobe unit
Valid data
Data
Strobe
Valid data
Strobe
Data valid
Data accepted
Source unit
Place data on
1.
the bus
Destination unit
Data valid
Bus grant
Bus request
Controller
Bus busy
Master 1 Master 2 Master N
Controller
Bus request
Bus busy
Master 1 Master 2 Master N
Bus grant 1
Bus request 1
Bus grant 2
Bus request 2
Controller
Bus grant N
Bus request N
Bus busy
VCC
ARB0
ARB1
ARB2
ARB3
Start Arbitration
1 1 1 0 1 0 0 0 1 0 0 1 1 0 0 0
0 0 0 1 0 1 1 1 0 1 1 0 0 1 1 1
I/O
address space
Memory Total
address address
space space I/O
address
space
Is
Yes Call the I/O port A
service request
bit set service routine
?
No
Is
Yes Call the I/O port B
service request
bit set service routine
?
No
Is
Yes Call the I/O port C
service request
bit set service routine
?
No
End
Interrupt request
I/O
CPU system
Interrupt acknowledgment
Assert interrupt
request line
Complete current
instruction
Interrupt
Main Program
service
routine
PC
Put current program
sh
Pu
counter value on stack
Po
with address of
p
PC
interrupt service routine RET
Execute interrupt
service routine
Continue where
interrupted
it
INTR
Processor
Device Device Device
1 2 n
INTA
INTR
INTR
INTR1
INTRn
Priority arbitration
circuit
Start
Initialize counter
Initialize source pointer
Get byte
Send byte
No
Last byte ?
Yes
Stop
CPU DMA
Start
Send addresses of
source and destination Request bus
and number of bytes
to transfer
No
Bus free !
Yes
Release bus
Total data
bytes No
transferred
Yes
Notify CPU of
Acknowledge
completion
Stop
Data bus
Address bus
Control bus
RD WR RS DS DMA REQ
Data Data Address Control
counter register register I/O devices
logic
BG BR INTR DMA ACK
DMA
HLDA HOLD
NTR
Processor
EOP
Start Start Start
Is
Is Is
I/O device No
I/O device No I/O device No ready for
ready for ready for
data transfer
data transfer data transfer
?
? ?
Yes
Yes Yes
DMA acquires
DMA acquires DMA acquires the control of
the control of the control of buses from processor
buses from processor buses from processor
System bus
Memory
Address
Bus Data
Control
Interrupt request
Interrupt request
DACK
EOP
TX TX
DTE RX RX DCE
(Transmitter) (Receiver)
GND GND
USB Cable
USB USB
Host Device(s)
Front view
Front view
2 1
1 2 3 4
3 4
(a) (b)
1 1 0 0 1 1 0 1 0 0 1 0 0
Digital data
NRZI data
Digital data
NRZI data
1 2 3 4 5 6
Stuffed bit
Start
Data absent
dle
Clear count
Get bit
nvert output
1
Output
0 Count = Count + 1
Is No
count = 6
?
Yes
Send sync
bit
Clear count
No
Transmission
over ?
Yes
8 bits
PID
(c)Handshaking packet