CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON. Instructor: Rahul Nayar TAs: Annie Lin, Mohit Verma

Similar documents
CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON. Instructor: Rahul Nayar TAs: Mohit Verma, Annie Lin

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON. Instructor: Rahul Nayar TAs: Annie Lin, Mohit Verma

UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON

UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON

UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252 Introduction to Computer Engineering

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

11/10/2016. Review the Problem to Be Solved. ECE 120: Introduction to Computing. What Shall We Keep in the Registers? Where Are the Pieces in Memory?

Introduction to Computer Engineering. CS/ECE 252, Fall 2016 Prof. Guri Sohi Computer Sciences Department University of Wisconsin Madison

Introduction to Computer Engineering. Chapter 5 The LC-3. Instruction Set Architecture

Chapter 6 Programming the LC-3

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON

Introduction to Computer Engineering. CS/ECE 252, Spring 2017 Rahul Nayar Computer Sciences Department University of Wisconsin Madison

Department of Electrical and Computer Engineering University of Wisconsin - Madison. ECE/CS 352 Digital System Fundamentals.

8*4 + 4 = 36 each int is 4 bytes

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

UW CSE 351, Summer 2013 Final Exam

The MARIE Architecture

Department of Electrical and Computer Engineering The University of Texas at Austin

Technical Information. Command overview of Vision Systems

Introduction to Computer Engineering. CS/ECE 252, Spring 2017 Rahul Nayar Computer Sciences Department University of Wisconsin Madison

ECE331 Homework 4. Due Monday, August 13, 2018 (via Moodle)

Computer Architecture and Engineering. CS152 Quiz #1. February 19th, Professor Krste Asanovic. Name:

ECE 109 Sections 602 to 605 Final exam Fall December, 2007

Do not start the test until instructed to do so!

ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Student Number: CSE191 Midterm II Spring Plagiarism will earn you an F in the course and a recommendation of expulsion from the university.

EEL 5722C Field-Programmable Gate Array Design

16.317: Microprocessor Systems Design I Fall Exam 3 December 15, Name: ID #:

Department of Electrical and Computer Engineering University of Wisconsin Madison. Fall Midterm Examination CLOSED BOOK

Lab8: SAM Assembler and Simulator

Address Modes effective address

Note that there are questions printed on both sides of each page!

AP PHYSICS B 2009 SCORING GUIDELINES

MA 113 Calculus I Fall 2015 Exam 2 Tuesday, 20 October Multiple Choice Answers. Question

Write only as much as necessary. Be brief!

Introduction to Computer. Chapter 5 The LC-3. Instruction Set Architecture

Name: University of Michigan uniqname: (NOT your student ID number!)

Fortunately not. In LC-3, there are a variety of addressing modes that deal with these concerns.

Chapter 5 The LC-3. ACKNOWLEDGEMENT: This lecture uses slides prepared by Gregory T. Byrd, North Carolina State University 5-2

ECE251: Intro to Microprocessors Name: Solutions Mid Term Exam October 4, 2018

OF VICTORIA EXAMINATIONS- DECEMBER 2010 CSC

UW CSE 351, Winter 2013 Final Exam

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

Computing Layers. Chapter 5 The LC-3

Prelim CS410, Summer July 1998 Please note: This exam is closed book, closed note. Sit every-other seat. Put your answers in this exam. The or

Computer Architecture and Engineering. CS152 Quiz #5. April 23rd, Professor Krste Asanovic. Name: Answer Key

CMPUT 101 with Solutions Quiz 2 (50 minutes) November 16, 2000

Final Exam. 11 May 2018, 120 minutes, 26 questions, 100 points

CSE 351 Midterm - Winter 2015

Register Files. Single Bus Architecture. Register Files. Single Bus Processor. Term Project: using VHDL. Accumulator based architecture

CS 4400 Fall 2018 Midterm Exam 2 Practice (Version 2)

LC-3 Instruction Set Architecture. Textbook Chapter 5

ISA Instruction Operation

CSE 131 Introduction to Computer Science Fall Exam II

Introduction to Algorithms October 12, 2005 Massachusetts Institute of Technology Professors Erik D. Demaine and Charles E. Leiserson Quiz 1.

CSE 473 Introduction to Computer Networks. Exam 1. Your name: 9/26/2013

Final Exam Solution Sunday, December 15, 10:05-12:05 PM

CS 111X - Fall Test 1

ECE264 Spring 2013 Final Exam, April 30, 2013

CSCI 2212: Intermediate Programming / C Chapter 15

Department of Electrical and Computer Engineering The University of Texas at Austin

LC-3 ISA - II. Lecture Topics. Lecture materials. Homework. Machine problem. Announcements. ECE 190 Lecture 10 February 17, 2011

Assignment 2: I2C Simulator - V1.02

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY

ECE 551 Digital System Design and Synthesis. Instructor: Kewal K. Saluja. Midterm Exam

Instruction Set Architecture

LC-3 Instruction Set Architecture

Department of Electrical and Computer Engineering The University of Texas at Austin

Midterm spring. CSC228H University of Toronto

Mid-term Examination

Computer System Architecture Midterm Examination Spring 2002

1CAPI INFORMATION VALUES. August Software Reference CAPI Information Values 1

Solutions - Homework 2 (Due date: October 4 5:30 pm) Presentation and clarity are very important! Show your procedure!

SLCD Technical Note TN-100. Programming the SLCD bitmap / macro flash memory in an embedded system

Computer Architecture I Midterm I

UNIVERSITY OF TORONTO Faculty of Arts and Science. Midterm Sample Solutions CSC324H1 Duration: 50 minutes Instructor(s): David Liu.

The instructions here- in outline the process(es) for grading group wikis.

LC-3 Assembly Language

Computer Organization & Systems Exam I Example Questions

The Ensoniq EPS/EPS16+/ASR-10 Bank Format

University of Florida EEL 4744 Spring 2011 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering 31 March Apr-11 1:29 PM

Prerequisite Quiz January 23, 2007 CS252 Computer Architecture and Engineering

Wawrzynek & Weaver CS 61C. Sp 2018 Great Ideas in Computer Architecture MT 1. Print your name:,

CSE332 Summer 2010: Final Exam

Transcription:

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Instructor: Rahul Nayar TAs: Annie Lin, Mohit Verma Examination 3 In Class (50 minutes) Wednesday, April 7, 2017 Weight: 17.5% NO: BOOK(S), NOTE(S), CALCULATORS OR ELECTRONIC DEVICES OF ANY SORT. The exam has ten pages. You must turn in the pages 1-9. Circle your final answers. Plan your time carefully since some problems are longer than others. Use the blank sides of the exam for scratch work. LAST NAME: FIRST NAME: ID#:

Problem Maximum Points Points Earned 1 3 2 3 3 4 4 5 4 5 6 3 7 3 Total 26

Problem 1 Write all the missing comments for the LC-3 binary code shown in the table below. (3 points) Address Instruction Comment 0x3000 0010 000 000101011 R0 <- M[0x302C] 0x3001 0010 001 000101011 0x3002 1001 011 001 111111 R3 <- NOT (R1) 0x3003 0001 011 011 1 00001 0x3004 0001 010 000 0 00 011 R2 <- R0 + R3 0x3005 0000 100 000000010 0x3006 0011 000 000100111 0x3007 0000 111 000000001 0x3008 0011 001 000100101 0x3009 1111 0000 0010 0101 HALT Problem 2 Given the initial values at the following registers and memory locations, fill in the values at the memory locations below after each instruction is executed. The instructions are executed in order. So, instruction at location x4000 has finished execution before instruction at x4001 begins, and so on. You may assume that all other registers and memory locations are set to 0. Address R0 R1 R2 x4020 x4021 x4022 Initial Memory Values x4021 x4022 x4023 x4021 x4022 xfffe Address LC-3 Binary Instruction Values at memory locations after execution

x4000 0110 010 000 000001 Value at x4020: Value at x4021: Value at x4022: x4001 0001 001 010 0 00 001 Value at x4020: Value at x4021: Value at x4022: x4002 0111 010 001 000000 Value at x4020: Value at x4021: Value at x4022: Problem 3 The following pseudo-code presents an algorithm to check if the data present in R1 is greater than 3. The table below shows an incomplete LC-3 binary program that implements this logic. Assume that R1 has been initialized to the data value being checked. R1 = R1-3 R2 = 0 If R1 > 0 then: R2 = 1 end if HALT Assume PC is x3000 when execution of the program starts. Address Instruction 0x3000 0101 010 010 1 00000 0x3001 0x3002 0x3003 0001 010 010 1 00001 0x3004 1111 0000 00100101 a) Complete the code to implement the algorithm in the above table by filling in the missing LC-3 binary instructions in memory locations 0x3001 and 0x3002. b) By looking at the algorithm logic above, a student incorrectly concludes that if R2 = 1 at the end of program execution, the value in R1 at program start must be greater than 3. Provide at least one example of a value in R1 for which the above conclusion is incorrect.

c) Which of the following programming construct does the above algorithm use? i) Iterative ii) Conditional Problem 4 a) Briefly explain what the following LC-3 instruction does: 0000 111 000 0 00000 b) Which of the following instructions does not change the condition code of LC-3 after execution? You must explain your answer for full credit. a) 0001 010 000 000 001 b) 0110 011 010 000011 c) 0111 011 010 000011 d) 1010 110 000000011 c) How many memory accesses does the STI instruction in LC-3 ISA make? You must explain your answer for full credit. d) Briefly explain the difference between syntax errors and logical errors. e) The following instruction is located in memory at 0x3000. 0000 111 00000111 What is the value of PC after the instruction finishes execution? Assume n = 1, z = 0, p = 0 before the instruction begins execution. Problem 5 The following table shows an incomplete program located in memory. Assume PC = x3000 before the program starts execution. Address Instruction Comments 0x3000 0x3001 0x3002 R1 <- NOT (R1) R2 <- NOT (R2) R3 <- R1 AND R2 0x3003 1001 011 011 1 11111 R3 <- NOT R3

0x3004 M[x4000] <- R3 0x3005 1111 0000 00100101 HALT 0x3006 0100 0000 0000 0000.FILL x4000 a) Fill in the missing LC-3 binary instructions from the comments provided. b) The following table shows the values in select registers and condition flags before the execution of the above program begins. Write the values in these locations just after the program finishes execution (i.e. after HALT has finished execution). Register/Condition flag R1 R2 R3 Value before execution starts 0x000A 0x000B 0x0000 Value after execution completes n 1 p 0 z 0 M[x4000] 0x0000 Problem 6 a) Write a single LC-3 instruction to load the number x2ff0 into R5. Your instruction will be located at x3000. b) Write a single LC-3 instruction to store the data from register R3 into memory address x4010. Your instruction will be located at x4000. c) Write up to two LC-3 instructions that will subtract the number 30 from R2 and place the result in R3.

Problem 7 The tables below show the contents of a few memory locations and registers before and after an LC-3 instruction at location x2000 is executed. Identify the instruction located at x2000 given the information below. Write its LC-3 16-bit binary form and comment what it does. Explain how you arrived at your answer for full credit. Before After R0 xff35 xff35 R1 xf911 xf911 R2 x67f9 x0146 R3 x0912 x0912 R4 x8231 x8231 R5 xe981 xe981 R6 x0901 x0901 R7 x3040 x3040 x304d x1091 x1091 x304e x7684 x7684 x304f x0146 x0146 x3050 xefff xefff x3051 x1021 x1021 x3052 x99df x99df x3053 x4782 x4782 Instruction: LC-3 Binary Form Comment Explanation: