Computer Arithmetic, K-maps Prof. Sin-Min Lee Department of Computer Science.

Slides:



Advertisements
Similar presentations
EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Advertisements

Digital Circuits.
Combinational Circuits ENEL 111. Common Combinationals Circuits NAND gates and Duality Adders Multiplexers.
Boolean Algebra and Reduction Techniques
Gate-level Minimization
Relationship Between Basic Operation of Boolean and Basic Logic Gate The basic construction of a logical circuit is gates Gate is an electronic circuit.
Lecture 14 Today we will Learn how to implement mathematical logical functions using logic gate circuitry, using Sum-of-products formulation NAND-NAND.
Computer Arithmetic, Multiplexers Prof. Sin-Min Lee Department of Computer Science.
4/11/03 Minute Paper How does MS window work? Like how do we have the screen on the computer. Is it just a bunch of Binary #’s representing colors? When.
EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Hamming Code, K-maps-Multiplexer Midterm 1 Revision
Computer Engineering (Logic Circuits) (Karnaugh Map)
بهينه سازي با نقشة کارنو Karnaugh Map. 2  Method of graphically representing the truth table that helps visualize adjacencies 2-variable K-map 3-variable.
Lecture 3. Boolean Algebra, Logic Gates
Digital Fundamentals with PLD Programming Floyd Chapter 4
Overview Part 2 – Circuit Optimization 2-4 Two-Level Optimization
Boolean Algebra and Logic Simplification
11.1 Boolean Functions. Boolean Algebra An algebra is a set with one or more operations defined on it. A boolean algebra has three main operations, and,
Boolean Algebra ‘An algebra of Logic’ Prepared by: Manish Kumar, Asst Master (Comp. Sc.) Sainik School Gopalganj.
EEE324 Digital Electronics Ian McCrumRoom 5B18, Lecture 4: Boolean Algebra.
1 Fundamentals of Computer Science Propositional Logic (Boolean Algebra)
1 COMBINATIONAL LOGIC One or more digital signal inputs One or more digital signal outputs Outputs are only functions of current input values (ideal) plus.
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
Boolean Algebra and Digital Circuits
Department of Computer Engineering
F = ∑m(1,4,5,6,7) F = A’B’C+ (AB’C’+AB’C) + (ABC’+ABC) Use X’ + X = 1.
Computer Organization 1 Logic Gates and Adders. Propositions –Venn Diagrams.
1 Digital Logic Design Week 5 Simplifying logic expressions.
Digital Circuits. Review – Getting the truth table The first step in designing a digital circuit usually is to get the truth table. That is, for every.
Digital Circuits Design Chin-Sung Lin Eleanor Roosevelt High School.
1 © 2015 B. Wilkinson Modification date: January 1, 2015 Designing combinational circuits Logic circuits whose outputs are dependent upon the values placed.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. Circuit Optimization Logic and Computer Design Fundamentals.
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
Chapter 3 Gate-Level Minimization
Minimisation ENEL111. Minimisation Last Lecture  Sum of products  Boolean algebra This Lecture  Karnaugh maps  Some more examples of algebra and truth.
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
LOGIC GATES & BOOLEAN ALGEBRA
CS1Q Computer Systems Lecture 7
1 ENGG 1015 Tutorial Digital Logic (II) (70 pages) 15 Oct Learning Objectives  Learn about Boolean Algebra (SoP/PoS, DrMorgan's Theorem, simplification),
XOR Operator A short digression… … to introduce another Boolean operation: exclusive- OR (XOR) ABA + B XOR.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
Boolean Algebra and Reduction Techniques
Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Floyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd Chapter 4 © 2008 Pearson Education.
CS151 Introduction to Digital Design Chapter Map Simplification.
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
C.S.Choy39 TERMINOLOGY Minterm –product term containing all input variables of a function in either true or complementary form Maxterm – sum term containing.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Binary Numbers For digital systems, the.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 4 Dr. Shi Dept. of Electrical and Computer Engineering.
Revision Mid 1 Prof. Sin-Min Lee Department of Computer Science.
BOOLEAN ALGEBRA LOGIC GATES. Introduction British mathematician George Boole( ) was successful in finding the link between logic and mathematics.
1 CS 352 Introduction to Logic Design Lecture 1 Ahmed Ezzat Number Systems and Boolean Algebra, Ch-1 + Ch-2.
K-maps and Decoders Prof. Sin-Min Lee Department of Computer Science.
Digital Circuits Design Chin-Sung Lin Eleanor Roosevelt High School.
EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Combinational Circuits and Boolean
CHAPTER 3 Simplification of Boolean Functions
De Morgan’s Theorem,.
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
DeMorgan’s Theorem DeMorgan’s 2nd Theorem
Digital Logic and Design
BASIC & COMBINATIONAL LOGIC CIRCUIT
CSE 370 – Winter Combinational Logic - 1
Digital Fundamentals Floyd Chapter 4 Tenth Edition
3-Variable K-map AB/C AB/C A’B’ A’B AB AB’
Analysis of Logic Circuits Example 1
Computer Architecture
Presentation transcript:

Computer Arithmetic, K-maps Prof. Sin-Min Lee Department of Computer Science

Bit-Serial and Ripple-Carry Adders Half-adder (HA): Truth table and block diagram Full-adder (FA): Truth table and block diagram

Half-Adder Implementations c Three implementations of a half-adder.

Full-Adder Implementations

Converting whole part w:(105) ten = (?) five Repeatedly divide by fiveQuotientRemainder Therefore, (105) ten = (410) five Converting fractional part v:( ) ten = (410.?) five Repeatedly multiply by fiveWhole PartFraction Therefore, ( ) ten  ( ) five Radix Conversion: Old-Radix Arithmetic

Radix Conversion: New-Radix Arithmetic Converting whole part w: (22033) five = (?) ten ((((2  5) + 2)  5 + 0)  5 + 3)  |-----| : : : : 10 : : : : | | : : : 12 : : : | | : : 60 : : | | : 303 : | | 1518 Converting fractional part v: ( ) five = (105.?) ten ( ) five  5 5 =(22033) five =(1518) ten 1518 / 5 5 =1518 / 3125 = Therefore, ( ) five = ( ) ten Horner’s rule is also applicable: Proceed from right to left and use division instead of multiplication

Horner’s Rule for Fractions Converting fractional part v: ( ) five = (?) ten (((((3 / 5) + 3) / 5 + 0) / 5 + 2) / 5 + 2) / 5 |-----| : : : : 0.6 : : : : | | : : : 3.6 : : : | | : : 0.72 : : | | : : | | | | Horner’s rule used to convert ( )five to decimal

Signed-Magnitude Representation Four-bit signed-magnitude number representation system for integers

Two’s- and 1’s-Complement Numbers Two’s complement = radix complement system for r = 2 M = 2 k 2 k – x = [(2 k – ulp) – x] + ulp = x compl + ulp Range of representable numbers in with k whole bits: from –2 k–1 to 2 k–1 – ulp A 4-bit 2’s-complement number representation system for integers.

Why 2’s-Complement Is the Universal Choice Adder/subtractor architecture for 2’s-complement numbers.

Signed-Magnitude vs 2’s-Complement Two’s-complement adder/subtractor needs very little hardware other than a simple adder Fig. 2.7 Signed-magnitude adder/subtractor is significantly more complex than a simple adder

Truth table to K-Map ABP B A minterms are represented by a 1 in the corresponding location in the K map. The expression is: A.B + A.B + A.B

K-Maps Adjacent 1 ’ s can be “ paired off ” Any variable which is both a 1 and a zero in this pairing can be eliminated Pairs may be adjacent horizontally or vertically B A a pair another pair B is eliminated, leaving A as the term A is eliminated, leaving B as the term The expression becomes A + B

Two Variable K-Map A B CP A.B.C + A.B.C + A.B.C BC A One square filled in for each minterm. Notice the code sequence: – a Gray code.

Grouping the Pairs BC A equates to B.C as A is eliminated. Here, we can “wrap around” and this pair equates to A.C as B is eliminated. Our truth table simplifies to A.C + B.C as before.

Groups of 4 BC A Groups of 4 in a block can be used to eliminate two variables: The solution is B because it is a 1 over the whole block (vertical pairs) = BC + BC = B(C + C) = B.

Karnaugh Maps Three Variable K-Map –Extreme ends of same row considered adjacent A BC

Karnaugh Maps Three Variable K-Map example A BC X =

The Block of 4, again A BC X = C

Returning to our car example, once more Two Variable K-Map A B CP A.B.C + A.B.C + A.B.C AB C There is more than one way to label the axes of the K-Map, some views lead to groupings which are easier to see.

Karnaugh Maps Four Variable K-Map –Four corners adjacent AB CD

Karnaugh Maps Four Variable K-Map example AB CD F =

Product-of-Sums We have populated the maps with 1’s using sum-of-products extracted from the truth table. We can equally well work with the 0’s AB C ABCP AB C P = (A + B).(A + C) P = A.B + A.C equivalent

Inverted K Maps In some cases a better simplification can be obtained if the inverse of the output is considered –i.e. group the zeros instead of the ones –particularly when the number and patterns of zeros is simpler than the ones

Karnaugh Maps Example: Z5 of the Seven Segment Display X1X2X3X4Z X1010X 1011X1011X 1100X1101X1110X1111X1100X1101X1110X1111X X 1 X 2 X3 X Z5 = Better to group 1’s or 0’s?

Example: Majority Function Three inputs: A, B, C One output: M Output takes truth value of majority inputs. I.e. –M is 1 iff two of A,B,C is 1 –M is 0 iff two of A, B, C is 0 Notice writing large truth tables is cumbersome

Alternative Representation Collect the combinations of variable that give 1 for output. Write the function as a SUM of these terms In terms, write variable name for value 1, and a bar over the name for 0. EG: M = ABC+ABC+ABC+ABC

Rationale for New Notation Consider ABC: The product is for AND Consider ABC+ABC: The sum is for OR So we are writing the function as a sum of products I.e. AND-ing OR-terms – Called conjunctive normal form. Consider ABC: This is 1 iff A=0, B=1 and C=1 A function of N variables can be given as sum of 2**N n-variable products

Creating Circuits for Boolean Functions M=ABC+ABC+ABC+ABC 1,2,3 are NOT gates feeding lines A,B,C 4,5,6,7 are AND gates corresponding to the four product terms 8 is an OR term corresponding to the sum A,B,C have been inserted to avoid clutter – they could be connected directly out of NOT gate

Implementing Boolean Functions Write the truth table Provide inverters for complementing inputs Draw an AND gate for each term with 1in output column Wire the AND gates to appropriate inputs Feed the outputs of all AND gates into an OR gate

Using A Single Gate Type It is desirable to use only one type of gate generate the whole circuit. Can use NAND or NOR gate. In order to do so, enough to show that –NOT, AND, OR NAND can be generated by NOR gates –NOT, AND, OR, NOR ca be generated by NAND gates. We say that NAND, NOR are complete for Boolean circuits

Completeness of NAND

Completeness of NOR

Circuit Equivalence Sometimes need to minimize number of elements on a board: –get minimum number of gates –Two input gates instead of four input gates Need to find an equivalent circuit for the given circuit Equivalent= having same input – output behavior = computing same Boolean function Use Boolean Algebra

Example: Using AB+AC =A(B+C)

Some Laws of Boolean Algebra

Consequences of De Morgan ’ s Law

Using De Morgan ’ s Laws to covert sum of products to NAND

De Morgan again A NAND gate: Y = A.B = A + B is the same as an OR gate with two NOT gates Similarly a NOR gate is the same as an AND gate with two inverters Y = A + B = A.B not the individual terms change the sign not the lot

Dual gates not the individual inputs change the gate not the output

Truth Tables and Boolean Notation NAND Gate Representation –It is possible to implement any boolean expression using only NAND gates XX NOT AND A B A.B OR A A+B B

Truth Tables and Boolean Notation NAND Gate representation –Implement the following circuit using only NAND gates x3 x2 x4 De Morgan can also be represented visually:

Exercise Implement NOT, AND and OR using NOR gates Example AND gate dual circuit:

Solution Similar pattern to using NAND gates (not surprising) NOT AND OR XX A B A.B A A+B B X X A B A.B A+B A A.B B

Truth Tables and Boolean Notation NOR Gate representation –It is also possible to implement any boolean expression using only NOR gates –Implement the following circuit using only NOR gates X4 X3 X2

Solution Two NOR gates in sequence acting as NOT ’ s can be eliminated: X4 X3 X2