• retagged by
613 views
1 1 vote
Consider a byte addressable memory with $16$ bit addresses and a $2$- way set associative $\mathrm{L} 1$ cache of size $8 \mathrm{ kB}$ (kilobyte). Each cache line is $4$ words long. A process sequentially accesses the following memory addresses:

$\textsf{0x1000, 0x1004, 0x1010, 0x11C0, 0x2000, 0x3000, 0x1006, 0x2001}$

Assuming the $\mathrm{L} 1$ cache is initially empty and the LRU (least recently used) page replacement policy is used, indicate whether the cache access will result in a hit or a miss for each of the above addresses.

1 Answer

0 0 votes

Word addressable

1 word = 2 byte = 8 bit , then 4 words = 4 * 16 bit = 64 bit = 8 bytes,

Block line address is of 3 bits 

Number of blocks in cache \( ( L_1) \) = \( \frac{cache size }{block size} = \frac{8 kB}{8 B} = 2^{10} blocks \)

Number of sets in cache \( ( L_1) \) = \( \frac{No. of Blocks}{associativity} = \frac{2^{10}}{2} = 2^{9} \  sets \)

Tag size = \(16 \ bit - 12 \  bits = 4 \ bits \)

Sequentially Access of memory address

HexaDecimal
Tag   Set no.     cache byte
Set no. Hit / MissMemory block no.
10000001 000000000 0000Miss512
10040001 000000000 1000Hit512
10100001 000000010 0002Miss514
11C00001 000111000 00056Miss568
20000010 000000000 0000Miss1024
30000011 000000000 0000Miss1536
10060001 000000000 1100Hit512
20010010 000000000 0010Hit1024

Byte addressable

1 word = 1 byte = 8 bit , then 4 words = 4 bytes,

Block line address is of 2 bits

Number of blocks in cache \( ( L_1) \) = \( \frac{cache size }{block size} = \frac{8 kB}{4 B} = 2^{11} blocks \)

Number of sets in cache \( ( L_1) \) = \( \frac{No. of Blocks}{associativity} = \frac{2^{11}}{2} = 2^{10} \ sets \)

Tag size = \(16 \ bit - 12 \  bits = 4 \ bits \)

Sequentially Access of memory address

HexaDecimal
Tag   Set no.     cache byte
Set no. Hit / MissMemory block no.
10000001 0000000000 000Miss1024 occupy at set 0 col 1
10040001 0000000001 001Miss1024 occupy at set 1 col 1
10100001 0000000100 004Miss1028 occupy at set 4 col 1
11C00001 0001110000 00112Miss1136 occupy at set 112 col 1
20000010 0000000000 000Miss2048 occupy at set 0 col 2
30000011 0000000000 000Miss3072   Replace set 0 col 1 with 0011
10060001 0000000001 101Hit1025  at set 1 col 1
20010010 0000000000 010Hit2048  at set 0 col 2
Position:
Show:

Related questions

0 0 votes
2 2 answers
524
524 views
admin asked Aug 8, 2022
524 views
Consider a $5$-stage instruction pipeline. The stages and the corresponding stage delays are given below. InstructionStage delayFetch instruction (FI)3 nsDecode instruct...
2 2 votes
2 2 answers
655
655 views
admin asked Aug 8, 2022
655 views
Let $A$ be a sorted array containing $n$ distinct integers, such that, for all $1 \leq i<j \leq n$, we have $A[i]<A[j]$. Note that the integers stored in the array $A$ ar...
1 1 vote
2 2 answers
506
506 views
admin asked Aug 8, 2022
506 views
When we add a pair of two-bit binary numbers, say $a b$ and $c d$, we get a number of at most three bits, say $p q r$. Using standard operators of Boolean algebra, namely...
2 2 votes
1 1 answer
475
475 views
admin asked Aug 8, 2022
475 views
In a binary tree $T$, for a node $v$, the $\text{LEFT-HEIGHT} (v)$ is the length of the longest path from $v$ to any leaf in the left subtree of $v$. If $v$ has no left c...