11 Pages
Unlock Document

University of Toronto St. George
Electrical & Computer Engineering
Robert Brym

Page 1 of 11 Last Name (in case pages get detached):__________________ UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING MIDTERM EXAMINATION, MARCH 2007 ECE243H1 S – COMPUTER ORGANIZATION Exam Type: D Duration: 2 Hours A. Moshovos and G. Steffan This is a type D exam. You are allowed to use any printed material but not a calculator. Last Name (Print): __________________ First Name: _________________________ Student Number: _____________________ Max. Marks Marks 1 20 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 Total 100 Please: State your assumptions. Show your work. Comment your code. Use your time wisely as not all questions will require the same amount of time. If you think that assumptions must be made to answer a question, state them clearly. If there are multiple possibilities, comment that there are, explain why and then provide at least one possible answer and state the corresponding assumptions. Page 2 of 11 Last Name (in case pages get detached):__________________ Marking starts at the maximum grade per question and you deduct as per the instructions. If you reach 0 you stop. Page 3 of 11 Last Name (in case pages get detached):__________________ 1. [20] Basic Instruction SemantiAssume the following initial state for registers: R8 = 0x12345678 R9 = 0xFAFB12AE R10 = 0x01000100 R11 = 0xFFFFFFFE R12 = 0xFFFFFFFF In the following lists of instructions, determine what is the outcome of the instruction and write in hexadecimal using all eight digits (that is write 0x00000000 and not 0x0). In all cases find the outcome of each instruction given that it executes with the initial state given above. a. ADDI R2, R10, 2 R2 = _____0x01000102_____ b. ADD R2, R9, R12 R2 = _____0xFAFB12AD______ c. ADD R2, R9, R11 R2 = _____0xFAFB12AC______ d. OR R2, R8, R10 R2 = _____0x13345778________ e. ORHI R2, R8, 0xFFFF R2 = _____0xFFFF5678________ f. XORI R2, R8, 0x5678 R2 = _____0x12340000________ g. ANDI R2, R11, 0x1111 R2 = _____0x00001110________ h. MOVIA R2, 0x90000000 R2 = _____0x90000000________ i. ADDI R2, R0, 0x0012 R2 = _____0x00000012________ j. ADDI R2, R0, 0x8000 R2 = _____0xFFFF8000________ -2 for each incorrect answer Max -2 per point. No partial marks for some digits being correct. Page 4 of 11 Last Name (in case pages get detached):__________________ 2. [10] Memory Operations: Assume the following initial state: R8 = 0x01000100 R9 = 0x897601FE What is the value of R2 when each of the following instruction sequences executes for little- and big-endian machines? Bi-iteiEndian STW R9, 0(R8) 0x897601FE 0x897601FE LDW R2, 0(R8) STW R9, 0(R8) 0xFFFF8976 0x000001FE LDH R2, 2(R8) STW R9, 0(R8) 0x000001FE 0xFFFF8976 LDH R2, 0(R8) STH R9, 0(R8) 0x00000001 0xFFFFFFFE LDB R2, 1(R8) STH R9, 0(R8) 0x00000001 0x000000FE LDBU R2, 1(R8) -1 for each incorrect answer Max -1 per point. No partial marks for some digits being correct. 3. [10] Instruction Semanticsif, initially, R8 = N, where N is a positive integer, how many times does the following loop iterate? KOKO: ADDI R8, R8, 1 BRTOKO Number of Iterations = _0x7FFFFFFF - N _ -5 if the answer is not exact +/- 1 is OK -5 if the answer is not of the form CONSTANT - N 4. [10] Instruction Semantics:Please write the sequence of instructions that will execute given that execution starts at label KOKO below (instruction A). List instructions as A, B, and C as indicated to theeach instruction in parentheses. We already listed the first execution of A for you. (A) KOKO: CALL LALA (B) CAKOKO (C) LALA: RET Sequence of executed instructions: Page 5 of 11Last Name (in case pages get detached):__________________ A, _C, _B, _A, _C, _B, _A, _C, _B, _A, _C, _B, _A, _C, _B, _A, -2 if the second instruction is not C -2 if the third instruction is not B -8 if eventually they do not show the repeated sequence A, C, B This scheme allows for slightly “shifted” execution sequences. Page 6 of 11 Last Name (in case pages get detached):__________________ 5. [10] Basic C and AssemblyGiven the following assembly sequence: BEQ R9, R10, KOKO BLT R9, R10, KOKO BEQ R0, R0, LALA KOKO: ADDI R9, R9, 1 ADD R9, R9, R10 LALA: SUB R9, R9, R10 Which C statement does it implement? Circle the appropriate sequence below. Finding what registers a and b correspond to is part of the question. (a) if (a <= b) a = a + 1; else a = a – b; (b) if (a > b) a = a + 1; else a = a – b; (c) if (a >
More Less

Related notes for ECE385H1

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.