hw3 - Cse490 590 sp2025
hw3 - Cse490 590 sp2025
1.
Consider the following list of instructions. Assume that the initial values for $s1, $s2, $s3, $s4, and $s5
are all 0:
loop: ADDI $s2, $s1, -2
BNE $s5, $s2, target1
ADDI $s3, $s3, 0
target1: ADDI $s1, $s1, 1
ADDI $s4, $s1, -3
BNE $s5, $s4, loop
Assume that we have a 1-bit branch predictor that stores the result of the last branch and makes the
prediction based on the result. Show the results of all predictions throughout the execution. (Use T/N to
represent Taken/ Not Taken)
1st BNE->target1 N T
CSE 490/590 Computer Architecture Spring 2025 Homework 3 (not graded)
1. Consider the following list of instructions. Assume that the initial values for $s1, $s2, $s3, $s4, and
$s5 are all 0:
loop: ADDI $s2, $s1, -2
BNE $s5, $s2, target1
ADDI $s3, $s3, 0
target1: ADDI $s1, $s1, 1
ADDI $s4, $s1, -3
BNE $s5, $s4, loop
Assume that we have a 1-bit branch predictor that stores the result of the last branch and makes the
prediction based on the result. Show the results of all predictions throughout the execution. (Use T/N
to represent Taken/ Not Taken)
1st BNE->target1 N T
CSE 490/590 Computer Architecture Spring 2025 Homework 3 (not graded)
4. Suppose that in 1000 memory references there are 40 misses in the first-level cache and 20
misses in the second-level cache.
a. What are the local and global miss rates for each level of cache?
Assume the miss penalty from the L2 cache to memory is 200 clock cycles, the hit time of
the L2 cache is 10 clock cycles, the hit time of the L1 cache is 1 clock cycle, and there are
1.5 memory references per instruction.
b. What is the average memory access time?
5.
a. What is write back cache? Discuss both the advantages and disadvantages of using the
write-back policy.
b. What is write through cache? Discuss both the advantages and disadvantages of using the
write-through policy.
6. Here is a series of address references given as word addresses: 2, 3, 11, 16, 21, 13, 64, 48, 19,
11, 3, 22, 4, 27, 6 and 11. Consider a word-addressable cache.
Assuming a Direct-mapped cache with 16 one-word blocks that is initially empty, label each
reference in the list as a hit or a miss.
a. For each of these references, identify the binary address, the tag, and the index.
b. What is the hit rate?
7. A processor with Instruction cache miss rate of 2% and Data cache miss rate of 4% and costs
10 cycles to access either of the caches. 40% of the instructions to be executed are Load and
Store Instruction. The CPI with ideal cache (no misses) is 2.
CSE 490/590 Computer Architecture Spring 2025 Homework 3 (not graded)
8. Consider a direct-mapped cache of 128 blocks and each block can hold 16 words. The total
memory capacity is 8 GByte with 8Byte word sizes. It is a word addressable memory.
9. a) Consider a main memory size of 4 Bytes. Each block in the cache can hold only 1 word
(here 1 word = 1 Byte). Find the miss rate for the address references 0 4 0 4 0 4 0 4 in a
direct mapped cache.
b) Consider a main memory size of 4 Bytes. Consider a 2 way set associative cache which
are initially empty. Each block in the cache can hold only 1 word (here 1 word = 1 Byte).
Find the miss rate for the same address references (0 4 0 4 0 4 0 4).
c) Compare (a) and (b) and list the advantages of associative cache.