Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS2100 Computer Organization

Similar presentations


Presentation on theme: "CS2100 Computer Organization"— Presentation transcript:

1 CS2100 Computer Organization
Cache Exercises

2 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.

3

4

5

6

7 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.

8

9

10

11

12 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.

13

14

15

16

17 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

18 Exercise #2: Without Forwarding
1 2 3 4 5 6 7 8 9 10 11 sub and or add sw CS2100 Pipelining

19 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

20 Exercise #3: Without Forwarding
1 2 3 4 5 6 7 8 9 10 11 lw and or add sw CS2100 Pipelining

21 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

22 Exercise #4: With Forwarding
1 2 3 4 5 6 7 8 9 10 11 sub and or add sw CS2100 Pipelining

23 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

24 Exercise #5: With Forwarding
1 2 3 4 5 6 7 8 9 10 11 lw and or add sw CS2100 Pipelining

25 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 = 2 + 1 = 22 Ideal pipeline = 1 = 26 cycles addi $s0, $zero, 10 Loop: addi $s0, $s0, -1 bne $s0, $zero, Loop sub $t0, $t1, $t2 CS2100 Pipelining

26 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


Download ppt "CS2100 Computer Organization"

Similar presentations


Ads by Google