Download presentation

Presentation is loading. Please wait.

Published bySade Hahn Modified over 3 years ago

1
CS2100 Computer Organisation http://www.comp.nus.edu.sg/~cs2100/ http://www.comp.nus.edu.sg/~cs2100/ Combinational Circuits (AY2014/5 Semester 2)

2
CS2100 Combinational Circuits 2 WHERE ARE WE NOW? Number systems and codes Boolean algebra Logic gates and circuits Simplification Combinational circuits Sequential circuits Performance Assembly language The processor: Datapath and control Pipelining Memory hierarchy: Cache Input/output Preparation: 2 weeks Logic Design: 3 weeks Computer organisation

3
CS2100 Combinational Circuits 3 COMBINATIONAL CIRCUITS Introduction Analysis Procedure Design Methods Gate-level (SSI) Design Block-Level Design Arithmetic Circuits Circuit Delays Look-Ahead Carry Adder

4
CS2100 Combinational Circuits 4 INTRODUCTION Two classes of logic circuits Combinational Sequential Combinational Circuit Each output depends entirely on the immediate (present) inputs. Combinational Logic : inputsoutputs: Sequential Circuit Each output depends on both present inputs and state. Memory Combinational Logic : inputsoutputs:

5
CS2100 Combinational Circuits 5 ANALYSIS PROCEDURE Given a combinational circuit, how do you analyze its function? Steps: 1. Label the inputs and outputs. ABAB F1 F2 A+B A'+B' = (A+B).(A'+B') = (A'+B')' = A B 2. Obtain the functions of intermediate points and the outputs. 3. Draw the truth table. 4. Deduce the functionality of the circuit AB(A+B)(A'+B')F1F2 000100 011110 101110 111001

6
CS2100 Combinational Circuits 6 DESIGN METHODS Different combinational circuit design methods: Gate-level design method (with logic gates) Block-level design method (with functional blocks) Design methods make use of logic gates and useful function blocks These are available as Integrated Circuit (IC) chips. Types of IC chips (based on packing density): SSI, MSI, LSI, VLSI, ULSI. Main objectives of circuit design: Reduce cost (number of gates for small circuits; number of IC packages for complex circuits) Increase speed Design simplicity (re-use blocks where possible)

7
CS2100 Combinational Circuits 7 GATE-LEVEL (SSI) DESIGN: HALF ADDER (1/2) Design procedure: 1.State problem Example: Build a Half Adder. 2.Determine and label the inputs and outputs of circuit. Example: Two inputs and two outputs labelled, as shown below. Half Adder XYXY SCSC (X + Y) 3.Draw the truth table. XYCS 0000 0101 1001 1110

8
CS2100 Combinational Circuits 8 GATE-LEVEL (SSI) DESIGN: HALF ADDER (2/2) 4.Obtain simplified Boolean functions. Example: C = X Y S = X' Y + X Y' = X Y 5. Draw logic diagram. XYCS 0000 0101 1001 1110 XYXY S C Half Adder

9
CS2100 Combinational Circuits 9 GATE-LEVEL (SSI) DESIGN: FULL ADDER (1/5) Half adder adds up only two bits. To add two binary numbers, we need to add 3 bits (including the carry). Example: Need Full Adder (so called as it can be made from two half adders). Full Adder XYZXYZ SCSC (X + Y + Z)

10
CS2100 Combinational Circuits 10 GATE-LEVEL (SSI) DESIGN: FULL ADDER (2/5) Truth table: Using K-map, simplified SOP form: C = ? S = ? Note: Z - carry in (to the current position) C - carry out (to the next position) 0 10 1 00 01 11 10 X YZ 111 1 C 0 10 1 00 01 11 10 X YZ 11 11 S XYZCS 00000 00101 01001 01110 10001 10110 11010 11111

11
CS2100 Combinational Circuits 11 GATE-LEVEL (SSI) DESIGN: FULL ADDER (3/5) Alternative formulae using algebraic manipulation: C= X Y + X Z + Y Z = X Y + (X + Y) Z = X Y + ( (X Y) + X Y ) Z = X Y + (X Y) Z + X Y Z = X Y + (X Y) Z S= X' Y' Z + X' Y Z' + X Y' Z' + X Y Z = X' (Y' Z + Y Z') + X (Y' Z' + Y Z) = X' (Y Z) + X (Y Z)' = X (Y Z)

12
CS2100 Combinational Circuits 12 GATE-LEVEL (SSI) DESIGN: FULL ADDER (4/5) Circuit for above formulae: C= X Y + (X Y) Z S= X (Y Z) = (X Y) Z (XOR is associative) Full Adder made from two Half-Adders (+ an OR gate). (X Y) XYXY S C Z (X Y)

13
CS2100 Combinational Circuits 13 GATE-LEVEL (SSI) DESIGN: FULL ADDER (5/5) Circuit for above formulae: C= X Y + (X Y) Z S= X (Y Z) Full Adder made from two Half-Adders (+ an OR gate). (X Y) XYXY S C Z (X Y) Half Adder Half Adder XYXY XYXY Sum Carry Sum Carry Block diagrams.

14
CS2100 Combinational Circuits 14 CODE CONVERTERS Code converter – takes an input code, translates to its equivalent output code. Code converter Input code Output code Example: BCD to Excess-3 code converter. Input: BCD code Output: Excess-3 code

15
CS2100 Combinational Circuits 15 BCD-TO-EXCESS-3 CONVERTER (1/2) Truth table: BCDExcess-3 ABCDWXYZ 000000011 100010100 200100101 300110110 401000111 501011000 601101001 701111010 810001011 910011100 101010XXXX 111011XXXX 121100XXXX 131101XXXX 141110XXXX 151111XXXX K-maps: 1 A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX 1 111 1 W 1 111 1 1 11 11 11 11 X YZ

16
CS2100 Combinational Circuits 16 BCD-TO-EXCESS-3 CONVERTER (2/2) 1 A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX 11 11 Z A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX1 111 1 W A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX 1 111 1 X A C 00 01 11 10 00 01 11 10 D AB CD B XXXX XX 1 11 11 Y W = ? X = ? Y = ? Z = ?

17
CS2100 Combinational Circuits 17 BLOCK-LEVEL DESIGN More complex circuits can also be built using block-level method. In general, block-level design method (as opposed to gate-level design) relies on algorithms or formulae of the circuit, which are obtained by decomposing the main problem to sub-problems recursively (until small enough to be directly solved by blocks of circuits). Simple examples using 4-bit parallel adder as building blocks: 1.BCD-to-Excess-3 Code Converter 2.16-bit Parallel Adder 3.Adder cum Subtractor

18
CS2100 Combinational Circuits 18 4-BIT PARALLEL ADDER (1/4) Consider a circuit to add two 4-bit numbers together and a carry-in, to produce a 5-bit result. 4-bit Parallel Adder C5C5 C1C1 X2X2 X1X1 Y4Y4 Y3Y3 S4S4 S3S3 S2S2 S1S1 Y2Y2 Y1Y1 X4X4 X3X3 Black-box view of 4-bit parallel adder 5-bit result is sufficient because the largest result is: 1111 2 + 1111 2 + 1 2 = 11111 2

19
CS2100 Combinational Circuits 19 4-BIT PARALLEL ADDER (2/4) SSI design technique should not be used here. Truth table for 9 inputs is too big: 2 9 = 512 rows! Simplification becomes too complicated! X4X3X2X1X4X3X2X1 Y4Y3Y2Y1Y4Y3Y2Y1 C1C1 C5C5 S4S3S2S1S4S3S2S1 0 0 00 100 0 0 1 0 0 0 0 0 100 …………… 0 1 1 1 0 1110 0 1 1 …………… 1 1 11

20
CS2100 Combinational Circuits 20 4-BIT PARALLEL ADDER (3/4) Alternative design possible. Addition formula for each pair of bits (with carry in), C i+1 S i = X i + Y i + C i has the same function as a full adder: C i+1 = X i Y i + (X i Y i ) C i S i = X i Y i C i 0 1 1011 001C = X = 1010 Y = 1111 X + Y =

21
CS2100 Combinational Circuits 21 4-BIT PARALLEL ADDER (4/4) Cascading 4 full adders via their carries, we get: C1C1 Y 1 X 1 S1S1 FA C2C2 C5C5 Y 2 X 2 S2S2 FA C3C3 Y 3 X 3 S3S3 FA C4C4 Y 4 X 4 S4S4 FA Output Input

22
CS2100 Combinational Circuits 22 PARALLEL ADDERS Note that carry is propagated by cascading the carry from one full adder to the next. Called Parallel Adder because inputs are presented simultaneously (in parallel). Also called Ripple-Carry Adder.

23
CS2100 Combinational Circuits 23 BCD-TO-EXCESS-3 CONVERTER (1/2) Excess-3 code can be converted from BCD code using truth table: BCDExcess-3 ABCDWXYZ 000000011 100010100 200100101 300110110 401000111 501011000 601101001 701111010 810001011 910011100 101010XXXX 111011XXXX 121100XXXX 131101XXXX 141110XXXX 151111XXXX Gate-level design can be used since only 4 inputs. However, alternative design is possible. Use problem-specific formula: Excess-3 code = BCD Code + 0011 2

24
CS2100 Combinational Circuits 24 BCD-TO-EXCESS-3 CONVERTER (2/2) Block-level circuit: 4-bit Parallel Adder X4X3X2X1X4X3X2X1 Y4Y3Y2Y1Y4Y3Y2Y1 00110011 S4S3S2S1S4S3S2S1 BCD code Excess-3 code unused 0 Cin Cout A BCD-to-Excess-3 Code Converter

25
CS2100 Combinational Circuits 25 16-BIT PARALLEL ADDER Larger parallel adders can be built from smaller ones. Example: A 16-bit parallel adder can be constructed from four 4-bit parallel adders: 4-bit // adder X 4..X 1 Y 4..Y 1 C1C1 S 4..S 1 4-bit // adder X 8..X 5 Y 8..Y 5 C5C5 S 8..S 5 4-bit // adder X 12..X 9 Y 12..Y 9 C9C9 S 12..S 9 4-bit // adder X 16..X 13 Y 16..Y 13 C 13 S 16..S 13 C 17 4444 44444444 A 16-bit parallel adder 4 S 4..S 1 S4S3S2S1S4S3S2S1 =

26
CS2100 Combinational Circuits 26 4-BIT ADDER CUM SUBTRACTOR (1/3) Recall: Subtraction can be done via addition with 2s- complement numbers. Hence, we can design a circuit to perform both addition and subtraction, using a parallel adder and some gates. 4-bit adder cum subtractor S: control signal for add/subtract X2X2 X1X1 Y4Y4 Y3Y3 Result: either X+Y or X-Y Y2Y2 Y1Y1 X4X4 X3X3 S=0 means Add S=1 means Subtract

27
CS2100 Combinational Circuits 27 4-BIT ADDER CUM SUBTRACTOR (2/3) Recall: X – Y = X + (-Y) = X + (2s complement of Y) = X + (1s complement of Y) + 1 Design requires: (1) XOR gates, and (2) S connected to carry-in.

28
CS2100 Combinational Circuits 28 4-BIT ADDER CUM SUBTRACTOR (3/3) 4-bit adder-cum-subtractor circuit: 4-bit parallel adder X2X2 X1X1 Y4Y4 Y3Y3 Y2Y2 Y1Y1 X4X4 X3X3 S2S2 S1S1 S4S4 S3S3 C S Cin Cout

29
CS2100 Combinational Circuits 29 REVISION: HALF ADDER Half adder X Y Cout Sum Carry Input bits Output bits x y' S = xy' + x'y x' y xyxy C xyxy S = (x+y)(x'+y') x' y' xyxy C x' y' S = (C+x'y')' xyxy C xyxy C S = x y

30
CS2100 Combinational Circuits 30 REVISION: FULL ADDER Full adder Sum Carry Input bits Output bits A B Cout Cin 0 10 1 00 01 11 10 x yz C = xy + xz + yz 111 1 1 S = x'y'z + x'yz' + xy'z' + xyz 0 10 1 00 01 11 10 x yz 1 1 1 xyxy S = (x y) z C = x y + (x y) z z xyxy xyxy X' y' z S x' y z' x y' z' xyzxyz C xzxz yzyz xyxy

31
CS2100 Combinational Circuits 31 REVISION: PARALLEL ADDER 4-bit parallel adder 2 ways: u Serial (one FA) u Parallel (n FAs for n bits) C1C1 Y 1 X 1 S1S1 C2C2 C5C5 Y 2 X 2 S2S2 C3C3 Y 3 X 3 S3S3 C4C4 Y 4 X 4 S4S4 FA X Y Cout S CinInput carry Binary no. B Binary no. A Output carry 4-bit sum

32
CS2100 Combinational Circuits 32 REVISION: CASCADING ADDERS Cascading 4 full adders (FAs) gives a 4-bit parallel adder. Classical method: 9 input variables 2 9 = 512 rows in truth table! Cascading method can be extended to larger adders. Example: 16-bit parallel adder. 4-bit // adder X 4..X 1 Y 4..Y 1 C1C1 S 4..S 1 4-bit // adder X 8..X 5 Y 8..Y 5 C5C5 S 8..S 5 4-bit // adder X 12..X 9 Y 12..Y 9 C9C9 S 12..S 9 4-bit // adder X 16..X 13 Y 16..Y 13 C 13 S 16..S 13 C 17 4444 44444444

33
CS2100 Combinational Circuits 33 EXAMPLE Application: 6-person voting system. Use FAs and a 4-bit parallel adder. Each FA can sum up to 3 votes. Voter 1 3-bit Output A B Cout Cin Voter 2 Voter 3 Voter 4 A B Cout Cin Voter 5 Voter 6 Full-adder 1 Full-adder 2 Cout Cin A 12341234 B 12341234 S 12341234 Parallel adder

34
CS2100 Combinational Circuits 34 MAGNITUDE COMPARATOR (1/4) Magnitude comparator: compares 2 values A and B, to check if A>B, A=B, or A

35
CS2100 Combinational Circuits 35 MAGNITUDE COMPARATOR (2/4) Let A = A 3 A 2 A 1 A 0, B = B 3 B 2 B 1 B 0 ; x i = A i B i + A i ' B i '

36
CS2100 Combinational Circuits 36 MAGNITUDE COMPARATOR (3/4) Block diagram of a 4-bit magnitude comparator A3A2A1A0A3A2A1A0 4-bit Comp (A < B) (A > B) (A = B) B3B2B1B0B3B2B1B0 01100110 10101010 ??????

37
CS2100 Combinational Circuits 37 MAGNITUDE COMPARATOR (4/4) A function F accepts a 4-bit binary value ABCD, and returns 1 if 3 ABCD 12, or 0 otherwise. How would you implement F using magnitude comparators and a suitable logic gate? A3A2A1A0A3A2A1A0 4-bit Comp (A < B) (A > B) (A = B) B3B2B1B0B3B2B1B0 A3A2A1A0A3A2A1A0 4-bit Comp (A < B) (A > B) (A = B) B3B2B1B0B3B2B1B0

38
CS2100 Combinational Circuits 38 CIRCUIT DELAYS (1/5) Given a logic gate with delay t. If inputs are stable at times t 1, t 2, …, t n, then the earliest time in which the output will be stable is: max( t 1, t 2, …, t n ) + t t1t1 Logic Gate t2t2 tntn :: max (t 1, t 2,..., t n ) + t To calculate the delays of all outputs of a combinational circuit, repeat above rule for all gates.

39
CS2100 Combinational Circuits 39 CIRCUIT DELAYS (2/5) As a simple example, consider the full adder circuit where all inputs are available at time 0. Assume each gate has delay t. XYXY S C Z 0 0 0

40
CS2100 Combinational Circuits 40 CIRCUIT DELAYS (3/5) More complex example: 4-bit parallel adder. C1C1 Y 1 X 1 S1S1 FA C2C2 C5C5 Y 2 X 2 S2S2 FA C3C3 Y 3 X 3 S3S3 FA C4C4 Y 4 X 4 S4S4 FA 0 00000000

41
CS2100 Combinational Circuits 41 CIRCUIT DELAYS (4/5) Analyse the delay for the repeated block. where X i, Y i are stable at 0t, while C i is assumed to be stable at mt. Full Adder XiYiCiXiYiCi S i C i+1 0 0 mt Performing the delay calculation: XiYiXiYi SiSi C i+1 CiCi max(0,0)+t = t t 0 0 mt max(t,mt)+t max(t,mt)+2t max(t,mt)+t

42
CS2100 Combinational Circuits 42 CIRCUIT DELAYS (5/5) Calculating: When i=1, m=0; S 1 = 2t and C 2 = 3t When i=2, m=3; S 2 = 4t and C 3 = 5t When i=3, m=5; S 3 = 6t and C 4 = 7t When i=4, m=7; S 4 = 8t and C 5 = 9t In general, an n-bit ripple-carry parallel adder will experience the following delay times: S n = ? C n+1 = ? Propagation delay of ripple-carry parallel adders is proportional to the number of bits it handles. Maximum delay: ?

43
CS2100 Combinational Circuits 43 FASTER CIRCUITS Three ways of improving the speed of circuits: Use better technology (eg. ECL faster than TTL gates) BUT Faster technology is more expensive, needs more power, lower-level of integrations Physical limits (eg. speed of light, size of atom) Use gate-level designs to two-level circuits! (use sum- of-products/product-of-sums) BUT Complicated designs for large circuits Product/sum terms need MANY inputs! Use clever look-ahead techniques BUT There are additional costs (hopefully reasonable).

44
CS2100 Combinational Circuits 44 LOOK-AHEAD CARRY ADDER (1/6) Consider the FA, where intermediate signals are labelled as P i and G i : P i = X i Y i G i = X i ∙Y i XiYiXiYi SiSi C i+1 CiCi PiPi GiGi The outputs C i+1, S i, in terms of P i, G i, C i are: S i = P i C i … (1) C i+1 = G i + P i ∙C i … (2) Looking at equation (2): G i = X i ∙Y i is a carry generate signal, and P i = X i Y i is a carry propagate signal.

45
CS2100 Combinational Circuits 45 LOOK-AHEAD CARRY ADDER (2/6) For 4-bit ripple-carry adder, the equations for the four carry signals are: C i+1 = G i + P i ∙C i C i+2 = G i+1 + P i+1 ∙C i+1 C i+3 = G i+2 + P i+2 ∙C i+2 C i+4 = G i+3 + P i+3 ∙C i+3 These formulae are deeply nested, as shown here for C i+2 : CiPiCiPi C i+1 GiGi P i+1 G i+1 C i+2 4-level circuit for C i+2 = G i+1 + P i+1.C i+1

46
CS2100 Combinational Circuits 46 LOOK-AHEAD CARRY ADDER (3/6) Nested formulae/gates cause more propagation delay. Reduce delay by expanding and flattening the formulae for carries. Example, for C i+2 : C i+2 = G i+1 + P i+1 ∙C i+1 = G i+1 + P i+1 ∙(G i + P i ∙C i ) = G i+1 + P i+1 ∙G i + P i+1 ∙P i ∙C i New faster circuit for C i+2 : C i P i P i+1 GiGi G i+1 C i+2

47
CS2100 Combinational Circuits 47 LOOK-AHEAD CARRY ADDER (4/6) Other carry signals can be similarly flattened: C i+3 = G i+2 + P i+2 ∙C i+2 = G i+2 + P i+2 ∙(G i+1 + P i+1 ∙G i + P i+1 ∙P i ∙C i ) = G i+2 + P i+2 ∙G i+1 + P i+2 ∙P i+1 ∙G i + P i+2 ∙P i+1 ∙P i ∙C i C i+4 = G i+3 + P i+3 ∙C i+3 = G i+3 + P i+3 ∙(G i+2 + P i+2 ∙G i+1 + P i+2 ∙P i+1 ∙G i + P i+2 ∙P i+1 ∙P i ∙C i ) = G i+3 + P i+3 ∙G i+2 + P i+3 ∙P i+2 ∙G i+1 + P i+3 ∙P i+2 ∙P i+1 ∙G i + P i+3 ∙P i+2 ∙P i+1 ∙P i ∙C i Note that formulae gets longer with higher carries. Also, all carries are two-level sum-of-products expressions, in terms of the generate signals Gs, the propagate signals Ps, and the first carry-in C i.

48
CS2100 Combinational Circuits 48 LOOK-AHEAD CARRY ADDER (5/6) We employ look- ahead formula in this lookahead-carry adder circuit:

49
CS2100 Combinational Circuits 49 LOOK-AHEAD CARRY ADDER (6/6) The 74182 IC chip allows faster lookahead adder to be built. Assuming gate delay is t, maximum propagation delay for circuit is hence 4t t to get generate and propagate signals 2t to get the carries t for the sum signals

50
CS2100 Combinational Circuits 50 QUICK REVIEW QUESTIONS DLD pages 128 - 129 Questions 6-1 to 6-4.

51
CS2100 Combinational Circuits 51 END

Similar presentations

OK

Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals.

Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on forward rate agreement formula Ppt on object-oriented programming tutorial Ppt on satellites launched by india Ppt on depth first search algorithms Download ppt on mahatma gandhi in hindi Ppt on product advertising in movies Ppt on waves tides and ocean currents images Ppt on nature and human relationship Ppt on ganga river system Ppt on right to education act in india