Cao 2021 HW2
Cao 2021 HW2
Cao 2021 HW2
Homework 2
Do not write long explanations. Write at most 2 sentence explanation for any question
(marks will be deducted for writing long explanations).
2 bonus mark for writing your answers in latex. 1 bonus mark for writing your
answer in Word or similar software (i.e., non-handwritten submissions).
Only PDF will be accepted. It should have RollNumber_Name_HW1.pdf name. Do
not upload zipped format or word format, etc.
Do not worry if MS-teams renames your file-submission.
4. A cache has 4 banks. A block has a size of 8bits. The cache can store a total
of 12 blocks. Each bank can provide at most 1 bit in each cycle.
We use
(a) 2:1 interleaving
(b) 4:1 interleaving.
Find the latency of reading the entire block in each case. [1 mark for each part, no
need of drawing figures]
4 6 2
44 38 472
122 456 555
129 771 841
No explanation required. [1 mark for each format]
6. A cache has 2 banks. Block size is 2B. Consider a block which has memory
addresses 16 to 31 (bit-level addresses). Which addresses will be stored in
bank 0 and which addresses will be stored in bank 1? No explanation
required. [ 1 mark]
7. Consider these two codes:
OriginalCode:
for i = 0 to N
for j = 0 to M
A[i][j] = C* A[i][j]
NewCode (after loop-collapsing):
for k = 0 to N*M
NewA[k] = C* NewA[k]
Whether this code will be equivalent to OriginalCode only for row-major layout, or
column-major layout or both? [1 mark]
8. Consider invalidating snooping protocol with 3 CPUs: C1, C2 and C3.
Consider a memory location `L', where the value 15 is stored.
In the following table, fill the cells with activity or values stored. If a
particular cache or the memory does not cache/store the location L, leave it
blank. No explanation required, just fill the table.
[6 marks total, 1 marks for writing state correctly after each step]