SOLUTION. Homework 1. Part(a) Due: 15 Mar, 2018, 11:55pm

Similar documents
Homework 1. Part(a) Due: 15 Mar, 2018, 11:55pm

ENGG1015 Homework 1 Question 1. ENGG1015: Homework 1

ENGG1015: Homework 1

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

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

Combinational Logic. By : Ali Mustafa

CPE100: Digital Logic Design I

EE 209 Spiral 1 Exam Solutions Name:

Different encodings generate different circuits

University of Florida EEL 3701 Summer 2015 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Tuesday, 30 June 2015

ECE/CS 250 Computer Architecture

Please read carefully. Good luck & Go Gators!!!

Adders, subtractors comparators, multipliers and other ALU elements

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

EE 209 Logic Cumulative Exam Name:

14.1. Unit 14. State Machine Design

Foundations of Computation

CprE 281: Digital Logic

ENGG1015 Homework 3 Question 1. ENGG1015: Homework 3

University of Florida EEL 3701 Fall 2014 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Wednesday, 15 October 2014

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

Systems I: Computer Organization and Architecture

CE1911 LECTURE FSM DESIGN PRACTICE DAY 1

Table of Content. Chapter 11 Dedicated Microprocessors Page 1 of 25

UNIT 4 MINTERM AND MAXTERM EXPANSIONS

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

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

Department of Electrical Engineering and Computer Sciences University of California, Berkeley. Final Exam Solutions

Review Problem 1. should be on. door state, false if light should be on when a door is open. v Describe when the dome/interior light of the car

Written exam with solutions IE Digital Design Friday 21/

Adders, subtractors comparators, multipliers and other ALU elements

CPE100: Digital Logic Design I

CMSC 313 Lecture 17. Focus Groups. Announcement: in-class lab Thu 10/30 Homework 3 Questions Circuits for Addition Midterm Exam returned

ELCT201: DIGITAL LOGIC DESIGN

Building a Computer Adder

Why digital? Overview. Number Systems. Binary to Decimal conversion

Lecture 8: Sequential Networks and Finite State Machines

Department of Electrical Engineering and Computer Sciences University of California, Berkeley. Final Exam: Friday, August 10, 2012

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

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

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

Chapter 5 Arithmetic Circuits

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

Spiral 1 / Unit 5. Karnaugh Maps

EEE2135 Digital Logic Design

Digital Logic Design ABC. Representing Logic Operations. Dr. Kenneth Wong. Determining output level from a diagram. Laws of Boolean Algebra

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

ENEL Digital Circuits Final Examination

Read this before starting!

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

Preparation of Examination Questions and Exercises: Solutions

Binary addition example worked out

ECE 545 Digital System Design with VHDL Lecture 1A. Digital Logic Refresher Part A Combinational Logic Building Blocks

Read this before starting!

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

Introduction to Karnaugh Maps

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

CE Optimized State Machines

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/

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

Fundamentals of Digital Design

10/12/2016. An FSM with No Inputs Moves from State to State. ECE 120: Introduction to Computing. Eventually, the States Form a Loop

Digital Logic Design - Chapter 5

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

What s the Deal? MULTIPLICATION. Time to multiply

COMBINATIONAL LOGIC FUNCTIONS

UNIVERSITI TENAGA NASIONAL. College of Information Technology

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q

Finite State Machine (FSM)

Name: ID# a) Complete the state transition table for the aforementioned circuit

Combina-onal Logic Chapter 4. Topics. Combina-on Circuit 10/13/10. EECE 256 Dr. Sidney Fels Steven Oldridge

211: Computer Architecture Summer 2016

DIGITAL LOGIC CIRCUITS

Simulation of Logic Primitives and Dynamic D-latch with Verilog-XL

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

From Sequential Circuits to Real Computers

Overview. Arithmetic circuits. Binary half adder. Binary full adder. Last lecture PLDs ROMs Tristates Design examples

Review for Test 1 : Ch1 5

Looking at a two binary digit sum shows what we need to extend addition to multiple binary digits.

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

CSC9R6 Computer Design. Practical Digital Logic

1.10 (a) Function of AND, OR, NOT, NAND & NOR Logic gates and their input/output.

Digital Logic Appendix A

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

Digital Systems and Information Part II

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

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

Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1

Review for B33DV2-Digital Design. Digital Design

CSE 140 Spring 2017: Final Solutions (Total 50 Points)

State Graphs FSMs. Page 1

Digital Electronics Sequential Logic

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

7 Multipliers and their VHDL representation

Digital Systems Overview. Unit 1 Numbering Systems. Why Digital Systems? Levels of Design Abstraction. Dissecting Decimal Numbers

Philadelphia University Student Name: Student Number:

Digital Techniques. Figure 1: Block diagram of digital computer. Processor or Arithmetic logic unit ALU. Control Unit. Storage or memory unit

Design of Sequential Circuits

Transcription:

ENGG1203: Introduction to Electrical and Electronic Engineering Second Semester, 2017 18 Homework 1 Due: 15 Mar, 2018, 11:55pm Instruction: Submit your answers electronically through Moodle. In Moodle, you must submit under the Homework 1 link with the following files: 1. amon.circ for Question 3; 2. ONE (1) PDF file containing answers to all remaining questions Your homework will be graded electronically so you must submit your work as a PDF file. To generate PDF file from your computer, you may use one of the many free PDF creators available, e.g. PDFCreator (http://sourceforge.net/projects/pdfcreator), CutePDF Writer (http://www.cutepdf.com/products/ CutePDF/Writer.asp). You need to design your circuit in Logisim for Question 3. Logisim can be downloaded freely from http://www.cburch.com/logisim/. It runs on Linux, Mac, and Windows machines. Question 1 Part(a) Short Questions Simplify each of the following Boolean expressions by using K-map. Show the completed K-map and the way you looped the 1 s. Furthermore, based on your K-map, implement the expression using only 2-input AND gates, 2-input OR gates, or NOT gates. 1. Z + XY

2. P Q + (S Q + R S) (P + Q) 3. (A B + C) (A + C) r1.2 Page 2 of 21

r1.2 Page 3 of 21

Part(b) Any combinational circuit can be represented either with a circuit schematic, a Boolean expression, or a truth table. In the following, you are given one representation of a circuit. Your task is to also represent the same circuit with the other 2 representations. In all cases, inputs are A, B, C, and D, while output is always labeled as Y. Simplify your answer and write Boolean expressions in canonical SOP form. A B C D (i) (ii) Y = AB + B C D + AD + C D (iii) A B C D Y 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 (v) Y A B C (AC + B D) AD + BC + B C D D (iv) A B C D Y 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 (vi) Y r1.2 Page 4 of 21

(i) r1.2 Page 5 of 21

(ii) r1.2 Page 6 of 21

(iii) r1.2 Page 7 of 21

(iv) r1.2 Page 8 of 21

(v) (vi) r1.2 Page 9 of 21

Part(c) The following FSM implements a sequence detector that examines input X, which is a string of 0 s and 1 s, and generates an output Y, which gives a value of 1 when the pattern 010 is detected, and 0 otherwise. The position of Y = 1 coincides with the last 1 detected in the pattern. For example: X = 0 0 1 0 0 1 1 1 1 0 1 0 1 0 0... Y = 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0... Complete the following state machine such that it will correctly implement this sequence detector. The transitions are labeled with the notation input / [output]. Part(d) 1/[0] 0/[1] 0/[0] 1/[0] S0 S1 S2 1/[0] 0/[0] Draw the timing diagram of the following circuit: A clk B D C Y r1.2 Page 10 of 21

A B C D Y clk r1.2 Page 11 of 21

Question 2 Complex Number Arithmetic You would like to design a multiplier that multiplies two complex numbers. Let j = 1; engineers like to use j instead of i because the latter is traditionally reserved to denote electric current. Let the two inputs be a + jb and c + jd, then your multiplier produces a complex number e + jf such that e + jf = (a + jb) (c + jd) and e = ac bd (1a) { f = ad + bc (1b) To simplify the design, the complex numbers in your system have only limited range: For all complex numbers x + jy in the system, x, y { 1, 0, 1}. Therefore, for example, 1 + j and j are both valid numbers while 2 + j is not. In your hardware system, each complex number is represented by 4 bits, with 2 bits representing the real part (x of x + jy) in 2 s complement, and 2 bits representing the complex part (y of x + jy) in 2 s complement. Part(a) Real Number Multipliers The first step in your design is to implement a real number multiplier (rm) that you will use to implement equation 1a and 1b. rm takes two 2-bit inputs m (m1m0) and n (n1n0) and produces a 2-bit output p (p1p0). Some examples on how it should behave: m n = p 1 0 = 0 1 1 = 1 1 1 = 1 r1.2 Page 12 of 21

Complete the following truth tables for rm relating p1 p0 to the input m1 m0 n1 n0. Remember: the numbers m, n, p are all encoded as 2-bit 2 s-complement numbers. m1 m0 n1 n0 p1 p0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 1 r1.2 Page 13 of 21

Part(b) K-map and Minimization Based on your answer from the previous part, perform the following: 1. Draw the K-map for the signal p1; 2. Derive the minimized Boolean expression for p1 using the above K-map; 3. Express your answer in canonical SOP form. Part(c) Adder/Subtractor m1, m0 n1, n0 00 01 11 10 00 0 0 0 x 01 11 10 0 0 1 x 0 1 0 x x x x x m1 m0 n1 + m1 n1 n0 Another component needed to implement equation 1a and 1b is a real value adder/subtractor (ras). Recall that in your system real numbers only take the values of { 1, 0, 1}. If the result of an add or subtract is 2 or 2, then the result will wrap back to 0. For example: 1 + 1 = 0 1 + 1 = 0 1 0 = 1 1 + ( 1) = 0 The design of ras has 5 input signals and 2 output signals with the following meanings: Direction Name Description input 1 to perform subtraction, 0 to perform issub addition input s1 s0 2-bit input value in 2 s complement input t1 t0 2-bit input value in 2 s complement output r1 r0 2-bit output value in 2 s complement Complete the following truth table for ras: r1.2 Page 14 of 21

issub s1 s0 t1 t0 r1 r0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 0 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 1 1 0 0 Part(d) Putting it Together In the following space, draw the design of your complex number multiplier (cm) using the real number multiplier (rm) and the real number adder/subtractor (ras) you designed above as components. Write 1 or 0 if you need to pas a constant 1 or 0 to the circuit. r1.2 Page 15 of 21

d1d0 c1c0 b1b0 a1a0 n1n0 p1p0 m1m0 rm n1n0 p1p0 m1m0 rm n1n0 m1m0 n1n0 m1m0 rm rm p1p0 p1p0 0 issub t1t0 s1s0 t1t0 s1s0 issub ras 1 ras r1r0 r1r0 f1f0 e1e0 r1.2 Page 16 of 21

Question 3 Alfred the Smart Home Butler You are the chief architecture for Alfred, your company s next flagship product that acts as a voicecontrolled smart home speaker. Alfred is a smart speaker that can play music while controlling all parts of your smart home such lighting and air conditioning. It can process natural language and communicates with you with normal voice conversation. To initiate a voice command, you need to draw Alfred s attention by saying one of the following magic phrases: Hello Alfred With the above, you can then ask Alfred questions such as, Hello Alfred, what is the weather today? or Hello Alfred, turn off the light in kitchen please. In this question, you will design Alfred s monitoring logic that constantly listening to the environment for the magic phrases. As an elite ENGG1203 student, you have decided to implement this logic as a finite state machine. Your monitoring module is connected to the rest of the system as follow. microphone h a s timer amon t p f Query Process Figure 1: Overview of the Alfred system, showing the connection between the monitoring module and the rest of the system. As shown in the diagram your monitoring module has the following input and output signals: Dir Name Description input h 1: the word Hello is detected, 0 otherwise a 1: the word Alfred is detected, 0 otherwise t 1: if timer is expired, 0 otherwise f 1: finished processing voice query, 0 otherwise output s 1: start external timer countdown, 0 otherwise p 1: tell voice query module to process voice command, 0 otherwise A note about the operation of Alfred: amon constantly monitor for the phrase Hello Alfred from the environment. If the phrase is detected, it assert the signal p to start the subsequent query process (e.g. What is the time now?). It relies on the external timer to determine the time between whe the word Hello and Alfred are heard. If, for example, it hears Hello but never hear Alfred within certain time as determined by the timer then it should ignore the Hello and go back to sleep. For example, if someone say, amon should not regard it has a wakeup phrase. Hello Peter, are you going to meet Alfred today? To start the timer, amon should set the signal s to 1 for one cycle. After a specific time, the signal t will be set to 1 by the timer for one cycle. If you assert s before the timer expires, it will simply restart the timer from the begining. Once the Query processing module has completed its task, it assert the signal f for one cycle. r1.2 Page 17 of 21

Part(a) Your amon FSM, has the following states defined: State Sleep Hello Awake Description Alfred is sleeping, waiting for the command Hello Alfred Alfred is half awake after hearing Hello Alfred is awake after successfully detecting a magic phrase Part(b) h/[0, 0] Sleep f /[0, 0] h/[1, 0] t h a/[0, 0] Awake a /[0, 1] f/[0, f] (h + t) a/[h, 0] Hello You are implementing the above FSM in hardware. You are encoding the states with 2 bits (s2 s1 s0) using the following encoding: State s1 Encoding s0 Sleep 0 0 Hello 0 1 Awake 1 0 Complete the next state and output logic table for your FSM in the following page. situations, write down X in the corresponding space. For don t care r1.2 Page 18 of 21

s1 s0 h a t f ns1 ns0 s p 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 0 0 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 0 0 1 1 1 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 0 0 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 0 0 Part(c) Implement the above FSM in Logisim. Apart from the I/O described above, your machine should also include a clock input clk, and a reset input clr. The following table summarizes the input/output ports of your state machine. The column Order indicates the order of the pin in the circuit symbol. r1.2 Page 19 of 21

Direction Order Name Logisim Type input 1 h Pin 2 a Pin 3 t Pin 4 f Pin 5 clk Pin 6 clr Pin output 1 s Pin 2 p Pin Your circuit will be graded automatically, so it is very important for you to use the exact pin names in the above table in your circuit. Download the file http://www.eee.hku.hk/~engg1203/sp18/handouts/ hw1src.zip. You may use the included amon.circ as a template for your design. You may find the file amon-test.circ useful for testing your circuit. Put the two files (amon.circ and amon-test.circ) in the same directory for the file amon-test.circ to run. Save your answer in amon.circ and submit this file via Moodle. Part(d) Optional: Just for Fun Name the comic/movie that may have inspired the product name Alfred. Batman. In the comic/movie Batman, the main character Batman is called Bruce Wayne, who has a smart butler at home named Alfred Pennyworth. r1.2 Page 20 of 21

Question 4 Number Systems in Computers Part(a) Represent the numbers 12, -5, 332, -9, -1.25, π in the following formats. Write N/A if the number cannot be represented in that format: (i) 6-bit unsigned number (ii) 7-bit 2 s complement number (iii) 10-bit 1 s complement number (iv) 8-bit sign-magnitude number with 1 as the most significant bit representing a negative number. Number 6-bit unsigned 7-bit 2 s complement 10-bit 1 s complement 8-bit sign-magnitude 12 001100 0001100 0000001100 00001100 5 N/A 1111011 1111111010 10000101 332 N/A N/A 0101001100 N/A 9 N/A 1110111 1111110110 10001001 1.25 N/A N/A N/A N/A π N/A N/A N/A N/A Part(b) Perform the calculation if the 9-bit numbers are in the following formats: (i) 9-bit unsigned number; (ii) 9-bit 1 s complement; (iii) 9-bit 2 s complement; (iv) 9-bit sign-magnitude, with a 1 as the most significant bit representing a negative number. Write your answer in the following table. Indicate with N/A if the number cannot be using the specified format. Write your answers in decimal. number 9-bit unsigned 9-bit 1 s complement sign- 9-bit magnitude 111111100 508 7 = 501 3 7 = 10 4 7 = 11 252 7 = 259 000000111 Part(c) Convert the following numbers into binary: 12.5625, 0.140625, 46.375 9-bit 2 s complement Assuming you are using a computer with 8-bit words, and you decide to use 4 bits to store the values on the LEFT of the binary point, and use the remaining 4 bits to store the values on the RIGHT of the binary point, which of the above numbers can be represented in this new format? 12.5625 1100.1001 0.140625 Cannot be represented because 0.140625 0.001001 46.375 Cannot be represented because 46.375 10110.011 HINT: One easy way to convert these decimal fractional numbers is to multiply the number by 2 4 = 16. In binary number system, multiplying a number by 2 s is equivalent to shifting the number to LEFT by s bit. Therefore, the number representation of a number n in the above case is simply the same as the binary reprentation of the number n 2 4 in binary. Try it on the number 12.5625. r1.2 Page 21 of 21