exam4b_sol

exam4b_sol - CS/ECE 252: INTRODUCTION TO COMPUTER...

Info iconThis preview shows pages 1–5. 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: CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON Prof. Mark D. Hill & Prof. Mikko H. Lipasti TAs Sanghamitra Roy, Eric Hill, Samuel Javner, Natalie Enright Jerger, & Guoliang Jin Midterm Examination 4 In Class (50 minutes) Friday, December 14, 2007 Weight: 15% CLOSED BOOK, NOTE, CALCULATOR, PHONE, & COMPUTER. The exam in two-sided and has TEN pages, including two blank pages and a copy of the Standard ASCII Table , some Trap Service Routines description and the LC-3 Instruction Set handout on the final page (please feel free to detach this final page, but insert it into your exam when you turn it in). Plan your time carefully, since some problems are longer than others. NAME: __________________________________________________________ SECTION:_______________________________________________________ ID# ______________________________________________________________ 1 Problem Number Maximum Points Points Awarded 1 4 EH 2 2 SR 3 7 SJ 4 8 NEJ 5 7 GJ 6 2 SR Total 30 2 Problem 1 (4 points): Short Answers a. What is the problem with using the string AND as a label in an LC-3 assembly language program? Using an instruction as a label confuses the assembler because it treats the label as the opcode itself so the label AND will not be entered into the symbol table. Instead the assembler will give an error in the second pass. b. What single instruction is equivalent to the following two LC-3 instructions? LEA R7, #1 JMP R3, #0 JSRR R3 c. The LC-3 assembly process is done in two complete passes through the entire assembly language program. What is the objective of the first pass? To identify the actual binary addresses corresponding to the symbolic names (or labels). This set of correspondences is known as the symbol table. d. What is the purpose of .FILL pseudo-op? .FILL tells the assembler to set aside the next location in the program and initialize it with the value of the operand. Problem 2 (2 points): Memory-Mapped I/O Suppose an ISA has a 16-bit address space. All addresses wherein bits[15:13] = 111 are allocated to I/O device registers. a. What is the minimum address of I/O device registers? 1110000000000000 b. What is the maximum address of I/O device registers? 1111111111111111 3 Problem 3 (7 points): Two-Pass Assembly Process An assembly language LC-3 program is given below: 1 .ORIG x3100 2 ONE LD R0, A 3 ADD R2, R2, R0 4 TWO LD R0, B 5 ADD R2, R2, R0 6 ST R2, SUM 7 TRAP x25 8 A .FILL x0002 9 B .FILL x0003 10 C .FILL x0004 11 .END a. Fill in the symbol table for the program: Symbol Address ONE x3100 TWO x3102 A x3106 B x3107 C x3108 b. Assuming that both passes of the assembler were to execute, write the binary word (machine language instruction) that would be generated by the assembler for the first instruction of the program....
View Full Document

Page1 / 10

exam4b_sol - CS/ECE 252: INTRODUCTION TO COMPUTER...

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

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