Finding the tag ID for 16-bit architecture

In summary: You used 8x32. You need to use the same 8 in both places.In summary, the DMMC 16-bit architecture has a cache with 8 blocks of 32 bytes each. To represent the tag of each block, only 3 bits are needed. This is calculated by subtracting the number of bits for the block offset (5) and the index (8) from the total number of bits (16). Confusion may arise from using different methods to calculate the index.
  • #1
ver_mathstats
260
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
  • #2
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 ver_mathstats
  • #3
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.
 
  • #4
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?
 
  • #5
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?
 
  • #6
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.
 
  • #7
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 ver_mathstats
  • #8
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
 

1. How do I find the tag ID for 16-bit architecture?

The tag ID for 16-bit architecture can be found by examining the processor's datasheet or technical documentation. It may also be listed in the BIOS or firmware settings of the system.

2. Why is the tag ID important for 16-bit architecture?

The tag ID is important for 16-bit architecture because it helps the processor identify and access specific blocks of memory. This is crucial for efficient and accurate data processing.

3. Can the tag ID be changed or modified?

In most cases, the tag ID for 16-bit architecture is hard-coded into the processor and cannot be changed or modified. However, some advanced processors may have options for modifying the tag ID through specialized software or programming.

4. Is the tag ID the same for all 16-bit processors?

No, the tag ID can vary between different 16-bit processors. It is determined by the specific design and architecture of the processor, and may also depend on the manufacturer.

5. How does the tag ID affect the performance of a 16-bit system?

The tag ID plays a crucial role in the performance of a 16-bit system. It helps the processor efficiently access and retrieve data from memory, which can greatly impact the overall speed and efficiency of the system.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Poll
  • Programming and Computer Science
Replies
18
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
874
Back
Top