EE 110 Practice Problems for Exam 2: Solutions, Fall 2007

Similar documents
Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Lecture 8: Synchronous Digital Systems

Counters and Decoders

Binary Adders: Half Adders and Full Adders

Lesson 12 Sequential Circuits: Flip-Flops

BINARY CODED DECIMAL: B.C.D.

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Module 3: Floyd, Digital Fundamental

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

United States Naval Academy Electrical and Computer Engineering Department. EC262 Exam 1

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

Simplifying Logic Circuits with Karnaugh Maps

Memory Elements. Combinational logic cannot remember

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

DEPARTMENT OF INFORMATION TECHNLOGY

Combinational Logic Design Process

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

EE360: Digital Design I Course Syllabus

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

CHAPTER 3 Boolean Algebra and Digital Logic

ASYNCHRONOUS COUNTERS

Chapter 8. Sequential Circuits for Registers and Counters

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

(Refer Slide Time: 00:01:16 min)

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

Contents COUNTER. Unit III- Counters

Digital Logic Design Sequential circuits

Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell

SEQUENTIAL CIRCUITS. Block diagram. Flip Flop. S-R Flip Flop. Block Diagram. Circuit Diagram

Chapter 9 Latches, Flip-Flops, and Timers

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

CS311 Lecture: Sequential Circuits

Counters & Shift Registers Chapter 8 of R.P Jain

COMBINATIONAL CIRCUITS

Lab 1: Study of Gates & Flip-flops

3.Basic Gate Combinations

CHAPTER 11: Flip Flops

Flip-Flops, Registers, Counters, and a Simple Processor

Asynchronous Counters. Asynchronous Counters

CHAPTER 11 LATCHES AND FLIP-FLOPS

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

Lecture-3 MEMORY: Development of Memory:

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Let s put together a Manual Processor

Understanding Logic Design

Operating Manual Ver.1.1

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

Karnaugh Maps & Combinational Logic Design. ECE 152A Winter 2012

2.0 Chapter Overview. 2.1 Boolean Algebra

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

List of Experiment. 8. To study and verify the BCD to Seven Segments DECODER.(IC-7447).

Asynchronous counters, except for the first block, work independently from a system clock.

Counters are sequential circuits which "count" through a specific state sequence.

CSE140: Components and Design Techniques for Digital Systems

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

7. Latches and Flip-Flops

Lecture 12: More on Registers, Multiplexers, Decoders, Comparators and Wot- Nots

Decimal Number (base 10) Binary Number (base 2)

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

The components. E3: Digital electronics. Goals:

Engr354: Digital Logic Circuits

Master/Slave Flip Flops

exclusive-or and Binary Adder R eouven Elbaz reouven@uwaterloo.ca Office room: DC3576

Digital Controller for Pedestrian Crossing and Traffic Lights

Gates, Circuits, and Boolean Algebra

(1) /30 (2) /30 (3) /40 TOTAL /100

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Sequential Logic Design Principles.Latches and Flip-Flops

University of St. Thomas ENGR Digital Design 4 Credit Course Monday, Wednesday, Friday from 1:35 p.m. to 2:40 p.m. Lecture: Room OWS LL54

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute. 2nd (Spring) term 2012/2013

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute 5. LECTURE: REGISTERS AND RELATED

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

Modeling Latches and Flip-flops

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

ENEE 244 (01**). Spring Homework 5. Due back in class on Friday, April 28.

Systems I: Computer Organization and Architecture

So far we have investigated combinational logic for which the output of the logic devices/circuits depends only on the present state of the inputs.

Theory of Logic Circuits. Laboratory manual. Exercise 3

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

Digital Electronics Detailed Outline

Chapter 5. Sequential Logic

Two's Complement Adder/Subtractor Lab L03

Layout of Multiple Cells

Basic Logic Gates Richard E. Haskell

Lecture 10 Sequential Circuit Design Zhuo Feng. Z. Feng MTU EE4800 CMOS Digital IC Design & Analysis 2010

Logic Reference Guide

2011, The McGraw-Hill Companies, Inc. Chapter 3

Gates, Plexers, Decoders, Registers, Addition and Comparison

Transcription:

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 1. Circle T (true) or F (false) for each of these Boolean equations. (a). T FO An 8-to-1 multiplexer requires 2 select lines. (An 8-to-1 multiplexer requires 3 select lines). (b). T FO A half adder has a carry input. (A half adder has no carry input). (c). TO F Even parity means the data has an even number of bits that are 1. (d). T FO If a decoder has 16 outputs, it requires 3 inputs to choose all possible outputs. (A 16-output decoder requires 4 inputs to choose all outputs). (e). T FO Latches are edge-triggered memory devices. (Latches are level-triggered memory devices). 2. Signed Arithmetic: 2(a). Find 35 10 72 10 using two s complement format with 8-bit numbers. Then convert your result back to decimal. 35 10 is positive. In 8-bit two s complement format, 35 10 = 00100011 2. 72 10 is negative. In 8-bit two s complement format, +72 10 = 01001000 2 ; flip the bits and add 1 to get two s complement of a negative number. 72 10 = 10110111 2 + 00000001 2 = 10111000 2. Add 35 10 and 72 10 together in two s complement format: 00100011 2 + 10111000 2 = 11011011 2. Convert to decimal: 11011011 2 in two s complement is a negative number, so flip the bits and add 1 to find its magnitude. 00100100 2 + 00000001 2 = 00100101 2 = 32 10 + 4 10 + 1 10 = 37 10 The solution is 37 10. 35 10 72 10 = 11011011 2 = 37 10 2(b). Find 65 10 25 10 using one s complement format with 8-bit numbers. Then convert your result back to decimal. 65 10 is positive, so in one s complement, 65 10 = 01000001 2. 25 10 is negative; +25 10 = 00011001 2, so 25 10 in one s complement format flips the bits of +25 10. 1

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 2 25 10 = 11100110 2. 65 10 25 10 = 01000001 2 + 11100110 2 = 00100111 2 + 1 carry bit. One s complement uses an end-around carry if the carry bit is 1, which means add 1 to the sum: 65 10 25 10 = 00100111 2 + 00000001 2 = 00101000 2 Convert to decimal to check your answer: 65 10 25 10 = 00101000 2 = 32 10 + 8 10 = 40 10 65 10 25 10 = 00101000 2 = 40 10 2(c). Add 5F 16 + C2 16, assuming you are limited to 8-bit signed numbers, and that these hex numbers are a compact representation of two s complement binary numbers. Convert your answer to decimal. Is your answer correct? Why or why not? Convert the hex numbers to binary and add the two s complement binary numbers together. It is possible to directly add the numbers in hex, but we will perform the addition in binary. Convert 5F 16 to binary: 5F 16 = 0101 1111 2. Convert C2 16 to binary: C2 16 = 1100 0010 2. Add together: 0101 1111 2 + 1100 0010 2 = 0010 0001 2, drop the carry bit. The answer is positive, as the MSB=0, so we can convert directly to decimal. 0010 0001 2 = 32 10 + 1 10 = 33 10. Is this answer correct? Let s convert the binary equivalents of the hex numbers to decimal: 5F 16 = 0101 1111 2 = 64 + 16 + 15 = 95 10 ; C2 16 has MSB=1, so it is a negative two s complement number. Therefore, we must find its magnitude by taking the two s complement again. C2 16 = 1100 0010 2. Flipping all bits, we obtain 0011 1101 2, and adding 1, we get 0011 1110 2. Converting to decimal, we find that the magnitude of C2 16 = 32 + 16 + 8 + 4 + 2 = 62 10, and thus C2 16 = 62 10. Our answer is 33 10, and 95 + 62 10 = 33 10. So our answer is correct. The answer is correct because it falls within the range of 8-bit two s complement representation; 8-bit two s complement numbers can accurately represent any number from +127 to -128. Since we are adding a positive number which must be between 0 and 127 to a negative number that must be between -1 and -128, our answer must fall in the range from +126 to -128. This is within the range of 8-bit two s complement accuracy. Note that if we add two negative numbers, or add two positive numbers, the answer could be outside the range of accurate representation; whether it is or not depends on the magnitude of the numbers being added.

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 3 3. Combinational Logic: Design a circuit that counts the number of 1 s present in 3 inputs A, B and C. Its output is a two-bit number X 1 X 0, representing that count in binary. Assume active-high logic. 3(a). Write the truth table for this circuit. A B C X 1 X 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 3(b). Find the minimized logic equations for outputs X 1 and X 0 ; use a K-map if needed. A K-map for X 0 is not very helpful, as it results in 4 isolated minterms, A B C + A B C + A B C + ABC. However, we may recall from the binary adder lab that this equation can be factored further using the XOR operator. Factor out A and A from their respective terms to obtain: X 0 = A(BC + BC) + A(B C + BC) = A(B C) + A(B C) = A (B C). X0 = A B C K-Map for X 1 : BC A 00 01 11 10 0 0 0 1 0 1 0 1 1 1 SOP expression for X1: blue vertical pair=bc green horizontal pair=ac, red horizontal pair=ab X1 = AB + AC + BC

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 4 3(c). Draw the corresponding logic diagram for this circuit. Label all inputs and outputs. A B C AND OR OR X 1 AND AND XOR XOR X 0 4. Combinational Logic: Multiplexers and Encoders 4(a). Draw a block diagram of a 4-to-1 multiplexer. Do not use a gate-level diagram. Label all inputs and outputs. A 0 A 1 A 2 A 3 Y S 1 S 0 4(b). Draw a block diagram of a 4-to-2 encoder. Label all inputs and outputs. How is the 4-to-2 encoder different from a 4-to-1 multiplexer? A 0 A 1 A 2 A 3 Y 1 Y 0

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 5 The 4-to-2 encoder has 4 input lines and 2 output lines. Only one input line should be active at a time. The 2 output lines send the 2-bit binary number corresponding to which input line is active. So if line A 1 is active, the output Y 1 Y 0 will be 01. The 4-to-1 multiplexer has 4 input lines, and 2 select lines. The 2 bits from the select lines choose the input line which will be used as output, so the data sent on that input line will be output. So if the select lines S 1 S 0 = 01, whatever data is on input line A 1 will be output on Y. 4(c). Write the truth table for a 4-to-2 priority encoder. Write a simplified truth table for a 4-to-1 multiplexer (hint: your multiplexer truth table should have 2 inputs). Truth Table for 4-to-2 priority encoder: A 3 A 2 A 1 A 0 Y 1 Y 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 Truth Table for 4-to-1 multiplexer: S 1 S 0 Y 0 0 A 0 0 1 A 1 1 0 A 2 1 1 A 3

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 6 5. Combinational Logic: Binary Adders You wish to add two 4-bit numbers. You have half adders and full adders available to use as components. 5(a). Draw a block diagram of your 4-bit adder, using half and full adders. Do not draw a gate-level diagram. Show and label all inputs and outputs. X 3 Y 3 C 2 X 2 Y 2 C 1 X 1 Y 1 C 0 X 0 Y 0 Full Adder Full Adder Full Adder Half Adder C 3 C 2 Z 3 C 0 Z 2 C 1 Z 1 Z 0 5(b). Assume that a half adder has a maximum propagation delay of, and a full adder has a maximum propagation delay of 2. What is the maximum propagation delay for your 4-bit adder, from LSB input to MSB output? You have 3 full adders and 1 half adders in your 4-bit adder design, so the maximum propagation delay from the LSB input at the half adder to the MSB output at the last full adder must go through all adder components. The maximum propagation delay is 3 2 + = 7.

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 7 6. Sequential Logic: Latches and Flip-flops 6(a). Draw a block diagram (not a gate-level diagram) of a D latch and a D flip-flop. Show and label all inputs and outputs. Block Diagram of a D Latch: D Q EN or C Q Block Diagram of a D Flip-Flop: D Q CLK Q 6(b). Write the truth tables for both a D latch and a D flip-flop. Truth Table for a D Latch: (note: Q is the next state of Q) C D Q 0 0 Q (Hold) 0 1 Q (Hold) 1 0 0 (Reset) 1 1 1 (Set) Truth Table for a D Flip-Flop: CLK D Q 0 0 (Reset) 1 1 (Set) 0 X Q (Hold) 1 X Q (Hold) X Q (Hold)

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 8 6(c). On the following graph, inputs CLK and D are shown. They are inputs to both a D latch and a D flip-flop. CLK goes into the EN or C input of the D latch. Write the output of the D latch as Q DL on the graph. Then write the output of the D flip-flop as Q DFF on the graph. Ignore setup and hold time requirements (assume T SU = T H = 0). Both outputs are initially 0 at the start of the graph, as shown. Do the two outputs differ, and if so, why? CLK D Q DL Q DFF The output of the D latch, Q DL, and the output of the D flip-flop, Q DFF, do differ. They are different because the D latch is level-triggered, acting when the clock is high, while the D flip-flop is edge-triggered, and only acts on a rising edge of the clock. Thus the D latch output can change value at any time when CLK = H if the input D changes value. The D flip-flop can only change value on the rising edge of CLK. 7. Sequential Logic: Counters 7(a). Design a 3-bit binary synchronous counter using J-K flip-flops. First, draw the state bubble diagram, showing the 3-bit outputs as the state. 000 111 001 110 010 101 100 011

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 9 7(b). Draw the circuit diagram, using flip-flops as blocks (don t draw the individual gates in each flip-flop). Show and label all inputs and outputs. A 3-bit binary counter requires 3 flip-flops, as each flip-flop provides one bit with its output Q. The counter is synchronous, which means all flip-flops are connected to the same clock. However, before we can draw the counter, we need to determine how to connect the J-K inputs to produce the state bubble diagram of 7.a. Remember that the truth table for a J-K flip-flop is: J K Q 0 0 Q (Hold) 0 1 0 (Reset) 1 0 1 (Set) 1 1 Q (Toggle) Write a truth table showing the present state Q, next state Q and all required J-K input values to achieve the required transition from present to next state. Present State Next State Inputs Q 2 Q 1 Q 0 Q 2 Q 1 Q 0 J 2 K 2 J 1 K 1 J 0 K 0 0 0 0 0 0 1 0 0 0 0 1 X 0 0 1 0 1 0 0 0 1 X X 1 0 1 0 0 1 1 0 0 0 0 1 X 0 1 1 1 0 0 1 X X 1 X 1 1 0 0 1 0 1 0 0 0 0 1 X 1 0 1 1 1 0 0 0 1 X X 1 1 1 0 1 1 1 0 0 0 0 1 X 1 1 1 0 0 0 X 1 X 1 X 1 Note that J 0 and K 0 are either 1 or X (don t care), so they may be set high; J 0 = K 0 = 1. Also note that J 1 and K 1 are 1 or X whenever Q 0 = 1. Thus J 1 = K 1 = Q 0. This could also be determined from a 3-variable K-map of J 1, with variables Q 2, Q 1 and Q 0. Similarly, note that J 2 and K 2 are 1 or X whenever both Q 1 and Q 0 are 1. Their equation is found as J 2 = K 2 = Q 1 Q 0. Again, this could also be found from a 3-variable K-map of J 2, with variables Q 2, Q 1 and Q 0. Now that we have equations for all the J-K inputs, we can draw the circuit diagram for the 3-bit synchronous counter.

EE 110 Practice Problems for Exam 2: Solutions, Fall 2007 10 +5V AND CLK PRE J 2 Q 2 K 2 CLR PRE J 1 Q 1 K 1 CLR PRE J 0 Q 0 K 0 CLR Q 2 Q 1 Q 0 7(c). For an output cycle of 10 clock pulses, draw the 3 outputs X 0, X 1 and X 2 of the synchronous counter on the grid below. State which output is the MSB and which is the LSB. Assume that you start in the all-zeros state (000) as shown below. CLK MSB=X 2 X 1 LSB=X 0 Note that the counter is counting from X 2 X 1 X 0 = 000 to 001... up to 111 and then starts over again at 000, exactly as the state bubble diagram of 7.a. describes.