Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 2007 L15: Combinational Circuits Lecture 15: Combinational Circuits Complete logic functions Some combinational logic functions –Half adders –Adders.

Similar presentations


Presentation on theme: "Fall 2007 L15: Combinational Circuits Lecture 15: Combinational Circuits Complete logic functions Some combinational logic functions –Half adders –Adders."— Presentation transcript:

1 Fall 2007 L15: Combinational Circuits Lecture 15: Combinational Circuits Complete logic functions Some combinational logic functions –Half adders –Adders –Multiplexers –Decoders –Parity generators Signal propagation in combinational logic ALUs

2 Fall 2007 L15: Combinational Circuits Complete Logic Functions A logic gate is considered to be a complete logic function if we can use just that one type of gate to implement any logic function (i.e., NOT, AND, OR, NAND, and NOR) NAND and NOR functions (each by themselves) are complete logic functions Why would you be interested in complete logic functions or using just one type of logic gate in your design?

3 Fall 2007 L15: Combinational Circuits NOT AND NAND NAND Represents a Complete Logic Function A A B A B

4 Fall 2007 L15: Combinational Circuits NAND Represents a Complete Logic Function (cont.) OR NOR A B A B

5 Fall 2007 L15: Combinational Circuits Example A’ + B’ + C Circuit design using NOTs and ORs “Brute force” substitution of NAND gates We can make it a little simpler - how about applying DeMorgan’s Law first? A’ + B’ = (AB)’

6 Fall 2007 L15: Combinational Circuits Another Example AB + B’C A B C

7 Fall 2007 L15: Combinational Circuits Combinational Logic and Digital Devices Now that we’ve learned how to implement a logic expression in a logic-gate-level design, we can start putting those functions together to form more complex (and useful!) functions Digital logic that is designed so that the outputs are dependent only upon the current set of inputs is called COMBINATIONAL LOGIC

8 Fall 2007 L15: Combinational Circuits Examples of Combinational Digital Logic Functions Multiplexers Decoders Parity Generators Adders –Half adders –Full adders –32-bit adders Shifters Comparators Arithmetic Logic Units

9 Fall 2007 L15: Combinational Circuits Half Adder Consists of: –2 inputs –2 outputs Sum Carry Used for basic integer addition ( 1 bit) Input A Carry 00 1 1 Input B 0 0 0 0 10 01 Sum 0 1 1 1

10 Fall 2007 L15: Combinational Circuits Half Adder Logic Design A B Sum Carry

11 Fall 2007 L15: Combinational Circuits Full Adder Consists of: –3 inputs A B Carry in –2 outputs Sum Carry out Typical application: link together multiple full adders to add integers containing more than one bit Input A Sum 00 0 1 Input B 0 1 1 0 01 11 Carry In 0 0 0 0 1 1 1 1 1 1 11 00 0 0 0 0 1 1 Carry Out 0 0 0 1 1 1 0 1

12 Fall 2007 L15: Combinational Circuits Full Adder Logic Design A B Sum Carry Out Carry In

13 Fall 2007 L15: Combinational Circuits Integer Addition Using Full Adder Circuits Full Adder A1A1 B1B1 Sum 1 Carry OutCarry In Full Adder A0A0 B0B0 Sum 0 Carry OutCarry In “0” Adding two binary numbers, each containing two bits C 1 C 0 A(A 1,A 0 ) +B(B 1,B 0 ) _____________ Sum(C 1,S 1,S 0 )

14 Fall 2007 L15: Combinational Circuits Longer Chains of Adders Add Longer Integers Full Adder A3A3 B3B3 Sum 3 Carry Full Adder A2A2 B2B2 Sum 2 Carry Full Adder A1A1 B1B1 Sum 1 Carry Full Adder A0A0 B0B0 Sum 0 Carry “0”

15 Fall 2007 L15: Combinational Circuits Multiplexers Consist of: –2 n data inputs –One output –n control inputs Used to control the selection of a single output from n different inputs Typical application: parallel to serial converter D0D0 D1D1 D2D2 D3D3 A B Out 4 input multiplexer

16 Fall 2007 L15: Combinational Circuits Multiplexor Details

17 Fall 2007 L15: Combinational Circuits Decoders Consist of: –n inputs –2 n outputs Used to select a single (one) output line Typical application: selecting a memory chip D0D0 D1D1 D2D2 D3D3 A B 2 to 4 decoder

18 Fall 2007 L15: Combinational Circuits Parity Generator Consist of: –n inputs –1 output Used to create a parity bit for a given set of inputs A B Output C D Even parity for 4 inputs

19 Fall 2007 L15: Combinational Circuits Arithmetic Logic Units (ALUs) The ALU is the math engine for modern digital computers

20 Fall 2007 L15: Combinational Circuits A Very Simple ALU Performs four functions: A.AND. B (A & B) //bitwise AND A.OR. B (A | B) //bitwise OR NOT.B (~ B) //bitwise NOT A + B (A + B) //addition operator Operates on single bits “A” and “B”

21 Fall 2007 L15: Combinational Circuits Block Diagram for a Very Simple, 1-Bit ALU Logic Unit (AND, OR, NOT) A B Full Adder 2 to 4 Decoder Output Carry Out Carry In Enable A Enable B Inv A F1 F0 Sum A B En OR En AND En NOT En ADD A B

22 Fall 2007 L15: Combinational Circuits 1-Bit Slice ALU Example Four Functions (AND, OR, NOT B, ADDITION) for single bits A i and B i Inputs –INV A Inverse of A i –AThe single bit A i –ENAEnable the A input –BThe single bit B i –ENBEnable the B input –FOControl signal 0 –F1Control signal 1 –Carry InCarry-in signal (usually the carry out signal from the previous state) Outputs –OutputResult of ALU computation –Carry OutCarry out signal from full adder circuit

23 Fall 2007 L15: Combinational Circuits Control Signals F0 and F1 What do the control signals F0 and F1 do? Both signals go into the 2 to 4 decoder Between the two signals, one of the four ALU functions is selected to be the ALU’s output F0 Output Function 0 A AND B A + B 1 F1 0 A OR B NOT B 0 01 11

24 Fall 2007 L15: Combinational Circuits Putting together digital logic functions Connect “n” 1-bit ALUs to create 1 n-bit ALU 1-bit ALU slice A n-1 B n-1 Output n-1 1-bit ALU slice A1A1 B1B1 Output 1 1-bit ALU slice A0A0 B0B0 Output 0 1-bit ALU slice A n-2 B n-2 Output n-2 Carry out n-2

25 Fall 2007 L15: Combinational Circuits More Complex ALUs ALUs in modern CPUs can include more functions than the four we just put together For example, other functions that might be useful: –multiply –shift –compare

26 Fall 2007 L15: Combinational Circuits How would you get the ALU to subtract two integers? A – B Think about the two’s complement procedure 1.NOT B (take the complement of B) 2.NOTB + 1 (add one to the result of step 1) 3.(NOTB + 1) + A (add A to the result of step 2) 4.Ignore any carry out signals

27 Fall 2007 L15: Combinational Circuits What additional function would we need to be able to multiply and divide integers? Shifters (left shift and right shift) Multiplication and division can be thought of as “shift and add” or “shift and subtract” procedures We don’t have time to build a multiplier, but this should give you the intuition for how it could be done.

28 Fall 2007 L15: Combinational Circuits Finite State Machines A formal model used to design sequential circuits to perform tasks that only require a finite number of distinct states of the flip flops

29 Fall 2007 L15: Combinational Circuits A classic example: Stop light at an intersection Outputs: NSlite = 1 (green), NSlite = 0 (red) EWlite = 1 (green), EWlite = 0 (red) Inputs: NScar = 1 (NS bound car waiting) EWcar = 1 (EW bound car waiting)

30 Fall 2007 L15: Combinational Circuits Stop light at an intersection States: NSgreen and EWgreen Next-state function: f(current-state, input) = next-state f(NSgreen, ~ NScar and ~ EWcar) = NSgreen Output function: g(current-state) = output g(NSgreen) = NSLite and ~EWlite

31 Fall 2007 L15: Combinational Circuits Finite State Machine Circuit

32 Fall 2007 L15: Combinational Circuits Finite State Machine state transition diagram

33 Fall 2007 L15: Combinational Circuits Finite State Machine Circuit

34 Fall 2007 L15: Combinational Circuits Other common finite state machines in the processor Counters Shift registers


Download ppt "Fall 2007 L15: Combinational Circuits Lecture 15: Combinational Circuits Complete logic functions Some combinational logic functions –Half adders –Adders."

Similar presentations


Ads by Google