combinational logic n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Combinational Logic PowerPoint Presentation
Download Presentation
Combinational Logic

Loading in 2 Seconds...

play fullscreen
1 / 98

Combinational Logic - PowerPoint PPT Presentation


  • 225 Views
  • Updated on

Combinational Logic. Logic and Digital System Design - CS 303 Erkay Savaş Sabanc ı University. Classification. Combinational no memory outputs depends on only the present inputs expressed by Boolean functions Sequential storage elements + logic gates

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

Combinational Logic


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    1. Combinational Logic Logic and Digital System Design - CS 303 Erkay Savaş Sabancı University

    2. Classification • Combinational • no memory • outputs depends on only the present inputs • expressed by Boolean functions • Sequential • storage elements + logic gates • the content of the storage elements define the state of the circuit • outputs are functions of both input and current state • state is a function of previous inputs • outputs not only depend the present inputs but also the past inputs

    3. Combinational Circuits Combinational circuit (logic gates) n binary inputs m binary outputs • n input bits  2n possible binary input combinations • For each possible input combination, there is one possible output value • truth table • Boolean functions (with n input variables) • Examples: adders, subtractors, comparators, decoders, encoders, and multiplexers.

    4. Analysis & Design of Combinational Logic • Analysis: to find out the function that a given circuit implements • We are given a logic circuit and • we are expected to find out • Boolean function(s) • truth table • A possible explanation of the circuit operation (i.e. what it does) • Firstly, make sure that the given circuit is, indeed, combinational.

    5. Analysis of Combinational Logic • Verifying the circuit is combinational • No memory elements • No feedback paths (connections) • Secondly, obtain a Boolean function for each output or the truth table • Lastly, interpret the operation of the circuit from the derived Boolean functions or truth table • What is it the circuit doing? • Addition, subtraction, multiplication, etc.

    6. Obtaining Boolean Function a F1 b c a b c a b F2 a c b c Example T1 T2 T4 T3

    7. Example: Obtaining Boolean Function • Boolean expressions for named wires • T1 = abc • T2 = a + b + c • F2 = ab + ac + bc • T3 = F2’ = (ab + ac + bc)’ • T4 = T3T2 = (ab + ac + bc)’ (a + b + c) • F1 = T1 + T4 = abc + (ab + ac + bc)’ (a + b + c) = abc + ((a’ + b’)(a’ + c’)(b’ + c’)) (a + b + c) = abc + ((a’ + a’c’ + a’b’ + b’c’)(b’ + c’)) (a + b + c) = abc + (a’b’ + a’c’ + a’b’c’ + b’c’)(a+b+c)

    8. Example: Obtaining Boolean Function • Boolean expressions for outputs • F2 = ab + ac + bc • F1 = abc + (a’b’ + a’c’ + b’c’) (a + b + c) • F1 = abc + a’b’c + a’bc’ + ab’c’ • F1 = a(bc + b’c’) + a’(b’c + bc’) • F1 = a(b  c)’ + a’(b  c) • F1 =

    9. Example: Obtaining Truth Table • F1 = • F2 = ab + ac + bc carry sum This is what we call full-adder (FA)

    10. Design of Combinational Logic • Design Procedure: • We start with the verbal specification about what the resulting circuit will do for us (i.e. which function it will implement) • Specifications are often verbal, and very likely incomplete and ambiguous (if not faulty) • Wrong interpretations can result in incorrect circuit • We are expected to find • firstly, Boolean function(s) (or truth table) to realize the desired functionality • Logic circuit implementing the Boolean function(s) (or the truth table)

    11. Possible Design Steps • Find out the number of inputs and outputs • Derive the truth table that defines the required relationship between inputs and outputs • Obtain asimplified Boolean function for each output • Draw the logic diagram (enter your design into CAD) • Verify the correctness of the design

    12. Design Constraints • From the truth table, we can obtain a variety of simplified expressions • Question: which one to choose? • The design constraints may help in the selection process • Constraints: • number of gates • propagation time of the signal all the way from the inputs to the outputs • number of inputs to a gate • number of interconnections • power consumption • driving capability of each gate

    13. Example: Design Process • BCD-to-2421 Converter • Verbal specification: • Given a BCD digit (i.e. {0, 1, …, 9}), the circuit computes 2421 code equivalent of the decimal number • Step 1: how many inputs and how many outputs? • four inputs and four outputs • Step 2: • Obtain the truth table • 0000  0000 • 1001  1111 • etc.

    14. BCD-to-2421 Converter • Truth Table

    15. BCD-to-2421 Converter CD AB 00 01 11 10 00 0 0 0 0 01 0 1 1 1 11 10 1 1 • Step 3: Obtain simplified Boolean expression for each output • Output x: x = BD +BC + A

    16. Output y: Boolean Expressions for Outputs • Output z:

    17. Boolean Expressions for Outputs • Step 4: Draw the logic diagram • Output t: t = D x = BC + BD + A y = A + BD’ + BC z = A + B’C + BC’D

    18. Example: Logic Diagram A B x = BC + BD + A C D y = A + BD’ + BC z = A + B’C + BC’D t = D

    19. Example: Verification • Step 5: Check the functional correctness of the logic circuit • Apply all possible input combinations • And check if the circuit generates the correct outputs for each input combinations • For large circuits with many input combinations, this may not be feasible. • Statistical techniques may be used to verify the correctness of large circuits with many input combinations

    20. Binary Adder/Subtractor • (Arithmetic) Addition of two binary digits • 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, and 1 + 1 = 10 • The result has two components • the sum (S) • the carry (C) • (Arithmetic) Addition of three binary digits

    21. Half Adder x S y C • Truth table S = x’y + xy’ = x  y C = xy HA HA

    22. Full Adder 1/2 • A circuit that performs the arithmetic sum of three bits • Three inputs • the range of output is [0, 3] • Two binary outputs

    23. Full Adder 2/2 • Karnaugh Maps S = xy’z’ + x’y’z + xyz + x’yz’ = ... = ... = x  y  z C = xy + xz + yz Two level implementation 1st level: three AND gates 2nd level: One OR gate

    24. Full Adder: Hierarchical Realization x HA S HA S y C C C z • Sum • S = x  y  z • Carry • C = xy + xz + yz = (x + y) z + xy = (x  y) z + xy • This allows us to implement a full-adder using two half adders. x  y  z = S

    25. Full Adder Using Half Adders HA HA x y S C z

    26. Integer Addition 1/2 a0 b0 a1 b1 a2 b2 a3 b3 HA y FA x FA y y FA y x x x C1 C2 C3 C4 C z z z C C C S S S S S0 S1 S2 S3 • Binary adder: • A digital circuit that produces the arithmetic sum of two binary numbers • A = (an-1, an-2, …, a1, a0) • B = (bn-1, bn-2, …, b1, b0) • A simple case: 4-bit binary adder

    27. Integer Addition 2/2 a0 b0 a1 b1 a2 b2 a3 b3 FA y FA x FA y y FA y x x x C0=0 C1 C2 C3 C4 z C z z z C C C S S S S S0 S1 S2 S3 Ripple-carry adder

    28. Hierarchical Design Methodology • The design methodology we used to build carry-ripple adder is what is referred as hierarchical design. • In classical design, we have: • 9 inputs including C0. • 5 outputs • Truth tables with 29 = 512 entries • We have to optimize five Boolean functions with 9 variables each. • Hierarchical design • we divide our design into smaller functional blocks • connect functional units to produce the big functionality

    29. Full Adder in Xilinx

    30. Two-bit Adder in Xilinx

    31. Recall how we do subtraction (2’s complement) X – Y = X + (2n – Y) = X + ~Y + 1 Subtractor x0 y0 x2 x1 y1 x3 y3 y2 logic-1 4-bit adder circuit a3 b3 a2 b2 a1 b1 a0 b0 C4 C0 S3 S0 S1 S2 S3 S0 S1 S2 C4

    32. Overflow • How to detect overflows: • two n-bit numbers • we add them, and result may be an (n+1)-bit number  overflow. • Unsigned numbers: • easy • check the carryout. • Signed numbers • more complicated • overflow occurs in addition, when the operands are of the same sign

    33. Examples: Overflows …11 …00 0 1 0 1 0 1 1 0 1 0 1 1 0 0 0 0 -68 68 …00 …11 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 1 91 -91 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 1 • Example 1: 8-bit signed numbers …00 159 • Example 2: 8-bit signed numbers …11 -159

    34. How to Detect Overflows: • First Method • If both operands are positive and the MSB of the result is 1. • If both operands are negative and the MSB of the result is 0.

    35. Detecting Overflows: First Method • V = an-1’ bn-1’ Sn-1 + an-1 bn-1 Sn-1’ • Can we do it better?

    36. Detecting Overflows …11 …00 0 1 0 1 0 1 1 0 1 0 1 1 0 0 0 0 A A …11 …00 0 1 1 0 0 1 0 1 1 0 0 1 0 1 1 1 B B 0 0 C C …00 …11 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 1 S S • Second method: • Remember we have other variables when adding: • Carries Look at C7and C8 in both cases

    37. Detecting Overflows: Second Method • Observations • Case 1: V = 1 when C7 = 1 and C8 = 0 • Case 2: V = 1 when C7 = 0 and C8 = 1 • V = C7 C8 = 1 • Think about whether this could happen when the operands have different signs. • C7= C8 • Overflow detection logic • Which one is simpler? • V = C7 C8 • V = a7’ b7’ S7 + a7 b7 S7’

    38. Faster Adders a0 b0 a1 b1 a2 b2 a3 b3 FA y FA x FA y y FA y x x x C0=0 C1 C2 C3 C4 z C z z z C C C S S S S S0 S1 S2 S3 Ripple-carry adder • What is the total propagation time of 4-bit ripple-carry adder? • FA: propagation time of a single full adder. • We have four full adders connected in cascaded fashion • Total propagation time: ??

    39. Carry Propagation ai bi Si Ci+1 Ci • Propation time of a full adder • XOR 2AND= 2OR • FA 2XOR Pi Gi

    40. Carry Propagation a0 a3 a2 a1 b3 b1 b2 b0 C0 P0 P1 C1 P2 C2 P3 C3 C1 C3 C2 C4 S1 S3 S2 S0 • Delays • P0, P1, P2, P3: XOR 2AND • C1(S0):  2AND + 2AND  4AND • C2(S1):  4AND + 2AND  6AND • C3(S2):  6AND + 2AND  8AND • C4(S3):  8AND + 2AND  10AND

    41. Faster Adders • The carry propagation technique is a limiting factor in the speed with which two numbers are added. • Two alternatives • use faster gates with reduced delays • Increase the circuit complexity (i.e. put more gates) in such a way that the carry delay time is reduced. • An example for the latter type of solution is carry lookahead adders • Two binary variables: • Pi = ai bi – carry propagate • Gi = aibi – carry generate

    42. Carry Lookahead Adders • Sum and carry can be expressed in terms of Pi and Gi: • Pi = ai bi; Gi = aibi • Si = Pi Ci • Ci+1 = Gi + PiCi • Why the names (carry propagate and generate)? • If Gi = 1 (both ai= bi = 1), then a “new” carry is generated • If Pi = 1 (either ai= 1 or bi = 1), then a carry coming from the previous lower bit position is propagated to the next higher bit position

    43. Generating Pi and Gi Signals a3 b3 • Example: 4-bit operands P3 G3 a2 P2 b2 G2 a1 P1 b1 G1 a0 P0 b0 G0

    44. 4-bit Carry Lookahead Adder • We can use the carry propagate and carry generate signals to compute carry bits used in addition operation • C0 = input • C1 = G0 + P0C0 • C2 = G1 + P1C1 = G1 + P1(G0 + P0C0) = G1 + P1G0 + P1P0C0 • C3 = G2 + P2C2 = G2 + P2(G1 + P1G0 + P1P0C0) = G2 + P2G1 + P2P1G0 + P2P1P0C0 • C4 =

    45. 4-bit Carry Lookahead Circuit 1/3 C3 P2 G2 C2 P1 G1 C1 P0 G0 C0 C1 = G0 + P0C0 C2 = G1 + P1G0 + P1P0C0 C3 = G2 + P2G1 + P2P1G0 + P2P1P0C0

    46. 4-bit Carry Lookahead Circuit 2/3 • All three carries (C1, C2, C3) can be realized as two-level implementation (i.e. AND-OR) • C3 does not have to wait for C2 and C1 to propagate • C3 has its own circuit • The propagations happen concurrently • Certain parts are repeated.

    47. 4-bit Carry Lookahead Circuit 3/3 • Two levels of logic

    48. 4-bit Carry Lookahead Adder a3 Carry Lookahead circuit P3 C4 C4 b3 G3 P3 S3 C3 a2 P2 b2 G2 P2 S2 C2 a1 P1 b1 P1 G2 S1 C1 a0 P0 b0 G0 P0 S0 C0 C0 C0

    49. Propagation Time of Carry Lookahead Adders P2 P1 P0 C0 P2 P1 C3 G0 P2 G1 G2 P2 P1 P0 a1 C0 b1 C3 P2 S3 P1 G0 P3 P2 G1 G2 XOR =2AND = 2OR

    50. Generating C4 Delay 3.5 XOR Area: 14 gates C0 P0 P1 P2 P3 G0 P1 P2 P3 G1 P2 P3 G2 P3 C4 G3