12.07.2015 Views

Lecture 2 - GUC - Faculty of Information Engineering & Technology

Lecture 2 - GUC - Faculty of Information Engineering & Technology

Lecture 2 - GUC - Faculty of Information Engineering & Technology

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ELCT201: Digital Logic Design<strong>Lecture</strong> 2Dr. Eng. Ahmed H. MadianE-mail: ahmed.madian@guc.edu.egDr. Eng. Rania SwiefEmail: rania.swief@guc.edu.egDr. Eng. Eman AzabEmail: eman.azab@guc.edu.egElectronics Department,<strong>Faculty</strong> <strong>of</strong> <strong>Information</strong> <strong>Engineering</strong> and<strong>Technology</strong> (IET)1


Elect 201: Course outlines• Introduction– Boolean Algebra and logic gates• Gate-Level Minimization• Combinational Logic• Synchronous Sequential Logic• Registers and Counters• Memory and Programmable LogicDr. Eng. Ahmed H. Madian 2


Basic Logic gates• We have defined three basic logic gates and operators•we could build any digital circuit from those basic logicgates.• In digital Logic, we are not using normal mathematicswe are using Boolean algebraDr. Eng. Ahmed H. Madian 3


So, I’m familiar now with Boolean Algebra howit would help me to build logic circuits?If you want to build a logic circuits, you musthave a Boolean function to represent it withlogic gatesDr. Eng. Ahmed H. Madian 4


BOOLEAN Function• We can use these basic operations to form more complex expressions:• Some terminology and notation:– f is the name <strong>of</strong> the function.f(x,y,z) = (x + y)z + x– (x,y,z) are the input variables, each representing 1 or 0. Listing theinputs is optional, but sometimes helpful.– A literal is any occurrence <strong>of</strong> an input variable or its complement. Thefunction above has four literals: x, y, z, and x.• Precedences are important, but not too difficult.– NOT has the highest precedence, followed by AND, and then OR.– Fully parenthesized, the function above would be kind <strong>of</strong> messy:f(x,y,z) = (((x +(y))z) + x)Dr. Eng. Ahmed H. Madian 55


EXPRESSIONS AND CIRCUITS• Any Boolean expression can be converted into a circuit bycombining basic gates in a relatively straightforward way.• The diagram below shows the inputs and outputs <strong>of</strong> each gate.• The precedence are explicit in a circuit. Clearly, we have to makesure that the hardware does operations in the right order!(x + y’)z + x’Dr. Eng. Ahmed H. Madian 6


Algebraic Forms( A way to represent any function)Sum <strong>of</strong> Products (SOP)Product <strong>of</strong> Sums (POS)Dr. Eng. Ahmed H. Madian 7


Sum <strong>of</strong> Products (SOP)Switching functions formed by SUMMING(ORing) PRODUCT (ANDed) terms.Example:Sum termsF A, B, C,D ABC BD ACDliterals(product terms)Dr. Eng. Ahmed H. Madian 8


Sum-<strong>of</strong>-products• Product terms are known as mintermF = 001 011 101 110 111F =A'B'C+ A'BC+ AB'C + ABC' + ABCA B C F000001010 1 0 00 1 1 11 0 0 01 0 1 111110111Apostrophe ’ here means invertDr. Eng. Ahmed H. Madian 9


Sum-<strong>of</strong>-products (cont.)• Product term (or minterm)– ANDed product– input combination for which output is true– Each variable appears exactly once, in true or inverted form(but not both)From the pervious example:A B C minterms0 0 0 0 A'B'C' m00 0 1 1 A'B'C m10 1 0 0 A'BC' m20 1 1 1 A'BC m31 0 0 0 AB'C' m41 0 1 1 AB'C m51 1 0 1 ABC' m61 1 1 1 ABC m7short-hand notation forminterms <strong>of</strong> 3 variablesF in canonical form:F(A, B, C) = m(1,3,5,6,7)= m1 + m3 + m5 + m6 + m7= A'B'C + A'BC + AB'C + ABC' + ABCcanonical form minimal formF(A, B, C) = A'B'C + A'BC + AB'C + ABC + ABC'= (A'B' + A'B + AB' + AB)C + ABC'= ((A' + A)(B' + B))C + ABC'= C + ABC'= ABC' + C= AB + CDr. Eng. Ahmed H. Madian 10


How to build a circuit from the (SOP) function?F = A'B'C + A'BC + AB'C + ABC' + ABCAnswerSOPAND/OR Two-level ImplementationDr. Eng. Ahmed H. Madian 11


Product <strong>of</strong> Sums (POS)Switching functions formed by taking the PRODUCT(ANDing) <strong>of</strong> SUM (ORed) terms.Example:Literals(Sum terms) , , , F A B C D A B C B D A C DProductsDr. Eng. Ahmed H. Madian 12


Product-<strong>of</strong>-sums• Sum terms are known as MaxtermA B C F0 0 0 00 0 1 10 1 0 00 1 1 11 0 0 01 0 1 111110111F = 000 010 100F = (A + B + C) (A + B' + C) (A' + B + C)Dr. Eng. Ahmed H. Madian 13


Product-<strong>of</strong>-sums (cont’d)• Sum term (or maxterm)– ORed sum <strong>of</strong> literals – input combination for whichoutput is false– each variable appears exactly once, in true or invertedform (but not both)A B C maxterms0 0 0 A+B+C M00 0 1 A+B+C' M10 1 0 A+B'+C M20 1 1 A+B'+C' M31 0 0 A'+B+C M41 0 1 A'+B+C' M51 1 0 A'+B'+C M61 1 1 A'+B'+C' M7short-hand notation forMaxterms <strong>of</strong> 3 variablesF in canonical form:F(A, B, C) = M(0,2,4)= M0 • M2 • M4= (A + B + C) (A + B' + C) (A' + B + C)canonical form minimal formF(A, B, C) = (A + B + C) (A + B' + C) (A' + B + C)= (A + B + C) (A + B' + C)(A + B + C) (A' + B + C)= (A + C) (B + C)Dr. Eng. Ahmed H. Madian 14


How to build a circuit from the (POS) function?F(A, B, C) = (A + B + C) (A + B' + C) (A' + B + C)AnswerPOS OR/AND Two-level ImplementationDr. Eng. Ahmed H. Madian 15


SOP and POS Represent the samefunctionA B C F000001010 1 0 0011010101 0 1 111110111• F=m(1,3,5,6,7)F=M(0,2,4)Dr. Eng. Ahmed H. Madian 16


POS vs. SOP• Any expression can be written either way• Can convert from one to another using theorems• Sometimes SOP looks simpler– AB + CD = ( A + C )( B + C )( A + D )( B + D )• Sometimes POS looks simpler– (A + B)(C + D) = BD + AD + BC + AC• SOP will be most commonly usedDr. Eng. Ahmed H. Madian 17


Boolean Expression from a Logic Circuit• To derive the Boolean expression for agiven logic circuit, begin at the left-mostinputs and work toward the final output,writing the expression for each gate.CDBCDB+CDAA(B+CD)Dr. Eng. Ahmed H. Madian 19


Elect 201: Course outlines• Introduction– Boolean Algebra and logic gates• Gate-Level Minimization• Combinational Logic• Synchronous Sequential Logic• Registers and Counters• Memory and Programmable LogicDr. Eng. Ahmed H. Madian 20


Minimization <strong>of</strong> Logic Functions• We have chips with millions <strong>of</strong> gates– Why care about minimizing a function?– What do a few gates matter?• Basic logic functions replicated thousands <strong>of</strong> times– Saving one gate for a memory cell pays <strong>of</strong>f• What is the criterion for “minimization”– Should we minimize• Number <strong>of</strong> product terms?• Number <strong>of</strong> logic operations?• Number <strong>of</strong> variables (literals)?• Number <strong>of</strong> wires?• …?• For implementation: minimize number <strong>of</strong> gatesDr. Eng. Ahmed H. Madian 21


How to Minimize Gate Count?• Example:– F=A’BC’+AB’C’+AB’C+ABC’= Σm(2,4,5,6)• How many gates do we need for implementation?– If AND gates have 3 inputs and OR gates have 4inputs?– If all gates are binary (2 inputs)?• Are there any tricks we can use?– Combine minterms:• A’BC’+ABC’=BC’• AB’C’+AB’C=AB’• F = BC’+AB’– How many gates does F need now?• This mainly depend on your experience but, Weneed systematic approach to minimize expression– Answer: Karnaugh maps (K-maps)Dr. Eng. Ahmed H. Madian 22


Karnaugh Maps• Karnaugh maps (K-maps) are graphical representations <strong>of</strong>Boolean functions.• One map cell corresponds to a row in the truth table.• Also, one map cell corresponds to a minterm or a maxterm inthe boolean expression• Multiple-cell areas <strong>of</strong> the map correspond to standard terms.x y minterm0 0 m 00 1 m 11 0 m 21 1 m 3Dr. Eng. Ahmed H. Madian 23


Two-Variable Map11010 x y 0 1m 02 3m 2m 1m 3OR010 y x 0 2m 01 3m 1m 2m 3NOTE: ordering <strong>of</strong> variables is IMPORTANT for f(x,y),x is the row, y is the column.Cell 0 represents x’y’; Cell 1 represents x’y; etc.If a minterm is present in the function, then a 1 isplaced in the corresponding cell.Dr. Eng. Ahmed H. Madian 24


Boolean Function in Karnaugh Map• 1s and 0s represent function in Karnaugh map– 1 represent On-set (F=1), 0 represents Off-set (F=0)– Similar to truth table– 0 s are typically not shownx y fx y f0 0 00 1 01 0 00 0 00 1 11 0 11 1 11 1 1Dr. Eng. Ahmed H. Madian 25


Two-Variable Map• Any two adjacent cells in the map differ by ONLY onevariable, which appears complemented in one cell anduncomplemented in the other.• Example:m 0 (=x’y’) is adjacent to m 1 (=x’y) this means thatx’y’ +x’y= x’(y’+y)=x’• Also m 0 (=x’y’) is adjacent to m 2 (=xy’)x’y’ +xy’= y’(x’+x)=y’• but m 0 (=x’y’) is NOT adjacent m 3 (=xy)Dr. Eng. Ahmed H. Madian 26


2-Variable Map -- Example• f(x 1 ,x 2 ) = x 1 ’x 2 ’+ x 1 ’x 2 + x 1 x 2 ’= m 0 + m 1 + m 2= x 1 ’ + x 2 ’• 1s placed in K-map for specifiedminterms m 0 , m 1 , m 2• Grouping (ORing) <strong>of</strong> 1s allowssimplification• What (simpler) function is representedby each dashed rectangle?– x 1 ’ = m 0 + m 1– x 2 ’ = m 0 + m 2• Note m 0 covered twicex 20 1x 1 0 10 1 12 31 1 0Dr. Eng. Ahmed H. Madian 27


3-variable Karnaugh Map• Karnaugh map with 3 variables:– Two variables on one side, one on the other– Note Gray code sequence (single variable change)facilitates grouping <strong>of</strong> 1-entries into logic blocks• Note that the minterms are not arranged in a binarysequence, but similar to the Gray code.• For simplifying Boolean functions, we must recognize thebasic property possessed by adjacent squares.• m 5 +m 7 = xy’z + xyz = xz(y’ + y) = xz cancelDr. Eng. Ahmed H. Madian 28


Blocks in Karnaugh Maps• Identifying blocks in Karnaugh maps– Neighboring minterms can be combined:• x’y’z’ + x’y’z = x’y’(z’+z) = x’y’– Resulting expression uses fewer literals(z no longer present)Dr. Eng. Ahmed H. Madian 29


3-Variable Mapxyz00011110010 1 3 2m 0 m 1 m 34 5 7 6m 4 m 5 m 7m 2m 6-Note: variable ordering is (x,y,z); yz specifies column, xspecifies row.-Each cell is adjacent to three other cells (left or right or topor bottom or edge wrap)Dr. Eng. Ahmed H. Madian 30


3-Variable Map (cont.)The types <strong>of</strong> structures that areeither minterms or are generatedby repeated application <strong>of</strong> theminimization theorem on a threevariable map are shown at right.Groups <strong>of</strong> 1, 2, 4, 8 are possible.mintermgroup <strong>of</strong> 2 termsgroup <strong>of</strong> 4 termsDr. Eng. Ahmed H. Madian 31


Example: Blocks in Karnaugh Maps• Example:– F(x,y,z) = Σ(2,3,4,5) = x’yz’+x’yz+xy’z’+xy’z– Two blocks <strong>of</strong> size 2:F = x’y + xy’Dr. Eng. Ahmed H. Madian 32


Example: Blocks in Karnaugh Maps• What is the Karnaugh map for– F(x,y,z) = Σ(3,4,6,7) ?• Block can continue across “borders”, wrap around– Left to right– Top to bottomDr. Eng. Ahmed H. Madian 33


Blocks in Karnaugh Maps• Can we combine more than two minterms?• Yes: x’y’z’+x’y’z+xy’z’+xy’z = (x’+x)y’(z’+z) = y’• Any block that is “power <strong>of</strong> 2 size” can be reduced– Needs to be filled entirely with 1s• Largest possible block yields simplest expressionDr. Eng. Ahmed H. Madian 34


• Example:Overlapping BlocksF(A,B,C) = Σ(1,2,3,5,7)Blocks can overlap– Still find the largest possible power-2 blocksDr. Eng. Ahmed H. Madian 35


Converting Blocks into Expressions• How to convert blocks into algebraic expressions?• Write down the variables that do not change– Example: F(A,B,C) = C + A’BDr. Eng. Ahmed H. Madian 36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!