CS2100 Computer Organization Cache Exercises
Direct Mapped Cache We have a 64 byte direct-mapped cache with 4 word blocks. Questions: Sketch layout for 32-bit address. Calculate TOTAL amount of SRAM needed to implement this cache, assuming write- back policy. Calculate the hit rate for the following memory (byte) addresses: 0, 32, 33, 64, 8, 80, 18, 128, 15,1 Assuming that main memory has an access time of 60ns and cache has an access time of 5ns, calculate the average memory access time for our accesses above.
Set Associative Cache We have a 128-byte 2-way set associative cache with 4 word blocks, using FIFO replacement policy. Questions: Sketch layout for 32-bit address. Calculate TOTAL amount of SRAM needed to implement this cache, assuming write-back policy. Calculate the hit rate for the following memory (byte) addresses: 0, 32, 33, 64, 8, 80, 18, 128, 15,1 Assuming that main memory has an access time of 60ns and cache has an access time of 5ns, calculate the average memory access time for our accesses above.
Full Associative Cache We have a 128 byte fully-associate cache with 4 word blocks and LRU replacement policy. Questions: Sketch layout for 32-bit address. Calculate TOTAL amount of SRAM needed to implement this cache, assuming write-back policy. Calculate the hit rate for the following memory (byte) addresses: 0, 32, 33, 64, 8, 80, 18, 128, 15,1 Assuming that main memory has an access time of 60ns and cache has an access time of 5ns, calculate the average memory access time for our accesses above.
Exercise #2: Without Forwarding How many cycles will it take to execute the following code on a 5-stage pipeline without forwarding? sub $2, $1, $3 and $12, $2, $5 or $13, $6, $2 add $14, $2, $2 sw $15, 100($2) CS2100 Pipelining
Exercise #2: Without Forwarding 1 2 3 4 5 6 7 8 9 10 11 sub and or add sw CS2100 Pipelining
Exercise #3: Without Forwarding How many cycles will it take to execute the following code on a 5-stage pipeline without forwarding? lw $2, 20($3) and $12, $2, $5 or $13, $6, $2 add $14, $2, $2 sw $15, 100($2) CS2100 Pipelining
Exercise #3: Without Forwarding 1 2 3 4 5 6 7 8 9 10 11 lw and or add sw CS2100 Pipelining
Exercise #4: With Forwarding How many cycles will it take to execute the following code on a 5-stage pipeline with forwarding? sub $2, $1, $3 and $12, $2, $5 or $13, $6, $2 add $14, $2, $2 sw $15, 100($2) CS2100 Pipelining
Exercise #4: With Forwarding 1 2 3 4 5 6 7 8 9 10 11 sub and or add sw CS2100 Pipelining
Exercise #5: With Forwarding How many cycles will it take to execute the following code on a 5-stage pipeline with forwarding? lw $2, 20($3) and $12, $2, $5 or $13, $6, $2 add $14, $2, $2 sw $15, 100($2) CS2100 Pipelining
Exercise #5: With Forwarding 1 2 3 4 5 6 7 8 9 10 11 lw and or add sw CS2100 Pipelining
Exercise #7: Branch Prediction How many cycles will it take to execute the following code on a 5-stage pipeline with forwarding and branch prediction? Total instructions = 1 + 102 + 1 = 22 Ideal pipeline = 4 + 221 = 26 cycles addi $s0, $zero, 10 Loop: addi $s0, $s0, -1 bne $s0, $zero, Loop sub $t0, $t1, $t2 CS2100 Pipelining
Exercise #7: Branch Prediction 1 2 3 4 5 6 7 8 9 10 11 IF ID ALU MEM WB addi bne addi* CS2100 Pipelining