
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: