winter2002_practice_exam1_sol

winter2002_practice_exam1_sol - EECS 370 Practice Midterm...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EECS 370 Practice Midterm (Winter 2002)ANSWERS 1 EECS 370 Practice Midterm (Winter 2002) ANSWERS This was for a 50 minute exam. It is closed book/notes. There are 3 problems on 9 pages (Problem 3 has three parts). You are to abide by the Univer- sity of Michigan/Engineering honor code. Please sign below to indicate that you have abided by the honor code on this exam. Honor code pledge: I have neither given nor received aid on this exam. Signature:___________________________ Problem 1 ______ out of 15 Problem 2 ______ out of 15 Problem 3A ______ out of 15 Problem 3B ______ out of 25 Problem 3C ______ out of 30 Total: _______ out of 100 Name:________________________________ Uniqname: ____________________________ EECS 370 Practice Midterm (Winter 2002)ANSWERS 2 Uniqname:__________________________________________ 1. Assembly Language and Stored-Program Concept (approx. 7 minutes) Imagine that your task in Project 1 was to write an LC2K2 assembly-language program that will copy the word at address 8 into register 1 (then halt), and then to assemble and run this LC2K2 program on your assembler and simulator. Your simulator works perfectly, but unfortu- nately your assembler can only parse .fill instructions (i.e. your assembler cant parse add, nand, lw, sw, beq, jalr, halt, noop). Write an LC-2K2 assembly-language program to copy the word at address 8 into register 1 (then halt), in a way that your assembler and simulator can handle (i.e. use only .fill instructions). You may use binary arguments for .fill instructions. Show your work. Page 3 has the Project 1 description of the LC-2K2 in case you need it. lw 1 8 halt must use .fill because of broken assembler, so translate by hand into machine code lw 0 1 8 ==> 010 000 001 0000 0000 0000 1000 halt ==> 110 000 000 0000 0000 0000 0000 so final program is .fill 010 000 001 0000 0000 0000 1000 .fill 110 000 000 0000 0000 0000 0000 EECS 370 Practice Midterm (Winter 2002)ANSWERS 3 Uniqname:__________________________________________ The LC-2K2 is an 8-register, 32-bit computer. All addresses are word-addresses. The LC-2K2 has 65536 words of memory. By assembly-language convention, register 0 will always contain 0 (i.e. the machine will not enforce this, but no assem- bly-language program should ever change register 0 from its initial value of 0)....
View Full Document

Page1 / 9

winter2002_practice_exam1_sol - EECS 370 Practice Midterm...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online