Finding the tag ID for 16-bit architecture

  • Context: Comp Sci 
  • Thread starter Thread starter ver_mathstats
  • Start date Start date
  • Tags Tags
    Architecture Tag
Click For Summary

Discussion Overview

The discussion revolves around determining the number of bits required to represent the tag in a cache for a DMMC 16-bit architecture, specifically focusing on the configuration of cache blocks and their sizes. Participants explore the relationship between block size, index size, and tag size within the context of cache memory.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants propose that the block offset is 5 bits, as each block contains 32 bytes (2^5 = 32).
  • Others argue that the total cache size is 256 bytes, derived from having 8 blocks of 32 bytes each, leading to a calculation of 8 bits for the index.
  • A participant suggests that the tag size can be calculated as 16 (the total address size) minus the index and block offset, leading to a tag size of 3 bits in one instance.
  • Another participant questions the certainty of the index size being 8 bits and emphasizes the need to work backwards from the total address size to determine it correctly.
  • Some participants express confusion over the calculations and seek clarification on the relationships between the components of the cache architecture.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correct method for calculating the tag size, with multiple competing views and some confusion regarding the index size and its derivation.

Contextual Notes

There are unresolved assumptions regarding the definitions of the tag and index, as well as the overall architecture of the DMMC system. The calculations depend on the interpretation of the cache structure and the relationships between the various components.

ver_mathstats
Messages
258
Reaction score
21
Homework Statement
Given a DMMC 16-bit architecture, the cache holds 8 blocks of memory each being 32 bytes long, how many bits to represent the tag of each block?
Relevant Equations
offset, index, tag
I'm not sure if I am doing this right so if someone could check over my work that would be appreciated. Would we begin with 25=32 where 5 is the number of bits for the offset, then for the index it would be 256 bytes total meaning 28 so 8 bits for the index and then for the tag it would be 16-8-5=3

Is this correct? Thank you
 
Physics news on Phys.org
ver_mathstats said:
Homework Statement:: Given a DMMC 16-bit architecture, the cache holds 8 blocks of memory each being 32 bytes long, how many bits to represent the tag of each block?
Relevant Equations:: offset, index, tag

I'm not sure if I am doing this right so if someone could check over my work that would be appreciated. Would we begin with 25=32 where 5 is the number of bits for the offset, then for the index it would be 256 bytes total meaning 28 so 8 bits for the index and then for the tag it would be 16-8-5=3

Is this correct? Thank you
Please tell us a little about the DMMC 16-bit architecture, and specifically about what the tag represents. I doubt that very many people at this site know about it.

If the tag represents the particular block in the cache, then only 3 bits are needed. But then again, I don't know what the tag is supposed to represent.
 
  • Like
Likes   Reactions: ver_mathstats
Mark44 said:
Please tell us a little about the DMMC 16-bit architecture, and specifically about what the tag represents. I doubt that very many people at this site know about it.

If the tag represents the particular block in the cache, then only 3 bits are needed. But then again, I don't know what the tag is supposed to represent.
A direct mapped memory cache has data stored in blocks so here we have 8 blocks. Blocks contain multiple words of data, here each block is 32 bytes long. Each block is selected by an index, the tag is the “remaining” part of the address. Index: the lower bits which is used to determine where to put the data in the cache Tag: the upper bits, this is entered into the tag field of the cache entry. Now for the formulas of how to find each: example that I found online: "A cache is direct-mapped and has 64 KB data. Each block contains 32 bytes. The address is 32 bits wide. What are the sizes of the tag, index, and block offset fields? # bits in block offset = 5 (since each block contains 2^5 bytes) # blocks in cache = 64×1024 / 32 = 2048 blocks – So # bits in index field = 11 (since there are 2^11 blocks) # bits in tag field = 32 - 5 - 11 = 16 (the rest!)"

So for my example I did the block offset as 5 because 2^5=32. As for the index I understand the example, but it throws me off in my own problem. Bc I am using this formula "Number of cache blocks = Cache size / Block size" so then 2^3 = x/2^5 solving for x we get 2^8 as for tag it is 16 (bc it is a 16 bit architecture) minus the block offset and the index. So then it would be 16-5-3=8, 8 bits for the tag after revising my answer?

I think the second time after revising my answer is the correct way to do it.
 
This is a classic case of distracting with extraneous information. Read the question part again: "how many bits to represent the tag of each block?"

How many blocks are there?
 
ver_mathstats said:
for the index it would be 256 bytes total
How do you know that?

You have the right answer in #1 but I can't see how you got there: did you cheat?
 
pbuk said:
How do you know that?

You have the right answer in #1 but I can't see how you got there: did you cheat?
Ouch no I did not cheat, I got the first one because I did 2^5=32 again that is the block offset, 256 bytes total I got because I did 8x32, 8 blocks of 32 bytes each, so 256 bytes total then 2^8=256 which is how I got the index here then I did 16-8-5=3. This is how I did it the first time. Then I saw more examples and got confused.
 
ver_mathstats said:
Ouch no I did not cheat, I got the first one because I did 2^5=32 again that is the block offset, 256 bytes total I got because I did 8x32, 8 blocks of 32 bytes each, so 256 bytes total then 2^8=256 which is how I got the index here then I did 16-8-5=3. This is how I did it the first time. Then I saw more examples and got confused.
Ah, I think you got it by luck then! Follow:
"I did 2^5=32 again that is the block offset" - yes,
"256 bytes total I got because I did 8x32, 8 blocks of 32 bytes each, so 256 bytes total" - yes (note 3 + 5 bits)
"then 2^8=256 which is how I got the index here" - but how do you know the index has 8 bits? You don't, you have to work backwards: if the address bus is 16 bits then the total memory is 2^16 bits and the cache size is 2^(3 + 5) bits then the index must 2^(16 - (3 + 5)) bits
"then I did 16-8-5=3" - yes

But what you have ended up with is 16 - (16 - (3 + 5)) - 5 = 3. Much easier to say "the cache holds 8 blocks of memory so I need 3 bits for the tag".
 
  • Like
Likes   Reactions: ver_mathstats
pbuk said:
Ah, I think you got it by luck then! Follow:
"I did 2^5=32 again that is the block offset" - yes,
"256 bytes total I got because I did 8x32, 8 blocks of 32 bytes each, so 256 bytes total" - yes (note 3 + 5 bits)
"then 2^8=256 which is how I got the index here" - but how do you know the index has 8 bits? You don't, you have to work backwards: if the address bus is 16 bits then the total memory is 2^16 bits and the cache size is 2^(3 + 5) bits then the index must 2^(16 - (3 + 5)) bits
"then I did 16-8-5=3" - yes

But what you have ended up with is 16 - (16 - (3 + 5)) - 5 = 3. Much easier to say "the cache holds 8 blocks of memory so I need 3 bits for the tag".
hm interesting but I see now how it works, thank you
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K