CSE370 HW3 Solutions (Winter 2010)

Similar documents
Slides for Lecture 19

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

EECS 270 Midterm 2 Exam Answer Key Winter 2017

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

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

CSE370 HW6 Solutions (Winter 2010)

Floating Point Representation and Digital Logic. Lecture 11 CS301

WEEK 3.1 MORE ON KARNAUGH MAPS

ELCT201: DIGITAL LOGIC DESIGN

Section 3: Combinational Logic Design. Department of Electrical Engineering, University of Waterloo. Combinational Logic

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

Slide Set 6. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

CS/COE0447: Computer Organization and Assembly Language

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

ECE/CS 250 Computer Architecture

Digital Circuit And Logic Design I. Lecture 4

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

Arithmetic Circuits Didn t I learn how to do addition in the second grade? UNC courses aren t what they used to be...

CprE 281: Digital Logic

Contents. Chapter 3 Combinational Circuits Page 1 of 36

Basic Gate Repertoire

Design of Sequential Circuits

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

Arithmetic Circuits How to add and subtract using combinational logic Setting flags Adding faster

Lecture 8: Combinational Circuit Design

Overview. Multiplexor. cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder

Prove that if not fat and not triangle necessarily means not green then green must be fat or triangle (or both).

Latches. October 13, 2003 Latches 1

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

Logic Gate Level. Part 2

CSE140: Components and Design Techniques for Digital Systems. Logic minimization algorithm summary. Instructor: Mohsen Imani UC San Diego

Karnaugh Maps (K-Maps)

MODULAR CIRCUITS CHAPTER 7

9/29/2016. Task: Checking for a Lower-Case Letter. ECE 120: Introduction to Computing. Change C 5 to C 5 to Obtain L(C) from U(C)

UNIT 8A Computer Circuitry: Layers of Abstraction. Boolean Logic & Truth Tables

COSC3330 Computer Architecture Lecture 2. Combinational Logic

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C.

Possible logic functions of two variables

Digital System Design Combinational Logic. Assoc. Prof. Pradondet Nilagupta

ECE 2300 Digital Logic & Computer Organization

211: Computer Architecture Summer 2016

Logic Design. Chapter 2: Introduction to Logic Circuits

Working with combinational logic

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

CHAPTER1: Digital Logic Circuits Combination Circuits

ENGIN 112 Intro to Electrical and Computer Engineering

mith College Computer Science CSC270 Spring 16 Circuits and Systems Lecture Notes Week 2 Dominique Thiébaut

Combinational Logic. Jee-Hwan Ryu. School of Mechanical Engineering Korea University of Technology and Education

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

Combinational logic. Possible logic functions of two variables. Minimal set of functions. Cost of different logic functions

Homework Assignment #1 Solutions EE 477 Spring 2017 Professor Parker

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

Logic Design Combinational Circuits. Digital Computer Design

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

CSC9R6 Computer Design. Practical Digital Logic

Experiment 7: Magnitude comparators

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences

Gates. Quiz 1 will cover up to and including this lecture. The book says something about NAND... maybe an in-law. Is he talking about BILL??? 6.

COMBINATIONAL LOGIC CIRCUITS. Dr. Mudathir A. Fagiri

CprE 281: Digital Logic

Sequential Logic (3.1 and is a long difficult section you really should read!)

Building a Computer Adder

Binary addition example worked out

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

COSC 243. Introduction to Logic And Combinatorial Logic. Lecture 4 - Introduction to Logic and Combinatorial Logic. COSC 243 (Computer Architecture)

What s the Deal? MULTIPLICATION. Time to multiply

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

ALU A functional unit

Boolean Algebra. Boolean Variables, Functions. NOT operation. AND operation. AND operation (cont). OR operation

Class Website:

CS61C : Machine Structures

CMSC 313 Lecture 19 Homework 4 Questions Combinational Logic Components Programmable Logic Arrays Introduction to Circuit Simplification

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

Logic. Combinational. inputs. outputs. the result. system can

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

S C F F F T T F T T S C B F F F F F T F T F F T T T F F T F T T T F T T T

CS61C : Machine Structures

University of Toronto Faculty of Applied Science and Engineering Department of Electrical and Computer Engineering Midterm Examination

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

Show that the dual of the exclusive-or is equal to its compliment. 7

ECE429 Introduction to VLSI Design

University of Technology

Computer Science. 19. Combinational Circuits. Computer Science COMPUTER SCIENCE. Section 6.1.

ENG2410 Digital Design Combinational Logic Circuits

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

ELCT201: DIGITAL LOGIC DESIGN

Computer Architecture. ESE 345 Computer Architecture. Design Process. CA: Design process

8. Design Tradeoffs x Computation Structures Part 1 Digital Circuits. Copyright 2015 MIT EECS

Combinational Logic Trainer Lab Manual

UNIVERSITY OF WISCONSIN MADISON

8. Design Tradeoffs x Computation Structures Part 1 Digital Circuits. Copyright 2015 MIT EECS

Learning Objectives. Boolean Algebra. In this chapter you will learn about:

Chapter 4: Combinational Logic Solutions to Problems: [1, 5, 9, 12, 19, 23, 30, 33]

14:332:231 DIGITAL LOGIC DESIGN

Where are we? Data Path Design

Chapter 1 Review of Equations and Inequalities

The course web site s notes entitled Switches, Gates and Circuits which can be found at will be useful to you throughout the lab.

CMSC 313 Lecture 19 Combinational Logic Components Programmable Logic Arrays Karnaugh Maps

Transcription:

CSE370 HW3 Solutions (Winter 2010) 1. CL2e, 4.9 We are asked to implement the function f(a,,c,,e) = A + C + + + CE using the smallest possible multiplexer. We can t use any extra gates or the complement of a variable. Looking at the function it appears that A and E are good potential candidates for eliminating since they only appear in one term each and their complements are not used in any of the terms. If we build the truth table for the case where we try to get rid of E (left) or A (right), we get the following tables: A C f 0 0 0 0 0 0 0 0 1 1 0 0 1 0 E 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 0 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 0 1 1 1 1 1 0 1 1 1 1 1 1 C E f 0 0 0 0 A 0 0 0 1 A 0 0 1 0 1 0 0 1 1 1 0 1 0 0 A 0 1 0 1 1 0 1 1 0 1 0 1 1 1 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 0 1 1 1 1 1 0 A 1 1 1 1 A Note: To fill in the truth tables I go through each term in the equation and fill in the rows that must always be 1 s. Then for the remaining blanks I look first to see if any term could make it true, if not it gets a zero. If one of the terms could make it true I check if it s true when the variable we eliminated is true or not. This gives us whether we should use the complement or not. oth work, but now we need to check if we can eliminate both A and E to use an even smaller MUX: C 0 0 0 A 0 0 1 1 0 1 0 A+E 0 1 1 1 1 0 0 1 1 0 1 1

s0 s3 1 1 0 1 1 1 1 A In this case we would need an OR gate to use a smaller MUX, so the previous solution(s) are the best we can do. Here is the resulting circuit: E Problem4_9 i8 O i9 0 1 2 3 4 5 f mux16_1 A C 2. CL2e, 4.12 part a We have the function f(a,,c,,e,) = m(3, 7, 12, 14, 15, 19, 23, 27, 28, 29, 31, 35, 39, 44, 45, 46, 48, 49, 50, 52, 53, 55, 56, 57, 59). I am first going to show how we can construct this using a 32:1 MUX. We can build a 32 row truth table and use the variable as the input variable. I chose because it is the lowest order bit, so it lets me use a trick to quickly fill in the truth table. Also, to save space I am going to write the 32 row truth table as a 16 row truth tables with two outputs, the first set of outputs are with the high order bit A is 0 and the second set it when it s 1. or illustrative purposes I have also included the minterms that affect each row of the output.

A=0 A=1 C E m s f m s f 0 0 0 0 m0,m1 0 m32,m33 0 0 0 0 1 m2,m3 0 0 1 0 m4,m5 0 0 0 0 1 1 m6,m7 0 1 0 0 m8,m9 0 0 0 1 0 1 0 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 m30,m31 m62,m63 0 To fill in this table, we now can just look at all the minterms in the equation that correspond to each row. If both are there, then output 1. If neither is there, then output 0. If the first is there and not the second, then output. Otherwise, output. Once we have the truth table we just need to figure out how to realize the circuit using the MUXes we have. We need 32 inputs so let s use 4 8:1 MUXes and select using the low order bits (C,,E), then route these 4 outputs into a 4:1 MUX and select the final result using the two high order bits (A,). Note: Some people didn t go ahead and draw this circuit. It s tedious, but good practice to make sure you understand how everything hooks together. We get the resulting circuit diagram:

_not _not o ut s0 o ut s0 _not o ut s0 o ut s0 s0 A E f AC CE This used 4 8:1 MUXes and a single 4:1 MUX, for a total of 5 chips! 3. CL2e, 4.19 Consider f(a,,c,) = m(0, 3, 5, 7, 11, 12, 13, 15) a. Part a This first part is trivial since we are given the minterms we just set each input corresponding to the true minterms equal to 1 and the others equal to 0. This gives use the resulting 16:1 MUX.

s0 s3 i8 i9 0 1 2 3 4 5 O f mux16_1 A C b. Part b Now to use only an 8:1 MUX we need to eliminate one of the variables. Let s choose for simplicity. The truth table for the function and the corresponding circuit become: A C f 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 _not o ut s0 A C f

s0 s3 c. Part c As was pointed out, we can t use a single gate if we use A and as the select inputs. So instead we will use C and as the select inputs and come up with functions in terms of A and. This gives the following truth table and corresponding circuit: C A 0 0 1 00 0 1 0 1 0 0 1 1 1 0 0 0 01 0 1 1 1 0 0 1 1 1 0 0 0 10 0 1 0 1 0 0 1 1 0 0 0 1 11 0 1 1 1 0 1 1 1 1 A XOR 0 1 A_not GN s0 C f If you instead used A and as the select input you would get the following as inputs to your 4:1 MUX: C XOR,, C &, and C +, which takes several gates more than the solution above. d. Part d ollowing the procedure that we learned in class to use a 4:16 decoder we can OR all the outputs that correspond to the true minterms. This givens the following circuit: o0 o1 o2 o3 o4 o5 o6 i o7 o8 o o9 o10 o11 o12 o13 o14 o15 or8 decoder16 A C

4. CL2e, 3.19 Let M be the value after the leftmost XOR gate and let N be the value after the leftmost NAN gate. We then get the following truth table for the circuit: M N G A A XOR A (A) AM (AM) N XOR M 0 0 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 1 0 0 1 0 This gives us the truth tables: A G A 1 0 1 0 1 1 0 0 Which gives the reduced equations: = A + G = A Assuming a delay of 5 for the NAN and a delay of 10 for the XOR: 100 A M N G 5. CL2e, 3.21 a. Part a or this circuit I am assuming that the inverters have 5 delay and the NOR gate has a delay of 10. This gives us the following timing diagram:

100 S U1 in U1 U3 U4 U2 We can see the when the switch is closed the circuit oscillates between 0 and 1 with the delay of the OR and two inverters. Note: A lot of people showed how it oscillated but didn t show how it stops once the switch closes. b. Part b or this circuit I am assuming that the inverters have 5 delay and the NOR gate has a delay of 10. This gives us the following timing diagram: 100 S U1 in U1 U3 U2 The circuit does not oscillate, in fact the output of U3 is 1 until the switch is closed and then remains 0 forever because the input U2 becomes high. Note: Most people said that it just stays 0 all the time. What is really going on though is that it could start out at 1 (when the switch is open), and the first time the switch closes it will go to 0 and will remain zero no matter what happens after that point.

Note: A couple people incorrectly asserted that it doesn t oscillate because there is less delay in the circuit. This is not the case, the reason it doesn t oscillate is because the output of U3 is only inverted once, and so (coupled with the NOR gate) as soon as the output becomes 0 the input will always have a 1 on it. 6. CL2e, 3.26 Consider an adder of 2 2-bit numbers. a. Part a The truth table for this circuit is as follows: A C X Y Z 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 1 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 0 1 0 1 1 1 1 1 1 1 0 X C b. Part b We get the following three k-maps for X, Y, and Z: A Y A 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 1 0 0 1 1 C 0 1 0 1 1 0 1 0 1 1 0 0 Z C A 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 This gives us the following equations: X = AC + A + C Y = AC + A C + A C + A C + AC + A C Z = + = XOR c. Part c rom looking at igure 3.32 we can see that the delay for chaining two full adders will be 4 levels of logic (ignoring inverters and ignoring the fact that there is 4-input OR gate).

On the other hand the formulae derived above are all 2 level logic. So it is approximately twice as fast. Note: Some people were confusing size of the circuit with the delay. What this question was hoping people would realize is that the circuit we designed is bigger (more total gates), but faster because we have fewer levels of logic. The calculations aren t precise because we ignore things like inverters and # of inputs to the gates, but levels of logic is a good approximation in many cases. We see this same space/speed tradeoff in the Adders section of the book. 7. CL2e, 3.32 (follow same instructions as 3.28) The point of this problem was to give you practice using Verilog and start thinking about how you can represent things in multiple ways using Verilog. Using the oolean expressions from 3.26 we get the Verilog: module adder2x2bit(a,, C,, X, Y, Z); input A,, C, ; output X, Y, Z; assign X = (A & C) ( & C & ) (A & & ); assign Y = (A & ~C & ~) (A & ~C & ~) (~A & ~ & C) (~A & C & ~) (~A & & ~C & ) (A & & C & ); assign Z = ^ ; endmodule We could have also written this more structurally (using and and or modules). The second part of the problem asks us if there is another way to write it that describes the behavior instead of the logic. Here they were trying to get us to realize that since we are doing addition, we can use the + operator. module adder2x2bit(a,, C,, X, Y, Z); input A,, C, ; output X, Y, Z; assign {X,Y,Z} = {A,} + {C,}; endmodule Note: A lot of people didn t read the question carefully and just did 3.32. y following the instructions of 3.28, the idea was to let you see the difference between describing the logic of a circuit using oolean Logic, versus expressing directly what the circuit is trying to calculate. Note: Also a lot of people added a line: reg X, Y, Z;. I think lecture slide 9 had a slight error. In general you need to use the reg keyword for assignments done in an always block, but not with assign statements outside an always block. Active HL may let you get away with it though.