Combinational Logic Chapter 4 1 Combinational Circuits Combinational Circuits • Adders • Subtractors • Comparators • Decoders • Encoders • Multiplexers Available as MSI Circuits and as Standard Cells in VLSI (Bonus Assignment: Get one example of each type of combinational circuits in the CMOS family, 5 points for the second exam) Analysis Procedure • Given a logical diagram, determine one or more of the following: – Boolean functions; – Truth table; – Explanation of circuit operation • Make sure the circuit is combinational, not sequential (No feedback loops) Analysis Procedure 1. Label all gate outputs that are a function of input variables. Determine the Boolean function for each gate output 2. Label the gates that are a function of input variables and previously labeled gates. Find the Boolean functions for these gates 3. Repeat step 2 until output of circuits are obtained 4. By repeated substitution of previously defined functions, obtain the output Boolean functions in terms of input variables Analysis Procedure Analysis Procedure Step 1 π2 = π΄π΅πΆ π1 = π΄ = π΅ + πΆ πΉ2 = π΄π΅ + π΄πΆ + π΅πΆ Step 2 π3 = πΉ2′ π1 πΉ1 = π3 + π2 Steps 3 and 4 πΉ1 = π3 + π2 = πΉ2′ + π΄π΅πΆ = π΄π΅ + π΄πΆ + π΅πΆ ′ π΄ + π΅ + πΆ + π΄π΅πΆ = π΄′ + π΅′ π΄′ + πΆ ′ π΅′ + πΆ ′ π΄ + π΅ + πΆ = π΄π΅πΆ = π΄′ + π΅′ πΆ ′ π΄π΅′ + π΄πΆ ′ + π΅πΆ ′ + π΅′ πΆ + π΄π΅πΆ = π΄′ π΅πΆ ′ + π΄′ π΅′ πΆ + π΄π΅′ πΆ ′ + π΄π΅πΆ Analysis Procedure 1. Determine the number of input variables in the circuit. For π inputs, form the 2π possible input combinations and list the binary numbers from 0 to 2π − 1in a table 2. Label the outputs of selected gates with arbitrary symbols 3. Obtain the truth table for the outputs of those gates which are a function of the input variables only 4. Proceed to obtain the truth table for the outputs of those gates which are a function of previously defined values until the columns for all outputs are determined Analysis Procedure Design Procedure 1. From the specifications of the circuit, determine the required number of inputs and outputs and assign a symbol to each 2. Derive the truth table that defines the required relationship between inputs and outputs 3. Obtain the simplified Boolean functions for each output as a function of the input variables 4. Draw the logical diagram and verify correctness of the design Code conversion example Code conversion example Code conversion example π§ = π·′ π¦ = πΆπ· + πΆ ′ π·′ = πΆπ· + πΆ + π·)′ π₯ = π΅′ πΆ + π΅′ π· + π΅πΆ ′ π·′ = π΅′ πΆ + π· + π΅πΆ ′ π·′ = π΅′ πΆ + π· + π΅(πΆ + π·)′ π€ = π΄ + π΅πΆ + π΅π· = π΄ + π΅(πΆ + π·) Code conversion example Binary Adder-Subtractor Half adder π = π₯ ′ π¦ + π₯π¦′ πΆ = π₯π¦ Half adder Full adder Full adder Implementation of full adder in sum-of-products π = π₯ ′ π¦ ′ π§ + π₯ ′ π¦π§ ′ + π₯π¦ ′ π§ ′ + π₯π¦π§ πΆ = π₯π¦ + π₯π§ + π¦π§ Full Adder Full adder Implementation of full adder using two half adders and one or gate π = π§ ⊕ (π₯ ⊕ π¦) = π§ ′ π₯π¦ ′ + π₯ ′ π¦ + π§(π₯π¦ ′ + π₯ ′ π¦)′ = π§ ′ π₯π¦ ′ + π₯ ′ π¦ + π§(π₯π¦ + π₯ ′ π¦ ′ ) = π₯π¦ ′ π§ ′ + π₯ ′ π¦π§ ′ + π₯π¦π§ + π₯ ′ π¦ ′ π§ πΆ = π§ π₯π¦ ′ + π₯ ′ π¦ + π₯π¦ = π₯π¦ ′ π§ + π₯ ′ π¦π§ + π₯π¦ Binary adder Carry propagation Full Adder with π and πΊ shown Carry Generate Carry propagation ππ = π΄π ⊕ π΅π πΊπ = π΄π π΅π ππ = ππ β¨πΆπ πΆπ+1 = πΊπ + ππ πΆπ πΆ0 = input carry πΆ1 = πΊ0 + π0 πΆ0 πΆ2 = πΊ1 + π1 πΆ1 = πΊ1 + π1 πΊ0 + ππ πΆ0 = πΊ1 + π1 πΊ0 + π1 π0 πΆ0 πΆ3 = πΊ2 + π2 πΆ2 = πΊ2 + π2 πΊ1 + π2 π1 πΊ0 + π2 π1 π0 πΆ0 Carry lookahead generator Four-bit adder with carry lookahead Carry lookahead generator Four-bit adder with carry lookahead Binary subtractor Overflow • Occurs only when adding two positive numbers or two negative numbers; • Overflow produces change in result sign Example: eight-bit adder Carry bits 0 1 1 0 +70 0 1000110 -70 1 0111010 +80 0 1010000 -80 1 0110000 +150 1 0010110 -150 0 1101010 Decimal Adder • Consider adding two decimal digits in BCD • Output sum cannot exceed 9+9+1=19 (the last 1 is the carry from previous digit) Decimal Adder Need correction Carry πΆ = πΎ + π8 π4 + π8 π2 Condition for correcting result Decimal Adder Binary Multiplier Exercise: Multiply 10 × 11 Explain how you carried the multiplication out. How many bits at the output? Binary Multiplier Two-bit multiplier Binary Multiplier Exercise: With your neighbor classmate discuss its operation. Magnitude Comparator Exercise: Discuss with your neighbor classmate and write down how you would compare two four-bit binary numbers π΄ and π΅, where π΄ = π΄3 π΄2 π΄1 π΄0 and π΅ = π΅3 π΅2 π΅1 π΅0 . You should have three outputs corresponding to π΄ = π΅, π΄ > π΅, and π΄ < π΅. Explain how you determined each condition. Magnitude Comparator Does this circuit correspond to what you wrote down in the exercise? Discuss again with your neighbor classmate the comparison of your result with this circuit. Decoders Exercise: Minimize the functions for two of the eight output lines. Decoders Exercise: Compare your function with the circuit. Three-to-eight-line decoder Decoders 0 Decoders 4 × 16 decoder constructed with two 3 × 8 decoders Exercise: Explain how this decoder works. Combinational logic implementation Exercise: For the maps of the full adder shown above, express the sum π (left) and the carry bit πΆ (right) as a sum of minterms. Combinational Logic Implementation π π₯, π¦, π§ = (1,2,4,7) πΆ π₯, π¦, π§ = (3,5,6,7) Compare in terms of propagation time and number of gates this Full Adder with the previously studied implementation. Encoders π§ = π·1 +π·3 +π·5 + π·7 π¦ = π·2 +π·3 +π·6 + π·7 π₯ = π·4 +π·5 +π·6 + π·7 Priority encoder Highest priority Valid output Priority encoder Exercise: obtain the function for π Priority encoder Multiplexers • Selects binary information from one of many input lines • Directs input line to output, controlled by a set of selection lines • 2π input lines and π selection lines Multiplexers Two-to-one-line multiplexer Multiplexers Four-to-one-line multiplexer Multiplexers Quadruple two-to-one-line multiplexer Boolean function implementation • Multiplexer is essentially a decoder with OR gates • Thus can implement Boolean functions, similar to decoders • Minterms generated by circuit associated with selection inputs • Individual minterms can be selected by data inputs • Boolean function of π variables and 2π data inputs Boolean function implementation • More efficient method for implementing a Boolean function of π variables with multiplexer of π − 1 selection inputs • Remaining variable of function is used for the data inputs Boolean function implementation • Example: πΉ π₯, π¦, π§ = (1,2,6,7) Selected input line 0 1 2 3 Implementation of a three-input Boolean function Boolean function implementation πΉ π΄, π΅, πΆ, π· = 0 1 2 3 4 5 6 7 (1,3,4,11,12,13,14,15) Three-state gates Three-state gates Multiplexers with three-state gates Homework Assignment • • • • • • 4.3 4.9 4.17 4.27 4.33 Using LogicWorks, simulate a 4-bit full adder with and without carry-lookahead.