Main memory organization
Segment 0 Segment 1
Line 0 Line 1 Line 2 Line 3 Line 0 Line 1 Line 2 Line 3
Mem
Addr
00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
Data P e t e r _ P i p e r _ p i c k e d _ a _ p e c k _ o f _ p i c
Segment 2 Segment 3
Line 0 Line 1 Line 2 Line 3 Line 0 Line 1 Line 2 Line 3
Mem
Addr
20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
Data c k l e d _ p e p p e r s , _ a _ p e c k _ o f _ p i c k l e d

The data cache table is 4 cells by 4 lines, each cell holds 1 byte of data.
Only data is cached in this example (not instuctions). Click on first table to see sequenced version.

The dual tables above represent a single continuous address space.
The Mem Addr row is there so you don't have to count yourselves.
Memory addresses specifed in hexadecimal to simplify calculations.

Empty cache
on boot up.
Click to see cache
in action.
Load $06 - Miss - f4 Load $20 - Miss - 28
06h = 0000 01 10b
tag = 0, line = 1, byte = 2
20h = 0010 00 00b
tag = 2, line = 0, byte = 0
Line
ID
TagData
03---------
02---------
01---------
00 ---------
Line
ID
Tag
Id
Data
03 ---------
02 ---------
01 003691 f41b
00 ---------
Line
ID
Tag
Id
Data
03 ---------
02 ---------
01 003691f41b
00 02 28470100

Load $07 - Hit - 1bLoad $21 - Hit - 47Load $08 - Miss -17
07h = 0000 01 11b
tag = 0, line = 1, byte = 3
21h = 0010 00 01b
tag = 2, line = 0, byte = 1
08h = 0000 10 00b
tag = 0, line = 2, byte = 1
Line
ID
Tag
Id
Data
03 ---------
02 ---------
010036 91f41b
00 0228470100
Line
ID
Tag
Id
Data
03 ---------
02 ---------
01 003691f41b
000228 470100
Line
ID
Tag
Id
Data
03 ---------
02 00 17b02200
01 003691f41b
00 0228470100

Load $22 - Hit - 00Load $09 - Hit - b0Load $23 - Hit - 00
22h = 0010 00 10b
tag = 2, line = 0, byte = 2
09h = 0000 10 01b
tag = 0, line = 2, byte = 1
23h = 0010 00 11b
tag = 2, line = 0, byte = 3
Line
ID
Tag
Id
Data
03 ---------
02 0017b02200
01 003691f41b
00022847 0000
Line
ID
Tag
Id
Data
03 ---------
02 0017 b02200
01 003691f41b
00 0228470100
Line
ID
Tag
Id
Data
03 ---------
02 0017b02200
01 003691f41b
00 02284701 00

Load $0A - Hit - 22Load $24 - Miss - 37Load $0B - Hit - 00
0Ah = 0000 10 10b
tag = 0, line = 2, byte = 2
24h = 0010 01 00b
tag = 2, line = 1, byte = 0
0Bh = 0000 10 11b
tag = 0, line = 2, byte = 3
Line
ID
Tag
Id
Data
03 ---------
02 0017b0 2200
01 003691f41b
00 0228470100
Line
ID
Tag
Id
Data
03 ---------
02 0017b02200
01 02 37e90000
00 0228470100
Line
ID
Tag
Id
Data
03 ---------
02 0017b022 00
01 0237e90000
00 0228470100