Skip to content

Cache structure #982

Closed Answered by stnolting
mahdi259 asked this question in Q&A
Aug 7, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Imagine a cache configuration with 4 blocks with a block size of 16 bytes. Fur such a cache configuration, each address (applied to the cache) is decomposed into 3 parts: a tag ("TAG"), a block number ("B") and a block offset ("offs"):

 31                 6 5 4 3  0 
+--------------------+---+----+
|         TAG        | B |offs|
+--------------------+---+----+
  • There are 4 bits for the block offset since each block has a size of 2^4=16 bytes.
  • Two bits are used to identify the actual bit block since we have 2^2=4 blocks in total.
  • The remaining 32-2-4=26 bits are used for the tag that identifies one specific block.

This layout implies that each block is 16-byte aligned. For example, acce…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mahdi259
Comment options

@stnolting
Comment options

@mahdi259
Comment options

Answer selected by mahdi259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants