






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Answers and explanations for the 2005 cs61c final exam, covering topics such as number representations, memory management, mips assembly, datapath, cache and virtual memory, and potpourri. It includes detailed calculations, code snippets, and diagrams to help understand the concepts and problem-solving strategies.
Typology: Exams
1 / 11
This page cannot be seen from the preview
Don't miss anything!







32
5
32
2
32
64
31
M2:C
int Delete (slicenode_t plan) { if(plan->type == RECTANGLE) { / leaf / free(plan); return(1); } else { if plan->type == CUT) { / inner node */ **slidenode_t L, R; L = plan->L; R = plan->R; free(plan); return(1+Delete(L)+Delete(R)); } else { printf("Delete(): plan->type was %d, expected %d or %d", plan->type, RECTAN CUT); exit(1); } } }
int Delete (slicenode_t plan) { if(plan->type == RECTANGLE) { / leaf */ **free(plan); return(1); } else { slidenode_t L, R; L = plan->L; R = plan->R; free(plan); return(1+Delete(L)+Delete(R)); } }
int Delete (slicenode_t plan) { if(plan->type == RECTANGLE) { return(1+(0free(plan))); } else { /* inner node / return(1+Delete(plan->L)+Delete(plan->R)+(0free(plan))); } }
F1:Datapath
F2:Cache/VM
7
3
7
12
7
12
19
12
F4:SDS
PP I OO NN (Input/Output label for edge) [#ZI(ABC) = NumberOfZerosIn(P1,P0,I)] 10 10 10
S00 0 11 S00 (0/ 3 ) # Had two 0s, another one means we stay here and output #ZI(000)= S00 1 10 S01 (1/ 2 ) # This is our first 1 in a while, register we’ve seen a 1 by
S01 0 10 S10 (0/ 2 ) # Saw a 01 before but this 0 means we goto S10 and output #ZI(010)= 2 S01 1 01 S11 (1/ 1 ) # This is the 2 nd^1 in a row, go to S11 and output #ZI(011)= 1 S10 0 10 S00 (0/ 2 ) # Saw a 1 2 timesteps ago, nothing since. Goto S00,output #ZI(100)= S10 1 01 S01 (1/ 1 ) # Saw a 1 2 timesteps ago, a 1 now. Goto 01, output #ZI(101)= S11 0 01 S10 (0/ 1 ) # Saw 2 straight 1s, now a 0. Goto S10, output #ZI(110)= S11 1 00 S11 (1/ 0 ) # Everything is coming up 1s! Stay here (in S11), output #ZI(111)= 0
= P1(PO+I) + P1(P0I)* # DeMorgan’s law __ __ __ _ __ _ = P1 P0 + P1 I + P1 P0 I # distribution
O1 = P1 P0 + P1 I + P1 P0 I # from above __ __ __ _ __ _ __ __ _ O1 = P1 P0 + P1 I + P1 P0 I + P1 P0 I # distributive+law-of-1s+identity __ __ __ _ __ __ _ O1 = P1 P0 + P1 I + (P1+P1)P0 I # distribution __ __ __ _ __ _ O1 = P1 P 0 + P1 I + ( 1 )P0 I # complementarity __ __ __ _ __ _ O1 = P1 P0 + P1 I + P0 I # identity __________________ O1 = (P1P0 + P1I + P0I) # lots more Boolean algebra!
O1 = P1 P0 I + P1 P0 I + P1 P0 I + P1 P0 I # sum-of-products __ __ _ __ __ __ __ _ __ _ __ __ _ __ _ O1 = P1 P0 I + P1 P0 I + P1 P0 I + P1 P0 I + P1 P0 I + P1 P0 I # rev idempotent, commutativity __ __ _ __ _ __ __ _ __ O1 = P1 P0(I+I) + P1 I(P0+P0) + P0 I(P1+P1) # commutativity, rev distrib __ __ __ _ __ _ O1 = P1 P0( 1 ) + P1 I( 1 ) + P0 I( 1 ) # complementarity __ __ __ _ __ _ O1 = P1 P0 + P1 I + P0 I # identity __________________ O1 = (P1P0 + P1I + P0I) # lots more Boolean algebra!
F5:Potpourri
64
10
14
28
2
2
2
2
2