ID: B CSE 2021 Computer Orgniztion Midterm Test (Fll 2009) Instrutions This is losed ook, 80 minutes exm. The MIPS referene sheet my e used s n id for this test. An 8.5 x 11 Chet Sheet my lso e used s n id for this test. MUST e originl hndwriting. This is question/nswer ooklet: Write your nswers in the spe provided nd s indited in eh question. Use the kside for srth work. Do not hnd in nything other thn this ooklet. Fill in your personl dt in the ox elow efore the strt of the exm nd then wit until the instrutor hs distriuted the exms to ll students. Do not turn this pge over until the instrutor hs nnouned tht you my do so. Keep your York photo ID (or ny other eptle photo ID) on the desk in front of you so tht the instrutor my inspet it without disturing you. You my use ONLY those instrutions tht pper in the MIPS sheet. Whenever needed, ssume tht the mhine is little endin. No questions during the exm. Write your finl nswer with pen. LAST NAME: FIRST NAME: STUDENT NUMBER: PRISM LOGIN: Setion Points Mrk A 20 B 20 C 10 TOTAL 50 Pge 1 of 8
Nme: Setion A <5 questions x 4 points eh = 20 points> For questions in this setion, speify the ontent of the required register(s), in the required rdix fter the A B. speified ode is exeuted. Note the following lrifitions: We speify the hexdeiml nottion with the prefix of 0x suh tht representtion15 ten = F hex is equivlent to 0x0000000F or 0xF in short. Assume dt speified in MIPS instrution is stored s ontiguous lok. 1. ddi $t1, $0, 64 ddi $t2, $t1, -45 div $t1, $t2 mfhi $t3 mflo $t4 $t3 (in deiml) = $t4 (in deiml) = 2. ddi $t0, $0, 0x7 ddi $t1, $t0, 0x ddi $t2, $0, 40 mult $t1, $t2 mflo $t1 $t1 (in hex) = $t2 (in hex) = Pge 2 of 8
Nme: 3. l $t0, hr l $t2, 5($t0) ddi $t2, $t2, -43 dd $t0, $t0, $t2 l $t3, 0($t0).dt hr:.siiz 123d4e5 $t2 (in deiml) = $t3 (in deiml) = 4..dt n:.word 19, 59, -13 n:.word 15, 9, -2, -7.text min: ddi $t2, $0, 24 l $t3, n($t2) l $t2, n($0) $t2 (in deiml) = $t3 (in deiml) = 5. strt: ddi $0, $0, 15 ddi $t0, $0, 0 ddi $t1, $0, 3 gin: slt $t2, $0, $t1 ne $t2, $0, end dd $t0, $t0, $t1 ddi $t1, $t1, 3 j gin end: dd $v0, $t0, $0 $v0 (in deiml) = Pge 3 of 8
Nme: Setion B <2 questions x 10 points eh = 20 points> For eh question, write your nswer in the ox provided. 6. A inry-to-seven segment deoder is logi iruit tht onverts numer expressed in inry to n pproprite ode for the seletion of segments in disply inditor illustrted in fig. 1. f e g d Fig. 1: Segment designtion in seven segment deoder The inry-to-seven segment deoder hs three input its, sy x, y, nd z tht hold the 3-it inry representtion of the numer to e displyed. The seven outputs of the deoder (,,, d, e, f, nd g) selet the orresponding segments in the disply re shown in fig. 2 to highlight the numeri digits eing displyed. f g g f g e d e d d f g f g d e d Fig. 2: Numeril designtion for disply of numer (from 0 to 7) As n exmple, if inry numer 001 is to e displyed, the inry inputs to the deoder re x = y = 0 nd z = 1 with the outputs = = 1. The remining five outputs, d, e, f, nd g re ll 0. For the inry-to-seven segment deoder, shown in figs. 1 nd 2: ) Drw the truth tle with three inputs (x, y, nd z) nd ONLY the first three outputs (,, ). Pge 4 of 8
Nme: Inputs Outputs x y z 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 ) Bsed on the truth tle drwn in ), derive Boolen expressions for eh of the first three outputs (,, ). ) Provide simplified Boolen expressions for eh of the outputs in prt (). Pge 5 of 8
Nme: ) Using AND, OR, nd NOT gtes, drw digitl iruits tht implement the first 3 outputs (,, ) from the inputs (x, y, nd z).. Pge 6 of 8
Nme: 7. Fig. 1 shows the shemti digrm of NOR gte Fig.1: Shemti digrm of the NOR gte whih hs the following truth tle = NOR 0 0 1 0 1 0 1 0 0 1 1 0 A NOR gte is universl gte euse ny digitl omponent n e implemented using NOR gtes only. Implement () NOT gte, () n AND gte nd () n OR gte using only NOR gtes. You my use more thn one NOR gte ut no other type of gte my e used. ) NOT gte () n AND gte Pge 7 of 8
Nme: () n OR gte. Setion C <1 question x 10 points eh =10 points> Write your nswer in the ox provided. You hve to follow the MIPS stndrd onventions of using the registers, i.e. registers $0 - $4 re used for pssing rguments to proedure, registers $v0 - $v1 for returning results, et. 8. Write miniml sequene of MIPS instrutions tht swps the ontents of registers $s1 nd $s2 if the vlue in $s1 is greter thn or equl to the vlue stored in $s2. Otherwise, it leves the ontents of the registers unhnged. Pge 8 of 8
ID: B CSE 2021 Computer Orgniztion Midterm Test (Fll 2009) Answer Setion SHORT ANSWER 1. ANS: $t3 (in deiml) = 7 $t4 (in deiml) = 3 2. ANS: OBJ: Setion A $t1 (in hex) = 760 10 = 0x2F8 $t2 (in hex) = 40 10 = 0x28 3. ANS: OBJ: Setion A $t2 (in deiml) = 8 $t3 (in deiml) = 101 4. ANS: OBJ: Setion A $t2 (in deiml) = 19 $t3 (in deiml) = -7 OBJ: Setion A Pge 1 of 5
ID: B 5. ANS: $v0 (in deiml) = 45 OBJ: Setion A Pge 2 of 5
ID: B PROBLEM 6. ANS: () The truth tle for the inry-to-seven segment deoder is shown elow (ll 7 outputs re shown only,, required for this question): () Inputs Outputs x y z d e f g 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 0 0 1 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 The Boolen expressions (for ll 7, only,, required) re given elow = x y yz + x z + xy + xyz, = x z y yz + x + xyz, = x z yz + x + x z + xy + xyz, d = x y yz + x z + xy, e = x y + xy, f = x + x + x z + xy, nd g = x y yz + x + x z + xy. () The expressions for,, n e simplified firly onsiderly: = x + (x y + x )z + xy = x' z' + (x + y)(xy)' z + xy = x' z' + xz + yz + xy = (x + z)' + xz + y(x + z) = y + x' z' + xz = x + yz + (x z + x )y' = x' z' + yz + (x + z)(xz)' y' = (x + z)' + yz + (x + z)(xz)' y' = x' z' + yz + x' y' + z' y' = x'(z' + y') + yz + y' z' = x'(yz)' + yz + y' z' = x' + yz + y' z' = x + yz + x + xy = y' + y( z + xz') = y' + y( z + x) = x + y' + z (d)the digitl iruits n e drwn from the ove Boolen expressions. Pge 3 of 5
ID: B OBJ: Setion B.2 Pge 4 of 5
ID: B 7. ANS: () NOT gte () AND gte () OR gte 8. ANS: slt $t0, $s1, $s2 ddi $t1, $0, 1 eq $t0, $t1, exit ddi $t2, $s1, 0 ddi $s1, $s2, 0 ddi $s2, $t2, 0 exit: OBJ: Setion C Pge 5 of 5