GATE / CS ARCHIVE

GATE CSE 2022 / QUESTION 54

GATE CSE 2022 Q54

Computer Organization & Architecture · Cache Memory · Full GATE CSE 2022 paper

GATE 2022, Q54 2 marks · MSQ
Report issue

Cache Memory

Question 54, GATE 2022: An initially empty 2 KB direct-mapped data cache has 64-byte blocks; physical space is 64 KB and words are 16 bits. Access P,Q,R,S in that order ten times, with first-byte addresses 0xA248,0xC28A,0xCA8A,0xA262. Select true statements: A every S hits; B P never evicted after loading; C only R,S remain at the end; D every R evicts Q.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,D

There are 2048/64=32 cache lines. A byte address maps to line (address>>6) mod 32. P and S both lie in the same block from 0xA240 through 0xA27F, mapping to line 9. Q and R map to line 10 but have different tags. Thus the first P loads the P/S block permanently, and every S access hits. Each Q access replaces R (or loads the initially empty line), and every R access replaces Q. At the end the cache contains the P/S block and the R block, so P still resides and C is false. Select A, B, D. Each two-byte word fits inside its block.

The 16-bit physical byte address splits into 5 tag bits, 5 line bits and 6 offset bits. P: line9,tag 20,offset 8; S: line9,tag 20,offset 34; Q: line10,tag 24,offset 10; R: line10,tag 25,offset 10. The first cycle is miss,miss,miss,hit; later cycles are hit,miss,miss,hit. Therefore there are 21 misses and 19 hits across 40 accesses.

Original paper, page 36 · Answer key