Baixe o app para aproveitar ainda mais
Prévia do material em texto
Ministério da Educação UNIVERSIDADE DE BRASíUA Instituto de Ciências Exatas Dep. Ciências da Computação Disciplina: ClC 116394 - Organização e Arquitetura de Computadores - Turma B Prof.: Marcus Vinicius Lamar 2006/2 Nome: Matrícula:------------------------------------------------- ----------------------- Prova (10.0) 1) Respeitando a convenção do uso dos registradores e utilizando chamadas ao sistema do SPIM. (5.0) a) Compile o seguinte programa C para Assembly MIPS. (2 -1 5)B2x3 = -4 3 2 #include -cstdio.h» void multM( int *resultado, int *mata, int nlina,int ncola, int *matb, int nlinb, int ncolb) void showM(int *mat, int nlin, int ncol) { int i,j; for(i=O;knlin;i++ ){ forQ=O;j<ncol;j++) printf("%d\t", *(mat +i*ncol+j)); printf("\n") ; int i,j,k,temp; if(ncola!=nlinb) printf("Dimensões Incompatíveis!\n"); } printf("\n"); else for(i=O;knlina;i++ ) forQ=O;j<ncolb;j++){ temp-o: for(k=O;k<ncola;k++) temp+=*(mata+i*ncola+k)*(*(matb+k*ncolb+j)) ; *(resultado+i*ncolb+j)=temp;void mainO { int m=3, n=2, p=3; int A[3*2]={2,5, 1,2,4,6}; int B[2*3]={2,-1 ,5,-4,3,2}; int C[3*3]={O,O,O,O,O,O,O,O,O}; int D[3*3]={O,O,O,O,O,O,O,O,O}; void addM( int *resultado, int *mata, int nlina,int ncola, int *matb, int nlinb, int ncolb) showM(A,m,n); showM(B,n,p); multM(C,A,m,n,B,n,p); showM(C,m,p); addM(D,C,m,p,C,m,p); showM(D,m,p); int i; if(nlina!=nlinb && ncolalencolb) printf("Dimensões Incornpatíveisl'n"); else for(i=O;knlina*ncola;i++) *(resultado+i)=*(mata+i) +*(matb+i); A empresa Silicon Inc. implementou um processado r com a ISA MIPS, chamando-o SI-L Nos anos seguintes esta empresa lança o SI-2 e o SI-3 com a mesma ISA. A tabela abaixo relaciona o tipo de instrução MIPS ao número de ciclos de clock necessários a sua execução em cada versão do processador SI: Tipo da Instrução SI-1 SI-2 SI-3 SI-4 Tipo-R 2 2 3 Tipo-I 3 2 2 Tipo-J 1 2 1 A freqüência de clock do processado r S1-1 é de 1GHz, do processador SI-2 é de 1.5 GHz e do processador SI-3 é de 2 GHz. Para o seguinte trecho de código C: multM(X,Y,4,3,Z,3,4); r X=YxZ *j multM(T,Z,4,4,Z,4,4); 1* T=ZXZ *j addM(V,Z,4,4,Z,4,4); r V=Z+Z *j Tipo multM addM Tipo-R 5+nlina,(1 tncolb,(5+8,ncola)) 5+4,nlin,f1co! Tipo-I 17:-n!ina, (1·ocoib.l4 -s.ncotaü ta-s.nun.ncot Típo-J 1tnlina.(1 -ncolb.It- ncclai) 1 -nlin.ncol (1.0) b) Quais os tempos que cada processador demora para executar este trecho? (1.0) c) Qual o fator de desempenho conseguido pela 2a versão do processador em relação à Ia versão? (1.0) d) Para melhorar o desempenho do melhor processado r para este trecho de código, que ciclos por instrução (Tabela) é necessário implementar em uma nova versão de baixo consumo do processado r, chamada SI-4 de apenas 1.0 GHz, sabendo que devido a limitação da tecnologia de fabricação do processador, a soma dos ciclos das instruções tipo R, I e J deve ser sempre 6. Qual será o ganho de desempenho alcançado? (2.0) e)Escreva o quadro acima com as medidas das suas rotinas de multM e addM. (1.0) 2) Complete a lacuna: O é o único indicador consistente do desempenho de um computador. BOA SORTE!!! J TeAr o V( o'bL __ C;Te:,//t __ 90 ~V(12 c q 4<=1 ~ I? Lq~:Õ j3 __ -+-__ LC1_~C1d}G Ltd fq1, I,?CjcEtt:J) _ _ L vi ~ VJ (*~ __ ~V1 Cf1, try{ ~I'J LV/ ~2j n(j~t(tJ) lw jOf~/ fCJtÇ!P) _ I/WJ:;Y{$Wlo ---I--J oc ?fhc.JM _ 101 L. 7111vi 11 1-_ 7ff t 5f)'Jt/M ~~--~~~ J l.e; $0%,: r - ÍqMI7 [o, ffa-1,!T _ _ -+-_ .c« i'41 c [,,~ + Ci II h(ft&!b ) _ _ tIA) ~z Y'/lf ....(lIJ) Lvi fo,} h[?I!flD) L_vJct~t_(Cf~f[J) J -ªdd~tttJ7~ -11- _ \ -qdd; !1fGJ?}~d2 _ _ ta fXft; fi t=: 1t~/~ ;"" ftr;ó'(J'31J \_ c;~ 1~~f(~$f) _ i w fX!f; r7Lj~llo) &uI tr1,_ t7 CjZEftJ) __ +-,,--"-/1/ f~ <j{$fof) ~;J. 'l. ;.f) _ LiA jfi»; f7[jlp((J) _ LvJ t~-.f(ítt~}_ I 5w ftJ1; i5(tf~r) __ 7U ~g(1?r/ J 1ft., f1v' bTft/l J A I. adcl M \~ ) c o»: -rU(2[V1fL 8 _~()Db / Z_ C;--qb:1/l/ TU U .pqTõL li ! .vJoao 1./7, 1 f 2/,; ~ ~2- .{JJIJ(I!l 2-/-1) ~-~/71Y- C; ·t.J~() O D /LO O O/O(D J //f I' /n: ,w~!') o DJJ J J o D u (J '/ ; J ,,- I , j I I )~: • 1.4Jt)U) '3 Y7: • (JJaf.v :2. f ';.f/OflO '3 (l e(.JL: .!t5 C ,I i t L' \ ri ' I íCfb', o 1}7C1i? (\ { /, rn~07r._,Â'?Ct'; ~'f},\~~00 ,,((pile,,) fI/e.) \'0" {)( 7~Oe/Uvv(/') TDPõ5 [2f28''7!;t?V w.-> ) jQ?vel/t. J:s. ~ lp~ 'eJ"...f' o(u. IL. 7. ~ ;VC) f)- r- --r (n , ) 11 ~ ) (11 (lvY::J • /lDvr3; j if /~ cf f"\~c/~ fft $q1 ~fJt/;; jr2-/ ~q(L (V'{> 1ft- Jt~ tr '7 [w rJt6/D(tfV o- j t?/ 'jd5!L ~ _ _ __ _ //Iv jXt~ ufr7f) ___ _ _ _ Á ,0) i;'fYJ'1j (Ot _ _ _" ,qJ4Ã tÇPff, fY5(, 1J- ) (I ovlf ftlr_4~f _ J_ Ibh e, $;('j,,1:f§J11M t /ljO/Je ft4 ~c;f? _ _ f1-()I/i--~trl f2J5i0O ;l1wt ;fUL 1q~ L~(o1; pef JfT; ftz f/p 1 _ :#--A (L)l'f_ ~f.)lft- jt2rL~IL~_ flDV& ft-f J2-foM _ _ (1DUe tf t~lji=ilj) - !f1c-oJ-: ,f?t!f ft~jtÇ I ~~(?~ _ .J f ICDL [) Loof1:f /;?e.:;- tf,B,:f:tJ} r;'h_1 _ n0Vfi- itftJfrW'iC' f1[J(ffr f 1:1/ tU/lD (f! J& ~~ fJ~í(.0 VDO{l:1 /9€f f /'1; ft/, r:0 ~ ~~74 'p~ ,f:j~Jt3/ f,;/f) 3 J1 i« 1 f M<i( ~51)n-jn - ~~ - - {,.w tq~{J (:fI?) PldcJ -f~ 11_f21 ib _-4- _ _ _?I'7ur~~ 7vL ,?~pf"1/;2 i: ~v~ L[ _ t-O(JJ $?lJ51;ft;1 Lct tC1~/ 1étf1 I (Z -t: - 46~) t~ Pt6 _ 9Yf(If(;(, !JtJef fSL/ jf2; ~ff : PidcU ;r1~~X?/1 ?~V 1fL I )52,{/ l- ctcl~ q,iP-t ~t~ 1 ~ JJ j7~J $5}/1Jfl( . &. l-oof;L _lw ~1~çJ (P71) FM;: 0/ ~~ <-I _ I 0W f 7~ ~(f5b) tq 10(2)/ r./EY!'- ~M Ú L j J7; fiL W 5 ti 1 7Y7{/flll _ I ilIJd_12t1; ff~} 0> c<dd1~fÃ~}r711 _ qdd j t~ }tJ/1 j L()~f1 _ _ 1_Wc(O 3 _ h~ tiJllft; '"L __ _~ p3~ (lLJL,--l f51( f:;tP( t1t. __ &Cf f:?~"'fyJ L _ _ _ o_JJ $f;1 ~~}r~ _ _ _~5J7Cfyl;/~ 7tL CP~V51 :L ifY frq ~Jd i~1/f 5~/ft% ~q~ 17 ,fG111 M (JCjytt) J1~?,((~W~) / ff1, 5~{JJ fL1 ?w 15i;o (ff1 ) ~ c!J -=tfl/ jt~ 1 d UtCra;L ~dd 91"1-/ f11-/ 1 ~fACD1 _ J(L$~ ___ (}))_ jb~f/l/~ p.o I' ~ til I~ )}/I.~(,~ VL Vê r M : --- - y( = ~1fl~/1J (, frC!K,~ (7' 1. fp{}j(.,·f9)) :L - ( .+ rJJ rA-C ~..-fr (Gbt5 (Lf +_h;rJ(J5 Jf)) ~ :) - -t- ti t.A'j1IIr ( 1-to f (1Jt (1; C l -#: ti(J;(... ;f-2) ~ V1dJh~ I'1c/e; 5~~4ff_ hDVC ttt1 4'11 I~o"trj fl~.;J .,1 -- navE 1'1J)1q7_ Lt.P tt(tJL,j7fJ LIv *t?: ~C ~ 5() LW -fr tj f[j~)_ _ _ _ 1Pf~ 1~1;j7f; 17- t'nt ~tcZ)ri>t~1 __ f-;7~~:eVOV"l Q)0' &~;;;. -- brt-_ 1t))j-t~/ {,((/l91 . (7~\~~~_ (l tJ L j j T/-J t~~tJ r o IJ 13 f t-f J t 'Z-t;ruJ tuf';t:-C P~f rJt~Jt~/Rl"lfí 1 5~L ~tí/~t~L Pf Jd ~ç~ f t,,/f1"" qJ cJ ,?~Ptl-fí Jt'J _--+Lw ,;; ? /O(j512 &~ j 71)- (J [fo 7~) ~dd ~~) t2~í?'t __ cAJdJ~11 l_tz;iti - - 7!:! i~~dCfçu - - ____ t?1dd t f7tP/}t~ 1 /.JJf1t-1 nr~(1. ft~f1J7L ~. 17X6} '1 _ 13Jl~&WJ..ZT. ?y5rYrúL &'J7)<iT i- - - -- I - _ffJ~M: - __ _ - _ l := ti-t 1ft/Lir Xi'G~t.... __ ! 1, :-: , 6 r t í,IV x. r~O Lr: - - --- I J :; t -f 1/,;:"'· ,!CD'-r - - - - f-- - - - -- I I - -------- ------ --- -- D rV{(MIJ e 1143 J 5i'b 1f<1 r=. b) 5]:_1 ~_Cl--::ZC113-r-601 +6~)+'l77?tlfbí-t110) f/(6'f!Ti11 C:L --:;'7?JJ. s: 0'<- (()7 ->; s, ':9,z?,P 5 I {j-fj (2-- -ç 71- --z.'. CL -:-~J( 11Lf '3 'tj' 1(171) ~2 k 1q 1 .: C1 z: 47'-10 c;-~(a) -j3/0J6'tfr)- - - y - -- -- <72- ~7: C.!- .: "7~ 11L('7 + ,{,-(~7b + {J( 1y 1 =-- 1-t:z 1 (j'GuJ CJ z: t;;t;fJ.. c.c S -) J.,lt7('JA.~ J{ G-H T- e) ? =.T~ _ f}_t7' ~ t~ I )1 ~3 r .eo 191"-1, \ , 0 d) ~ --'j 1J -'r 1 J-'')7 _ _ 71Lt ~I x f1t.f~· 1 x: 1~fat ~!( l71 .: ;..1-3, (I'V~J) 1(;-'71- _ _ _ ::2/l1 j jA} _ f?=- ~9ú -) -0/ Cj2í n f11!-, I&jfJ(lC) C~_4l_:> ) '\ \/ TVfI-~tL If ~ _ 1'10 o _ j b2g d) 51-1". CJ.::1 l) 11;1?t tçl1+j~ t 1-22 t !1c- f 5'6; + ~b1) L __ 1 t 1(,131 f /)b 12 1r f?) ::- f > 171- I rr~ -12;. 1J? J 11-) r•. - ----- ~- 2.: (1 -= .tx 3'100 f-/Lk ZóLJ T J..% l.( :;'3 _= 1300L t56 li? -) t tt õt í n:»: (7 .: ")(~'100 +l;tJ6Zi'-t 1 J<. Lfij ~ 1,!1?C; rz-6H~ -> t/ 10'1ff 5 __ - _ e) VZ;;: 7 '1L..:1 -:; [) i '1J b í9J/~I ) /L -',71 1-')1 :J':' ~ _ '?t-'1 : C.z:1 J(JL,Op ,17 z: II_OD7 ---- - -----
Compartilhar