

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Name:
Directions: Work on this sheet (on both sides, if needed) only; do not turn in any supplementary sheets of paper. There is actually plenty of room for your answers, as long as you organize yourself BEFORE starting writing. In order to get full credit, SHOW YOUR WORK.
(a) (5) How many chips would we need?
(b) (5) How many data lines would we need in the bus?
(c) (10) Fill in the blank with the correct count: Each word of system memory (e.g. each C variable of type int) would be stored in chips.
(a) (5) Will the accesses to 19 and 20 produce a hit or miss?
(b) (5) Fill in the blank: The sequence of accesses to 18, 19 and 20 is an example of locality.
(a) (5) How many wires are in the line labeled Binvert? How many in Operation?
(b) (5) What is the numerical value on the green Carryin at the very top of the figure? Give a clear explanation for this.
struct S { int X; char A,B; }; ... ... struct S U,V;
(Assume that storage is in “nonreverse order.”) Write a short (but complete) C program to test this, using the above example. Your program must end its output by reporting either “gap between structs” or “no gap”, ac- cording to whatever its findings are.
(a) (5) Write a boolean equation (this term is introduced on p.1 of our digital logic notes) that expresses r in terms of u, x and y.
(b) (5) Show how to use the MUX on p.4 of the notes to produce r from u, x and y. Use the same notation for the MUX inputs (A, D1, D0) and output (Z) as on p.4. We will set r to Z. State what A, D1 and D should be set to.
ln = wa mod 8
as our index into the cache, in this problem we will con- sider alternative mappings, of the type
ln = (k wa) mod 8
(The original design on p.546 has k = 1.) To make mat- ters simple, we will use all 5 bits of wa as the tag (even though this may be wasteful).
(a) (10) Why would it be very undesirable to use k = 4? Be very specific and clear in your answer.
(b) (10) Give a value for k, other than 1, which would not have the disadvantage of k = 4.
int x[1000];
and suppose the address of x[0] is 32. If an access to x[50] causes a cache miss, which other elements of x—if any—will be brought into the cache besides x[50]?
Solutions:
1.a. 32/4 x 8/2 = 32.
1.b. 8.
1.c. 4.
2.a. Miss, miss.
2.b. Spatial.
3.a. 1,2.
3.b. It’s 0 unless we want to computer a-b, in which case it’s 1; see Patterson and Hennessy.
struct S { int X; char A,B; }
struct S X,Y;
main()
{ if ((int) &V - (int) &U > 6) printf("gap\n"); else printf("no gap\n"); }
5.a. r = u x + u y.
5.b. A = u, D1 = x, D0 = y.
7.a. We would not use all of the cache.
7.b. Any number relatively prime to 8. (Credit not al- lowed unless get part (a) correct.)