Topic: 3.63 Score: Two-point job process:
int sum_col (int n,int a[e1 (n)][e2 (n)],int j) { int i; int result = 0; for (I=0;i<e1 (n); i++) result + = A[i][j]; return result;}
Above is the original code
Assembly code
MOVL 8 (%EBP),%edx; edx:n Leal (%edx,%edx),%eax; eax:2n leal-1 (%eax),%ecx ; ecx:2n-1 Leal (%eax,%edx),%esi; esi:3n, (E1 (n)) Movl $0,%eax; E ax:0 (Result) testl%esi,%esi; verify esi (positive \ Negative) Jle. L3, if E1 (n) ≤0 in Esi, jump Leal 0 (,%ecx,4),%ebx; ebx:0+4*ecx=4 (2n-1) MOVL (%eb p),%eax; eax:ebp+16 (Address of J) Movl (%EBP),%edx; edx:ebp+12 (a[i) Leal (%edx,%ea x,4),%ecx; Ecx:edx+4*eax (A[i][j]) movl $0,%edx; edx:0 movl $0,%eax Eax:0.l4; loop Addl (%ECX),%eax; Eax+=ecx ((A[I][J) Address) Addl $1,%edx; edx:edx+1 (i) Addl%ebx,%ecx; ECX:ECX+EBX (ecx:a[i+1][ J]) Cmpl%esi,%edx; compare esi with edx (E1 (n) and ICompare) JL. L4; if I<e1 (n), jump, return to loop. L3;
E1 (n) is stored in ESI, E1 (n) =3n;
E2 (n) is stored in ebx, Ebx=4*e2 (n), so E2 (n) =2n-1.
Topic: 6.31 Score: One-point job process:
A E=4,b=4,s=8
So c=e*b*s=128
B.
Topic: 6.32 Score: Two-point job process:
Available from question 6.31:
Block Shift number b=2 ==>co
Number of group index bits s=3 ==>ci
Number of Mark bits t=8 ==>ct
Then 0x0718 into binary to get 0000011100011000, and then in order to fill in the address:
The index bit is 6, the cache is shown as 38, so you can see 6.31 of the line with the image index bit 6, there are two 38 of the marker bit, so the cache shows hit. But the first state is 0 so the hit is the back of FA
Topic: 6.42 Score: Two-point job process:
Total reading is 2912
Total number of misses read 728
25% no-Hits
20135206 at Jia Xin "Homework Summary"