Digital Logic (2) Boolean Algebra

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

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

. T SHREE MAHAPRABHU PUBLIC SCHOOL & COLLEGE NOTES FOR BOARD EXAMINATION SUBJECT COMPUTER SCIENCE (Code: 083) Boolean Algebra

CHAPTER1: Digital Logic Circuits Combination Circuits

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

Cs302 Quiz for MID TERM Exam Solved

Fundamentals of Digital Design

LOGIC GATES. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

UNIVERSITI TENAGA NASIONAL. College of Information Technology

Switches: basic element of physical implementations

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

Chapter 1: Logic systems

EEE130 Digital Electronics I Lecture #4

Combinational Logic. Review of Combinational Logic 1

ENG2410 Digital Design Combinational Logic Circuits

Combinational Logic. By : Ali Mustafa

CS/COE0447: Computer Organization and Assembly Language

Logic Design. Chapter 2: Introduction to Logic Circuits

Binary Logic and Gates. Our objective is to learn how to design digital circuits.

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

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

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)

Boolean Algebra, Gates and Circuits

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined

Chapter 7 Logic Circuits

SAMPLE ANSWERS MARKER COPY

Fundamentals of Computer Systems

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Systems I: Computer Organization and Architecture

1 Boolean Algebra Simplification

Review: Additional Boolean operations

Logic and Boolean algebra

Introduction to Karnaugh Maps

Binary Logic and Gates

Chapter 5. Digital systems. 5.1 Boolean algebra Negation, conjunction and disjunction

Review for Test 1 : Ch1 5

CSC9R6 Computer Design. Practical Digital Logic

Combinational Logic. Course Instructor Mohammed Abdul kader

Part 1: Digital Logic and Gates. Analog vs. Digital waveforms. The digital advantage. In real life...

DIGITAL LOGIC CIRCUITS

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

Computer Organization: Boolean Logic

Boolean Algebra & Logic Gates. By : Ali Mustafa

E&CE 223 Digital Circuits & Systems. Lecture Transparencies (Boolean Algebra & Logic Gates) M. Sachdev

Fundamentals of Computer Systems

Number System conversions

Gates and Flip-Flops

Building a Computer Adder

Z = F(X) Combinational circuit. A combinational circuit can be specified either by a truth table. Truth Table

MC9211 Computer Organization

Fundamentals of Computer Systems

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

L2: Combinational Logic Design (Construction and Boolean Algebra)

211: Computer Architecture Summer 2016

2 Application of Boolean Algebra Theorems (15 Points - graded for completion only)

THE LOGIC OF COMPOUND STATEMENTS

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

CHAPTER 7. Solutions for Exercises

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

Every time has a value associated with it, not just some times. A variable can take on any value within a range

Chapter 2. Digital Logic Basics

10/14/2009. Reading: Hambley Chapters

ELCT201: DIGITAL LOGIC DESIGN

Review. EECS Components and Design Techniques for Digital Systems. Lec 06 Minimizing Boolean Logic 9/ Review: Canonical Forms

Logic Simplification. Boolean Simplification Example. Applying Boolean Identities F = A B C + A B C + A BC + ABC. Karnaugh Maps 2/10/2009 COMP370 1

EECS Variable Logic Functions

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

Signals and Systems Digital Logic System

of Digital Electronics

E&CE 223 Digital Circuits & Systems. Lecture Transparencies (Boolean Algebra & Logic Gates) M. Sachdev. Section 2: Boolean Algebra & Logic Gates

Lecture 6: Gate Level Minimization Syed M. Mahmud, Ph.D ECE Department Wayne State University

Chapter-2 BOOLEAN ALGEBRA

Unit 2 Session - 6 Combinational Logic Circuits

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

CS 226: Digital Logic Design

WORKBOOK. Try Yourself Questions. Electrical Engineering Digital Electronics. Detailed Explanations of

Lecture 2 Review on Digital Logic (Part 1)

Sample Test Paper - I

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Digital Logic Appendix A

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

CHAPTER 12 Boolean Algebra

Experiment 7: Magnitude comparators

Logic. Basic Logic Functions. Switches in series (AND) Truth Tables. Switches in Parallel (OR) Alternative view for OR

Gate-Level Minimization

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits

Binary logic consists of binary variables and logical operations. The variables are

Chapter 2: Princess Sumaya Univ. Computer Engineering Dept.

COMBINATIONAL LOGIC FUNCTIONS

BOOLEAN ALGEBRA TRUTH TABLE

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1

Week-I. Combinational Logic & Circuits

Simplifying Logic Circuits with Karnaugh Maps

Boolean Logic Prof. James L. Frankel Harvard University. Version of 3:20 PM 29-Aug-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved.

CS 121 Digital Logic Design. Chapter 2. Teacher Assistant. Hanin Abdulrahman

Boolean Algebra & Digital Logic

Chap 2. Combinational Logic Circuits

Transcription:

Digital Logic (2) Boolean Algebra Boolean algebra is the mathematics of digital systems. It was developed in 1850 s by George Boole. We will use Boolean algebra to minimize logic expressions. Karnaugh Maps will also be used as a graphical tool to minimize Boolean expressions. Boolean algebra has two very important applications in digital circuitry and in programming. 2.1 Basic Logic Operators The basic logical operators are AND, OR, NOT, NAND, NOR and XOR. AND X Y X AND Y T T T T F F F T F F F F T stands for True and F for False. In the computer environment T and F are changed respectively to 1 and 0. X Y X AND Y 1 1 1 1 0 0 0 1 0 0 0 0 The AND operator is also represented by a dot and this dot is sometimes left out too for example X AND Y can be represented by X.Y or even XY (without the dot between X and Y). OR X Y X OR Y 1 1 1 1 0 1 0 1 1 0 0 0 The OR operator is also represented by a + for example X OR Y can be represented by X + Y. NOT X NOT X 1 0 0 1 One of the symbols of NOT is a bar over the variable as in. Digital Logic Advanced Computing Page 1

XOR XOR stands for Exclusive OR X Y X XOR Y 1 1 0 1 0 1 0 1 1 0 0 0 NAND NAND stands for Not AND X Y X NAND Y 1 1 0 1 0 1 0 1 1 0 0 1 NOR NOR stands for Not OR X Y X NOR Y 1 1 0 1 0 0 0 1 0 0 0 1 2.2 Logical Expressions The following are all Boolean expressions: 2.3 Precedence of Operators When more than one logical operator is used in a statement, NOT is evaluated first, then AND, and finally OR. As in arithmetic the brackets are worked out first. So let us value the above expressions when A=1, B=0 and C=1. Evaluates to A OR NOT B = 1 OR NOT 0 = 1 OR 1 = 1 Digital Logic Advanced Computing Page 2

Evaluates to NOT (A AND B) OR C = NOT (1 AND 0) OR 1 = NOT (0) OR 1 = 1 OR 1 = 1 Evaluates to A AND (B OR NOT C) = 1 AND (0 OR NOT 1) = 1 AND (0 OR 0) = 1 AND 0 = 0 Evaluates to (NOT A OR B) AND (A OR NOT C) = (NOT 1 OR 0) AND (1 OR NOT 1) = (0 OR 0) AND (1 OR 0) = 0 AND 1 = 0 2.3.1 Exercise: Evaluate the following Boolean expressions given that A=0, B=1 and C=1. a) b) c) d) 2.4 Logic Gates A logic gate is an elementary building block of a digital circuit. Most logic gates have two inputs and one output. At any given moment, every terminal is in one of the two binary conditions low (0) or high (1), implemented by different voltage levels. In most logic gates, the low state is approximately zero volts (0 V), while the high state is approximately five volts positive (+5 V). The following table shows the most common logic gates. Digital Logic Advanced Computing Page 3

2.4.1 Logic Circuits Boolean expressions can be expressed as logic circuits. Examples are shown hereunder: Boolean Expression Logic Circuit 2.4.2 Exercise: Draw the logic circuits of the Boolean expressions found in exercise 2.3.1 2.5 Laws of (Boolean) Algebra Commutative Laws Associative Laws Distributive Law A + B = B + A A.B = B.A A + ( B + C ) = ( A + B ) + C A.( B.C ) = ( A.B ).C A.( B + C ) = A.B + A.C A + B.C = ( A + B ).( B + C ) De Morgan s Laws (Rule: break the bar and change the sign) Laws of Absorption Double Complement Law Digital Logic Advanced Computing Page 4

Laws of Tautology 2.5.1 Examples (1) Show that LHS = ( ) (distributive law) (2) Show that = (tautology law) = (tautology law) LHS = (distributive law) = (distributive law) = (tautology law) = (distributive law) = (tautology law) = (tautology law) (3) Show that LHS = (De Morgan s law) = (double complement law) (4) Show that LHS = ( ) (De Morgan s law) = (double complement law) = (distributive law) = (tautology law) = (tautology law) Digital Logic Advanced Computing Page 5

2.5.2 Exercise Prove the following identities: (1) (2) (3) (4) (5) (6) ( ) (7) ( ) ( ) (8) 2.6 NAND and NOR Both the NAND and NOR operations are functionally complete. This means that one can implement any logic circuit using only NAND or only NOR logic gates. Due to this property, NAND and NOR gates are sometimes called "universal gates". A NAND gate is logically an inverted AND gate. By itself it has the following truth table: Truth Table Input A Input B Output Q 0 0 1 0 1 1 1 0 1 1 1 0 Making other gates by using NAND gates A NOT gate is made by joining the inputs of a NAND gate. Desired Gate NAND Construction Truth Table Input A Output Q 0 1 1 0 Digital Logic Advanced Computing Page 6

An AND gate is made by following a NAND gate with a NOT gate as shown below. Desired Gate NAND Construction Input A Input B Output Q 0 0 0 0 1 0 1 0 0 1 1 1 The OR gate is implemented as follows: Desired Gate NAND Construction Input A Input B Output Q 0 0 0 0 1 1 1 0 1 1 1 1 A NOR gate is simply an inverted OR gate. Desired Gate NAND Construction Truth Table Input A Input B Output Q 0 0 1 0 1 0 1 0 0 1 1 0 Digital Logic Advanced Computing Page 7

The XOR gate is implemented as shown: Desired Gate NAND Construction Input A Input B Output Q 0 0 0 0 1 1 1 0 1 1 1 0 An XNOR gate is simply an XOR gate with an inverted output: Desired Gate NAND Construction Input A Input B Output Q 0 0 1 0 1 0 1 0 0 1 1 1 A NOR gate is logically an inverted OR gate. By itself has the following truth table: Input A Input B Output Q 0 0 1 0 1 0 1 0 0 1 1 0 Digital Logic Advanced Computing Page 8

Making other gates by using NOR gates The following is the implementation of a NOT gate. Desired Gate NOR Construction Input A Output Q 0 1 1 0 The OR gate is simply a NOR gate followed by a NOT gate. Desired Gate NOR Construction Input A Input B Output Q 0 0 0 0 1 1 1 0 1 1 1 1 This is the implementation of the AND gate. Desired Gate NOR Construction Input A Input B Output Q 0 0 0 0 1 0 1 0 0 1 1 1 Digital Logic Advanced Computing Page 9

A NAND gate is made using an AND gate in series with a NOT gate: Desired Gate NOR Construction Input A Input B Output Q 0 0 1 0 1 1 1 0 1 1 1 0 An XOR gate is made by the following connections: Desired Gate NOR Construction Input A Input B Output Q 0 0 0 0 1 1 1 0 1 1 1 0 Circuit Diagrams using only NAND and NOR Gates How can we implement the following circuit in (i) NAND gates, and (ii) NOR gates? Digital Logic Advanced Computing Page 10

Solution with NAND gates: Note that the above circuit can be simplified into the following: Solution with NOR gates: Exercise Draw the circuit diagram of the following circuits (first draw them using the AND, OR and NOT gates, then using only NAND gates and finally using only NOR gates). a) b) 2.7 Gates with Three inputs AND Gate Digital Logic Advanced Computing Page 11

OR Gate XOR Gate NAND Gate Digital Logic Advanced Computing Page 12

NOR Gate 2.8 Karnaugh Maps Karnaugh map is a minimisation technique for logic circuits. It is simply a method of plotting or mapping all the conditions given in the truth table. Using Karnaugh Maps to Simplify an Expression Suppose we are given the expression perform the following steps: then we 1. Draw a 3-variable Karnaugh Map. 2. Fill it with ones and zeros according to the expression. 3. Group ones in groups of 1, 2, 4 or 8 adjacent cells. Digital Logic Advanced Computing Page 13

4. Write the simplified expression. Using Karnaugh Maps from Truth Tables If you are given the truth table shown below then you fill the ones from the table and proceed as we did above. Digital Logic Advanced Computing Page 14

Another Example Simplify the expression. This gives: Therefore the simplified expression is. Yet another Example Use a Karnaugh map to simplify the Boolean expression: Note how the ones are written down in the Karnaugh map. Note that there are overlapping ones. Digital Logic Advanced Computing Page 15

The groupings are shown in the diagram on the right. Therefore the simplified expression is. Another Example Still A circuit with the following conditions is required. It has 4 inputs A, B, X and Y and one output F. AB and XY are binary numbers where A and X are the most significant bits. When AB >= XY the output F has to be 1 otherwise it is 0. Solution: The truth table of such a circuit is shown below on the right. The Karnaugh map with the required groupings is shown hereunder. This gives the expression Digital Logic Advanced Computing Page 16

2.9 Half and full Adders In electronics, an adder or summer is a digital circuit that performs addition of numbers. Half adder The half-adder adds two bits and has two outputs: S: the sum, and C: the carry. Let us find the circuit diagram for C and S. In this case these can be done by observation. C is clearly equal to A AND B. S is A XOR B. The two solutions below give the required circuit diagrams of S and C. The one on the left uses an AND gate and an XOR gate while the one on the right gives the solution in NAND gates. Full adder Digital Logic Advanced Computing Page 17

This diagram is a schematic symbol for a 1-bit full adder with Cin and Cout drawn on sides of block to emphasize their use in a multi-bit adder. A full adder adds binary numbers and accounts for values carried in as well as out. A one-bit full adder adds three one-bit numbers, often written as A, B, and Cin; A and B are the operands, and Cin is a bit carried in from the next less significant stage. The one-bit full adder's truth table is: Inputs Outputs A B Cin Cout S 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 1 0 1 0 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 Let us construct the circuit diagram for Cout and S. The diagram below shows the Karnaugh maps for Cout and S. The above Karnaugh maps give the following Boolean equations: Cout The circuit diagram is shown hereunder. Note that here we are using logic gates with three inputs. This simplifies the diagram. Digital Logic Advanced Computing Page 18

Another (simpler) circuit that makes use of the XOR gate is shown below. 2.10 Magnitude Comparators A magnitude comparator is a circuit that compares two numbers A and B to determine whether A>B, A=B or A<B. Let two binary numbers be represented by AB and XY in such a way that if, for example, A=0, B=1, X=1 and Y=0 then AB would represent 012 and XY would be 102. Now obviously AB is less than XY. So if such a circuit has three outputs, L (for Less), E (for Equal) and M (for More), then for this particular input L=1, E=0 and M=0. The following is the truth table for such a comparator. Digital Logic Advanced Computing Page 19

A B X Y L E M 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 0 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 These are the Karnaugh Maps for the 3 outputs L, E and M. Digital Logic Advanced Computing Page 20

The above Karnaugh Maps and the one on the right give the following Boolean functions: 2.11 BCD-to-Gray Code Converters The following truth table performs the conversion from BCD to Gray code. Note the Don t Care states indicated with the letter D. A B C D W X Y Z 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 1 1 0 0 1 0 0 1 1 1 0 1 1 0 1 0 D D D D 1 0 1 1 D D D D 1 1 0 0 D D D D 1 1 0 1 D D D D 1 1 1 0 D D D D 1 1 1 1 D D D D Digital Logic Advanced Computing Page 21

The functions and circuit diagrams of W, X, Y and Z are left as an exercise. Digital Logic Advanced Computing Page 22

2.12 7-Segment Display Unit A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display device for displaying decimal numerals. Seven-segment displays are widely used in digital clocks and other electronic devices for displaying numerical information. The seven elements of the display can be lit in different combinations to represent the arabic numerals. The numerals 0,1,6, 7 and 9 may be represented by two or more different glyphs on seven-segment displays. The seven segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. Additionally, the seventh segment bisects the rectangle horizontally. There are also fourteensegment displays and sixteen-segment displays (for full alphanumerics); however, these have mostly been replaced by dot-matrix displays. The segments of a 7-segment display are referred to by the letters A to G, where the optional DP decimal point (an "eighth segment") is used for the display of noninteger numbers. The picture below shows how the digits (decimal and hexadecimal) can be represented in the 7-segment display. The following (partial) truth table shows the input and output for the 7-segment display. Continue to fill it and then find the Boolean functions for A, B, G. Digital Logic Advanced Computing Page 23

P Q R S A B C D E F G 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 Digital Logic Advanced Computing Page 24