Docsity

Homework 4 - Processor Design - Fall 2005 | CS 3220, Assignments of Computer Science

Toggle sidebar
bg1
Homework 4
Prof. Loh
CS3220 - Processor Design - Spring 2005
Handed Out: 11 Mar 2005
Due: 17 Mar 2005
1. Caches In the following parts, all caches will have a capacity of 256 bytes, and 4-byte (32-bit) words. Assume an
address of 16-bits (A[0..15]). You do not need to draw each and every single entry in the cache, but instead, use
ellipses (“...”) when appropriate to reduce the amount of tedious drawing that would otherwise be required.
(a) Design a direct mapped cache (with the specifications given above: 256 byte capacity, 4 byte words), where each
cache line stores only a single word. Be sure to label which bits are used to index into the cache, to compare to
the tag, etc. How large is the cache in bits (including the bits for the tag, a valid bit, and a dirty bit)? If a cache
hit takes 1ns, and a cache miss takes 10ns to service, how long will it take to access the following sequence of
addresses, assuming that all entries of the cache are initially invalid?
4, 8, 12, 16, 4, 4, 20, 4, 16, 68, 132, 72, 8, 12, 68, 4, 100, 52, 20, 4, 8, 12, 16, 4, 4, 256, 4, 16, 516
(b) Repeat for a fully associative cache (remember to include LRU bits for the non-direct-mapped caches!).
(c) Repeat for a 4-way set-associative cache.
(d) Repeat for a 4-way set-associative cache with a cache line size of four words. The total capacity should still be
256 bytes.
2. Pipeline Control Refer to the online notes on pipeline control for this problem. Assuming we have the pipeline
organization shown on page 2 of the notes, show the cycle-by-cycle state of the scoreboard to execute the following
instructions:
A. ADD R1 R3
B. SUB R2 R4
C. XOR R1 R2
D. MUL R5 *R2
E. ADD R4 R5
F. ADD R1 R4
Assume all “regular” arithmetic operations take one cycle to execute. Assume multiplication takes 2 cycles. Assume
that all memory accesses hit in the cache and take one cycle. Complete all cycles up to and including when instruction
F reaches the Load/Exec1 stage. Also, draw in the bypass paths used to route the register values from producers to
consumers (in the mini-pipeline diagrams on the right on the next page). This should look similar to the examples from
the notes. Use the following template:
pf2

Partial preview of the text

Download Homework 4 - Processor Design - Fall 2005 | CS 3220 and more Assignments Computer Science in PDF only on Docsity!

Homework 4

CS3220 - Processor Design - Spring 2005 Handed Out: 11 Mar 2005^ Prof. Loh

Due: 17 Mar 2005

1. Caches address of 16-bits (ellipses (“...”) when appropriate to reduce the amount of tedious drawing that would otherwise be required. In the following parts, all caches will have a capacity of 256 bytes, and 4-byte (32-bit) words. Assume anA[0..15]). You do not need to draw each and every single entry in the cache, but instead, use

(a) Design a direct mapped cache (with the specifications given above: 256 byte capacity, 4 byte words), where eachcache line stores only a single word. Be sure to label which bits are used to index into the cache, to compare tothe tag, etc. How large is the cache in bits (including the bits for the tag, a valid bit, and a dirty bit)? If a cache

hit takes 1ns, and a cache miss takes 10ns to service, how long will it take to access the following sequence ofaddresses, assuming that all entries of the cache are initially invalid?4, 8, 12, 16, 4, 4, 20, 4, 16, 68, 132, 72, 8, 12, 68, 4, 100, 52, 20, 4, 8, 12, 16, 4, 4, 256, 4, 16, 516

(b) Repeat for a fully associative cache (remember to include LRU bits for the non-direct-mapped caches!).(c) Repeat for a 4-way set-associative cache.

(d) Repeat for a 4-way set-associative cache with a cache line size of four words. The total capacity should still be256 bytes.

2. Pipeline Control organization shown on page 2 of the notes, show the cycle-by-cycle state of the scoreboard to execute the followinginstructions: Refer to the online notes on pipeline control for this problem. Assuming we have the pipeline

A. ADD R1 R3B. SUB R2 R

D. MUL R5 *R2C. XOR R1 R

E. ADD R4 R5F. ADD R1 R

Assume all “regular” arithmetic operations take one cycle to execute. Assume multiplication takes 2 cycles. Assumethat all memory accesses hit in the cache and take one cycle. Complete all cycles up to and including when instructionF reaches the Load/Exec1 stage. Also, draw in the bypass paths used to route the register values from producers to

consumers (in the mini-pipeline diagrams on the right on the next page). This should look similar to the examples fromthe notes. Use the following template:

RF Load^ BP1 BP2Store RF Load^ Store RF Load^ Store

INT

INT

RF Load^ Store RF Load^ Store RF Load^ Store RF Load^ Store RF Load^ Store RF Load^ Store

F D LE E2 SW

F D LE E2 SW

F D LE E2 SW

B A

F D LE E2 SW

F D LE E2 SW

F D LE E2 SW

F D LE E2 SW

F D LE E2 SW

F D LE E2 SW

INT1 00 INT2 LOADSTORE 00 00 00 R0RF 0 R1RF 0 RFR2 0 R3RF 0 R4RF 0 R5RF 0 R6RF 0 RFR7 0

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R

INT1 INT2 LOADSTORE R0 R1 R2 R3 R4 R5 R6 R