Cache parameters
Click the spinners to change the cache parameters. This assumes 32-bit addresses and 32-bit words.
Words per block: | 2 | = | words per block ( word select bits) |
---|---|---|---|
Number of blocks: | 2 | = | blocks |
Associativity: | 2 | = | -way |
Number of rows: | blocks
ways |
= | rows ( row index bits) |
Write scheme: |
Cache storage
Cache data size: |
bytes
word words
block |
= | bytes |
---|---|---|---|
Tag storage: | tag bits × blocks | = | bits |
Valid + dirty bits: | ( + ) × blocks | = | bits |
Metadata size: | +
8 |
= | bytes |
Total size: | + | = | bytes |
Address bits
byte | ||||
---|---|---|---|---|
word | ||||
row | ||||
tag | ||||
Address: | 000000 | 0000 | 00 | 00 |
Diagram
Each cache block looks like this (data is shown as bytes):
V | D | Tag | Data | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 000000000000000000000000000000000 |
|
|
|
|
|
|
|
|
The overall cache organization looks like this. Valid/dirty bits omitted for size. Note that the row indices are not stored in the cache!
Ways | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | … | 0 | 0 | 0 | 0 | ||
Rows | 0 | … | ||||||||
1 | … | |||||||||
2 | … | |||||||||
3 | … | |||||||||
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋱ | ⋮ | ⋮ | ⋮ | ⋮ | |
12 | … | |||||||||
13 | … | |||||||||
14 | … | |||||||||
15 | … |