CMPT-150-e1: Introduction to Computer Design Final Exam

Similar documents
Computer Science Final Examination Friday December 14 th 2001

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

EE 209 Spiral 1 Exam Solutions Name:

Fundamentals of Digital Design

Outcomes. Spiral 1 / Unit 5. Logic Function Synthesis KARNAUGH MAPS. Karnaugh Maps

Spiral 1 / Unit 5. Karnaugh Maps

Outcomes. Spiral 1 / Unit 5. Logic Function Synthesis KARNAUGH MAPS. Karnaugh Maps

UNIVERSITY OF WISCONSIN MADISON

CPE100: Digital Logic Design I

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Philadelphia University Student Name: Student Number:

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

CPE100: Digital Logic Design I

Computer Science. Questions for discussion Part II. Computer Science COMPUTER SCIENCE. Section 4.2.

UNIVERSITI TENAGA NASIONAL. College of Information Technology

COMPUTER SCIENCE TRIPOS

University of Minnesota Department of Electrical and Computer Engineering

Lecture 8: Sequential Networks and Finite State Machines

ENEL Digital Circuit Design. Final Examination

Memory Elements I. CS31 Pascal Van Hentenryck. CS031 Lecture 6 Page 1

University of Guelph School of Engineering ENG 2410 Digital Design Fall There are 7 questions, answer all questions.

Faculty of Engineering. FINAL EXAMINATION FALL 2008 (December2008) ANSWER KEY

CSE140: Components and Design Techniques for Digital Systems. Midterm Information. Instructor: Mohsen Imani. Sources: TSR, Katz, Boriello & Vahid

MC9211 Computer Organization

9.1. Unit 9. Implementing Combinational Functions with Karnaugh Maps or Memories

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Name. ECE-200 Intelligent Systems

Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps

Number Systems 1(Solutions for Vol 1_Classroom Practice Questions)

Lecture 10: Synchronous Sequential Circuits Design

COE 328 Final Exam 2008

BER KELEY D AV IS IR VINE LOS AN GELES RIVERS IDE SAN D IEGO S AN FRANCISCO

INF2270 Spring Philipp Häfliger. Lecture 8: Superscalar CPUs, Course Summary/Repetition (1/2)

Design at the Register Transfer Level

CHAPTER1: Digital Logic Circuits Combination Circuits

Total Time = 90 Minutes, Total Marks = 50. Total /50 /10 /18

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

Total Time = 90 Minutes, Total Marks = 100. Total /10 /25 /20 /10 /15 /20

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

CPE/EE 422/522. Chapter 1 - Review of Logic Design Fundamentals. Dr. Rhonda Kay Gaede UAH. 1.1 Combinational Logic

Midterm Examination # 1 Wednesday, February 25, Duration of examination: 75 minutes

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control

Final Exam. ECE 25, Spring 2008 Thursday, June 12, Problem Points Score Total 90

Written exam with solutions IE Digital Design Friday 21/

Sequential Circuit Analysis


We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr.

Written exam for IE1204/5 Digital Design with solutions Thursday 29/

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

Sequential Synchronous Circuit Analysis

SAU1A FUNDAMENTALS OF DIGITAL COMPUTERS

CMP 338: Third Class

Practice Final Exam Solutions

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan

(Boolean Algebra, combinational circuits) (Binary Codes and -arithmetics)

Digital Logic Design. Midterm #2

Chapter 2 : Boolean Algebra and Logic Gates

EECS 270 Midterm 2 Exam Answer Key Winter 2017

ELCT201: DIGITAL LOGIC DESIGN

CSE 140 Midterm 3 version A Tajana Simunic Rosing Spring 2015

FSM model for sequential circuits

Simplifying Logic Circuits with Karnaugh Maps

( c) Give logic symbol, Truth table and circuit diagram for a clocked SR flip-flop. A combinational circuit is defined by the function


21 Yes, in LFP between ldd y and stx y. A) accuracy. J) desk check. D) bandwidth. E (partial credit B) D. P) latency. U) polled interrupt W) private

PAST EXAM PAPER & MEMO N3 ABOUT THE QUESTION PAPERS:

Fundamentals of Computer Systems

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

COVER SHEET: Problem#: Points

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

Review for Final Exam

Principles of Computer Architecture. Appendix B: Reduction of Digital Logic. Chapter Contents

Sequential Circuit Design

Schedule. ECEN 301 Discussion #25 Final Review 1. Date Day Class No. 1 Dec Mon 25 Final Review. Title Chapters HW Due date. Lab Due date.

Chapter 2 (Lect 2) Canonical and Standard Forms. Standard Form. Other Logic Operators Logic Gates. Sum of Minterms Product of Maxterms

DEPARTMENT OF ELECTRICAL & COMPUTER ENGINEERING OLD DOMINION UNIVERSITY Ph.D. DIAGNOSTIC EXAMINATION Spring 2013 ODU HONOR PLEDGE

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

Fundamentals of Computer Systems

ENGG 1203 Tutorial_9 - Review. Boolean Algebra. Simplifying Logic Circuits. Combinational Logic. 1. Combinational & Sequential Logic

Unit 2 Session - 6 Combinational Logic Circuits

Counters. We ll look at different kinds of counters and discuss how to build them

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Finite State Machine (FSM)

ECE20B Final Exam, 200 Point Exam Closed Book, Closed Notes, Calculators Not Allowed June 12th, Name

Combinational Logic Fundamentals

Philadelphia University Student Name: Student Number:

Logical Design of Digital Systems

Contents. Chapter 3 Combinational Circuits Page 1 of 36

DIGITAL LOGIC DESIGN

Spiral 1 / Unit 3

CMPE12 - Notes chapter 1. Digital Logic. (Textbook Chapter 3)

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

COMPUTER SCIENCE TRIPOS

Chapter 2. Boolean Algebra and Logic Gates

Lecture 2 Review on Digital Logic (Part 1)

Functions. Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways:

Transcription:

CMPT-150-e1: Introduction to Computer Design Final Exam April 13, 2007 First name(s): Surname: Student ID: Instructions: No aids are allowed in this exam. Make sure to fill in your details. Write your answers neatly on these sheets. Use the exam booklet provided to you for your drafts. There are 10 questions in 14 pages in this exam, please attempt all. The last 4 pages contain relevant assembler directives and instructions. Next to every question appears a suggested time to spend on the question. Total marks: 110. Time: 3 hours. Question 1 [5 minutes, 5 marks] A state diagram for a sequential circuit has M states. We wish to assign each of the states a unique name which is an n-bit binary word. What is the smallest value of n that we can use? Explain. n bits can represent 2 n different binary words. Therefore, n is an integer such that 2 n-1 < M 2 n, thus, n = log 2 M. Question 2 What is register PC used for in the CPU12? [2 minutes, 5 marks] Register PC contains the address of the next instruction to be executed.

Question 3 [3 minutes, 5 marks] Describe the difference between the Mealy model and the Moore model for sequential circuits. In the Mealy model the output signals are Boolean functions of the input signals and the current state, while in the Moore model the output signals depends only on the current state. Question 4 Describe the steps of the fetch-execute cycle of a CPU. [5 minutes, 5 marks] 1. Fetch the next instruction to be executed from memory. 2. Decode the instruction. 3. Execute the instruction and (possibly) store the result. 4. Go back to step 1. Question 5 [25 minutes, 15 marks] Design a combinatorial circuit that converts a 3-bit signed number from sign-magnitude representation to 2 s complement representation. Denote the input by XYZ (X is the most significant bit) and the output by ABC (A is the most significant bit). a. Complete the truth table for the circuit. X Y Z A B C 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1

b. Write A and B as sum of minterms, and C as a product of maxterms. Use both short and explicit representations. A = ( 5,6,7) = m XYZ + XYZ + XYZ B = ( 2,3,5,6) = XYZ + XYZ + XYZ + XYZ m C = M ( 0,2,4,6) = ( X + Y + Z)( X + Y + Z)( X + Y + Z)( X + Y + Z) c. Obtain a minimized SOP representation for each output signal using K-Maps. Specify the essential and prime implicants in each K-Map. A B C YZ X 0 00 01 11 10 X YZ 00 01 11 10 0 1 1 YZ 00 01 11 10 X 0 1 1 1 1 1 1 1 1 1 1 1 1 Prime Implicants: Prime Implicants: Prime Implicants: XZ, XY X YZ, YZ, XY Z Essential Implicants: Essential Implicants: Essential Implicants: XZ, XY X YZ, YZ, XY Z A = XZ + XY B = XYZ + YZ + XY C = Z Question 6 [10 minutes, 10 marks] Instead of using CPU12 s stack and stack pointer, it is possible to use a user-defined stack, which is pointed by register IX or IY. In the following code such a stack is defined using IX as a pointer for the stack. Complete the missing instructions for pushing the content of Accumulator A into the stack and then pulling the value at the top of the stack into Accumulator B.

MY_STACK EQU $2000 ORG $0800 ENTRY: LDX #MY_STACK ; IX <-- $2000 LDAA #$90 ; A <-- $90 STAA $1,-X ; IX <-- IX-1, Mem[IX] <-- A LDAB $1,X+ ; B <-- Mem[IX], IX <-- IX+1 Question 7 [15 minutes, 10 marks] The 8 outputs of a 3-to-8 decoder are connected to the information inputs of an 8-to-1 MUX as shown. a b c D 0 I 0 S 2 S 1 S 0 D 1 I 1 z y x A 0 A 1 A 2 3-to-8 Decoder D 2 I 2 D 3 I 3 D 4 I 4 D 5 I 5 8-to-1 MUX f D 6 I 6 D 7 I 7 Denote the inputs to the decoder by x,y,z and the select inputs of the MUX by a,b,c. Express the single output f of the MUX in terms of x,y,z,a,b,c in a SOP representation. Solution: f = xyzab c + xyzab c + xyzabc + xyzab c + xyzabc + xyzab c + xyzabc + xyzabc Question 8 [40 minutes, 20 marks] You are to design a controller (sequential circuit) for an elevator in a four-floor building with no basement (that is, the floors are numbered 0,1,2, and 3). To simplify things, assume the elevator can only be summoned to one floor. The desired floor is indicated by a 2-bit unsigned binary number A 1 A 0 (for example, A 1=1 and A0=0 means the elevator is summoned to floor 2). The controller has two outputs: M a move signal which is 1 if the elevator is moving and 0 otherwise. For example, if the elevator is currently at floor 2 and A 1 A 0 =10, then M=0. D a direction signal which is 1 if the elevator is moving up and 0 if the elevator is moving down. If the elevator is not moving this signal is ignored.

Assume that the elevator is initially at floor 0 and that it takes the elevator one clock cycle to move one floor. a. Write the state diagram of the controller. Use the Mealy model. What represents each state? The states represent the current location (floor) of the elevator. 01,10,11/1,1 10,11/1,1 11/1,1 00/1,0 00,01/1,0 0 1 2 00,01,10/1,0 3 00/0,X 01/0,X 10/0,X 11/0,X b. Assign names to the states and complete the state table of the controller. F 1 and F 0 represent the current state. (The last two columns are there to help you answer the next section. You may leave them empty.) We assign names according to the floor number. A 1 0 F 1 + + F 1 F 0 T1 T0 A M D 0 0 0 0 0 X 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 X 0 1 0 0 0 1 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 1 0 1 0 0 X 1 0 0 0 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 X 1 1 0 0

c. Assuming the controller is to be implemented using T flip-flops and basic gates (NOT and multiple inputs AND and OR gates), obtain minimized equations for each output signal and each T signal of a T flip-flop. Justify the equations you obtained. Recall the characteristic table of a T flip-flop: T Q + 0 Q 1 Q 00 01 11 10 F 1 F1F 0 A 1 A 0 A 1 A 0 00 1 1 1 00 X 00 01 11 10 01 1 1 1 01 1 X 11 1 1 1 11 1 1 X 1 10 1 1 1 10 1 1 X T + 0 = M = A1 F1 + A1 F1 + A0 A0 D = A1 F1 + A1 A0 + F1 - A 0F1 can replace F 0F1 - A 1 can replace A 1 A0 F 1 F 0 A 1 A 0 00 01 11 10 00 1 01 1 11 1 10 1 T + 1 = A1 F1 A1 F1

Question 9 Consider the following assembler code. [40 minutes, 20 marks] Address Machine Addressing Effective Code (Hex) Mode Address(es) 1 ORG $0000 2 0000 04 02 00 01 FF VALUES: FCB $4,$2,$0,$1,$FF 3 ORG $0800 4 0800 CF 80 00 ENTRY: LDS #ENTRY Immediate 0801 5 0803 96 00 LDAA VALUES Direct 0000 6 0805 CE 00 00 LDX #VALUES Immediate 0806 7 0808 E6 E4 LDAB A,X Register 0004 Offset Indexed 8 080A 18 06 LOOP: ABA Implied 9 080C 2C FC BGE LOOP Relative 10 080E A6 20 LDAA $1,+X Pre-auto 0001 Increment 0002 Indexed 11 0810 26 F8 BNE LOOP Relative 12 0812 C7 CLRB Implied 13 0813 E6 E7 LDAB [D,X] Indirect Register Indexed 14 0815 3F SWI 15 0816 A6 NOP 0001 a. Determine the addressing mode of every assembly instruction (do not fill shaded cells). b. Fill in the address in memory and machine code for the constants in line 2 and for every assembly instruction (do not fill shaded cells). c. Determine the effective address of every assembly instruction (do not fill shaded cells). If the instruction is executed more than once, and different effective addresses are used, write them all. d. How many times is line 8 executed? 8 e. What is the content (in binary) of register D when the program terminates? 0000 0000 0000 0010

Question 10 Consider the following partial assembler code: ORG $0000 VAL1: FCB $10 VAL2: FCB $20 [20 minutes, 15 marks] ORG $0800 ENTRY: LDS #ENTRY LDAA #$15 LDX #VAL1 PSHX PSHA JSR MY_MAX ; now VAL1 contains $15 LEAS $3,SP ; SP <-- SP+3 LDX #VAL2 PSHX PSHA JSR MY_MAX ; now VAL2 contains $20 LEAS $3,SP ; SP <-- SP+3 ; halt instructions SWI NOP ORG $8000 MY_MAX: PSHA LDAA [$4,SP] SUBA $3,SP BGE MY_MAX_END LDAA $3,SP STAA [$4,SP] MY_MAX_END: PULA RTS a. Complete the missing instructions in the code. b. How many parameters are passed to subroutine MY_MAX? What parameter-passing technique is used for each parameter? MY_MAX receives two parameters. The first parameter is passed by reference (its address is stored on the stack), while the second parameter (appears higher on the stack) is passed by value. c. Describe the functionality of subroutine MY_MAX. The first value (the one passed by address) is replaced by the second value, if the second value is greater than the first value.