Question

In: Computer Science

Draw the memory address blocks (Tag, Index and Offset) for a direct mapped and N-way set...

Draw the memory address blocks (Tag, Index and Offset) for a direct mapped and N-way set associative cache organization for the below cache configurations. Round the cache size to nearest power of 2 (e.g., 1KB = 2^10) and assume 32-bit memory address.
a. 64KB cache, 32-byte block, N = 4
b. 1MB cache, 64-byte block, N=16
c. 32KB cache, 512-byte block, N=64

Solutions

Expert Solution

Tag, Index and offset for a direct mapped and N-way set associative cache.

Memory is 32- bit.

(a) 64 KB cache, 32-byte block,N=4

Direct mapped cache:

Each block size of the cache is 32-byte, to represent these 32 bytes we need 5 bits (because 25 = 32).

Therefore offset = 5 bits.

Total size of the cache is 64 Kb, then total number of blocks in the cache is = 64 Kb / 32 byte = (64 * 1024) byte / 32 bytes = 2 * 1024 blocks = 2 * 210 blocks = 211 blocks.

Therefore to represent these 211 blocks we need 11 bits. Index = 11 bits.

Tag = total memory length - (index + offset) = 32- (11+5) = 32- 16 = 16 bits.

TAG INDEX OFFSET
16 11 5

(N = 4) way set associative:

Offset doesn't change because the block size is same. (i.e, 32 bytes)

Therefore offset = 5 bits.

Total number of blocks in the cache is = 64 Kb / 32 bytes = (64*1024) bytes / 32 bytes = 2048 blocks.

According to N-way set cache we have 4 blocks for each set.

Therefore number of sets = 2048 blocks / 4 blocks = 512 set. To represent these 512 sets we need 9 bits (29 = 512).

Therefore set index = 9 bits.

Tag = total memory length - (index + offset ) = 32 - (9+5) = 32 - 14 = 18 bits.

TAG INDEX OFFSET
18 9 5

(b) 1 MB cache, 64-byte block,N=16

Direct mapped cache:

Each block size of the cache is 64-byte, to represent these 64 bytes we need 6 bits (because 26 = 32).

Therefore offset = 6 bits.

Total size of the cache is 1 Mb, then total number of blocks in the cache is = 1 Mb / 64 byte = (1 * 1024 * 1024) byte / 64 bytes = 16 * 1024 blocks = 24 * 210 blocks = 214 blocks.

Therefore to represent these 214 blocks we need 14 bits. Index = 14 bits.

Tag = total memory length - (index + offset) = 32- (14+6) = 32- 20 = 12 bits.

TAG INDEX OFFSET
12 14 6

(N = 16) way set associative:

Offset doesn't change because the block size is same. (i.e, 64 bytes)

Therefore offset = 6 bits.

Total number of blocks in the cache is = 1 Mb / 64 bytes = (1024*1024) bytes / 64 bytes = (16 * 1024) blocks = 214 blocks.

According to N-way set cache we have 16 blocks for each set.

Therefore number of sets = 214 blocks / 16 blocks = 214 blocks / 24 blocks = 1024 sets. To represent these 1024 sets we need 10 bits (210 = 1024).

Therefore set index = 10 bits.

Tag = total memory length - (index + offset ) = 32 - (10+6) = 32 - 16 = 16 bits.

TAG INDEX OFFSET
16 10 6

(c) 32 KB cache, 512-byte block,N=64

Direct mapped cache:

Each block size of the cache is 512-byte, to represent these 512 bytes we need 9 bits (because 29 = 512).

Therefore offset = 9 bits.

Total size of the cache is 32 Kb, then total number of blocks in the cache is = 32 Kb / 512 byte = (32 * 1024) byte / 512 bytes = 32 * 2 blocks = 64 blocks = 26 blocks.

Therefore to represent these 26 blocks we need 6 bits. Index = 6 bits.

Tag = total memory length - (index + offset) = 32- (6+9) = 32- 15 = 17 bits.

TAG INDEX OFFSET
17 6 9

(N = 64) way set associative:

Offset doesn't change because the block size is same. (i.e, 512 bytes)

Therefore offset = 9 bits.

Total number of blocks in the cache is = 32 Kb / 512 bytes = (32*1024) bytes / 512 bytes = 64 blocks.

According to N-way set cache we have 64 blocks for each set.

Therefore number of sets = 64 blocks / 64 blocks = 1 set. To represent these 1 set we need 1 bit.

Therefore set index = 1 bit.

Tag = total memory length - (index + offset ) = 32 - (1+9) = 32 - 10 = 22 bits.

TAG INDEX OFFSET
22 1 9

Related Solutions

A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes...
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes each. Access time for the cache is 22ns, and the time required to fill a cache slot from main memory is 300ns. (This time allows us to determine the block is missing and bring it into cache.) Assume a request is always started in parallel to both cache and to main memory(so if it is not found in cache, we do not have to...
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes...
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes each. Access time for the cache is 22ns, and the time required to fill a cache slot from main memory is 300ns. (This time allows us to determine the block is missing and bring it into cache.) Assume a request is always started in parallel to both cache and to main memory(so if it is not found in cache, we do not have to...
a) consider a direct mapped cache with 10 blocks of 10 words each. Suppose main memory...
a) consider a direct mapped cache with 10 blocks of 10 words each. Suppose main memory is 1000 words. For ewach memory address below say what cache block it maps to, what is the offset, and what is the tag. 934, 666, 348, 522
For a direct mapped cache design with 32 bit address, the following bits of the address...
For a direct mapped cache design with 32 bit address, the following bits of the address are used to access the cache Tag Index Offset 31 - 8 7 - 4 3 - 0 What is the cache block size (in words)? How many entries does the cache have? What is the ratio between total bits required for such a cache implementation over the data storage bits? Starting from power on, the following byte-addressed cache references are recorded. Address 0...
Draw diagram showing 8088 microprocessor connected to 4 memory chips each of 32K, mapped to memory...
Draw diagram showing 8088 microprocessor connected to 4 memory chips each of 32K, mapped to memory address starting from D0000.
Suppose we have a direct-mapped cache that can hold a total of 1024 blocks with 4...
Suppose we have a direct-mapped cache that can hold a total of 1024 blocks with 4 words per block. Compute the block index, block offset, and the tag for the following addresses: (a) 0x11001001 (b) 0x00010014 (c) 0x01000004 (d) 0x01001018 (e) 0x7bdcca10
Suppose a computer using direct mapped cache has 232 bytes of main memory and a cache...
Suppose a computer using direct mapped cache has 232 bytes of main memory and a cache of 1024 blocks, where each block contains 32 bytes. [2] How many blocks of main memory does this computer have? [4] Show the format of a memory address as seen by cache; be sure to include the field names as well as their sizes. [3] Given the memory address 0x00001328, to which cache block will this address map? (Give you answer in decimal.) A...
A direct mapped cache has 16 blocks and block size is 64-bits (8 bytes). a. Where...
A direct mapped cache has 16 blocks and block size is 64-bits (8 bytes). a. Where will the memory block 45 reside in cache? (5 b. Where will be the memory address 1667 mapped in cache
Given an 8-word, direct mapped cache, and the sequence of address accesses below, enter the number...
Given an 8-word, direct mapped cache, and the sequence of address accesses below, enter the number of misses. CACHE CONFIG 24 13 24 10 8 8 Given an 8-word, 2-way set associative cache, and the sequence of address accesses below, enter the number of misses. CACHE CONFIG 22 1 9 22 22 22 Given an 8-word, 2-way set associative cache, and the sequence of address accesses below, enter the number of misses. CACHE CONFIG 23 23 8 20 9 20...
A computer uses direct-mapped cache with four16-bit words, and each word has an associ-ated13-bit tag. Consider...
A computer uses direct-mapped cache with four16-bit words, and each word has an associ-ated13-bit tag. Consider the following loop (three instructions) in a program. Before the loop,the values in registersR0,R1,R2are 0, 054E, and 2 respectively. Consider that instructions arealready in separate cache memory. (See Table1.)The loop starts at location LOOP=02EC.LOOPAdd(R1)+,R0;DCRR2; BR>0LOOPShow the content of cache at the end of each pass of this loop if direct mapping cache is used.Compute hit rate.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT