1 Combinational Logic EE 208 – Logic Design Chapter 4 Sohaib Majzoub.

Slides:



Advertisements
Similar presentations
Logical Design.
Advertisements

Combinational Circuits
Functions and Functional Blocks
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 9 Programmable Configurations Read Only Memory (ROM) – –a fixed array of AND gates.
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
Combinational Logic Chapter 4.
Digital Fundamentals Floyd Chapter 6 Tenth Edition
Combinational Logic1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Digital Fundamentals with PLD Programming Floyd Chapter 8
Logic Gates Combinational Circuits
CS 105 Digital Logic Design
Combinational Circuits
Combinational Circuits
Top-down modular design
Combinational Logic Design
Outline Analysis of Combinational Circuits Signed Number Arithmetic
Combinational Logic Chapter 4. Digital Circuits Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are.
Logical Circuit Design Week 8: Arithmetic Circuits Mentor Hamiti, MSc Office ,
Chap 3. Chap 3. Combinational Logic Design. Chap Combinational Circuits l logic circuits for digital systems: combinational vs sequential l Combinational.
Dr. Ahmed El-Bialy, Dr. Sahar Fawzy Combinational Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Combinational Circuit – Arithmetic Circuit
+ CS 325: CS Hardware and Software Organization and Architecture Combinational Circuits 1.
Chapter 3 Combinational Design Digital Logic Design III
Combinational Circuits
Digital Arithmetic and Arithmetic Circuits
CS2100 Computer Organisation MSI Components (AY2015/6 Semester 1)
Functions of Combinational Logic
Combinational Logic By Taweesak Reungpeerakul
1 Combinational Logic Logic and Digital System Design - CS 303 Erkay Savaş Sabancı University.
Boolean Algebra and Logic Gates 1 Computer Engineering (Logic Circuits) Lec. # 8 (Combinational Logic Circuit) Dr. Tamer Samy Gaafar Dept. of Computer.
Combinational Design, Part 3: Functional Blocks
CHAPTER 4 Combinational Logic
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
ES 244: Digital Logic Design Chapter 4 Chapter 4: Combinational Logic Uchechukwu Ofoegbu Temple University.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
Combinational Circuits
Chapter Four Combinational Logic 1. C OMBINATIONAL C IRCUITS It consists of input variables, logic gates and output variables. Output is function of input.
CS 105 DIGITAL LOGIC DESIGN Chapter 4 Combinational Logic 1.
Chap 2. Combinational Logic Circuits
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Computing Machinery Chapter 3: Combinational Circuits.
1 CS 151: Digital Design Chapter 3: Combinational Logic Design 3-1Design Procedure CS 151: Digital Design.
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
1 Fundamentals of Computer Science Combinational Circuits.
Chapter Four Combinational Logic 1. C OMBINATIONAL C IRCUITS It consists of input variables, logic gates and output variables. Output is function of input.
A. Yaicharoen 1 1/2551 Logic Design with MSI Circuits วัตถุประสงค์ของบทเรียน  รู้จักวงจรประเภท MSI  เข้าใจการทำงานของวงจร MSI ที่มีใช้ อยู่ทั่วไป  สามารถประยุกต์ใช้วงจร.
Combinational Circuit Design. Digital Circuits Combinational CircuitsSequential Circuits Output is determined by current values of inputs only. Output.
Module 11.  In Module 9, we have been introduced to the concept of combinational logic circuits through the examples of binary adders.  Meanwhile, in.
Chapter 3 Digital Logic Structures
1 DLD Lecture 16 More Multiplexers, Encoders and Decoders.
Binary Parallel Adders
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
1 The ALU l ALU includes combinational logic. –Combinational logic  a change in inputs directly causes a change in output, after a characteristic delay.
Logic Design (CE1111 ) Lecture 4 (Chapter 4) Combinational Logic Prepared by Dr. Lamiaa Elshenawy 1.
Mu.com.lec 11.  Used not only to perform addition but also to perform subtraction, multiplication and division  The most basic of the adders is the.
MSI Circuits.
Mantıksal Tasarım – BBM231 M. Önder Efe
Chap 3. Combinational Logic Design
Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables, logic gates,
FUNCTION OF COMBINATIONAL LOGIC CIRCUIT
Chapter 4 Combinational Logic
FIGURE 4.1 Block diagram of combinational circuit
INTRODUCTION TO LOGIC DESIGN Chapter 4 Combinational Logic
Ch 4. Combinational logic
Digital System Design Combinational Logic
Presentation transcript:

1 Combinational Logic EE 208 – Logic Design Chapter 4 Sohaib Majzoub

2 What is a Combinational network? Combinational Network X1X1 XmXm X2X2 Z1Z1 ZmZm Z2Z2 Combinational Network: A stateless network (it does not have a memory). The output is completely determined by the values of the input. Output at time t depends only on input at time t Sequential Network: The network stores an internal state. The output is determined by the input, and by the internal state. (it has a memory) Output at time t depends on input at time t and output at time t-1

3 Combinational Circuits Analysis and Design Analysis –Given a circuit, find out its function –Function may be expressed as: Boolean function Truth table Design –Given a desired function, determine its circuit –Function may be expressed as: Boolean function Truth table ? ? ?

4 Analysis Procedure Boolean Expression Approach T 2 =ABC T 1 =A+B+C F 2 =AB+AC+BC F’ 2 =(A’+B’)(A’+C’)(B’+C’) T 3 =AB'C'+A'BC'+A'B'C F 1 =AB'C'+A'BC'+A'B'C+ABC F 2 =AB+AC+BC

5 Analysis Procedure Truth Table Approach A B C F1F1 F2F =

6 Analysis Procedure Truth Table Approach = 0 = 1 = 0 = 1 = 0 = 1 = 0 = A B C F1F1 F2F

7 Analysis Procedure Truth Table Approach = 0 = 1 = 0 = 1 = 0 = 1 = 0 = 1 = A B C F1F1 F2F

8 Analysis Procedure Truth Table Approach = 0 = 1 = 0 = 1 = 0 = 1 = 0 = A B C F1F1 F2F

9 Analysis Procedure Truth Table Approach = 1 = 0 = 1 = 0 = 1 = 0 = 1 = A B C F1F1 F2F

Analysis Procedure Truth Table Approach = 1 = 0 = 1 = 0 = 1 = 0 = 1 = 0 = A B C F1F1 F2F

11 Analysis Procedure Truth Table Approach = 1 = 0 = 1 = 0 = 1 = 0 = 1 = A B C F1F1 F2F

12 Analysis Procedure Truth Table Approach = A B C F1F1 F2F B 0101 A1010 C B 0010 A0111 C F 1 =AB'C'+A'BC'+A'B'C+ABC F 2 =AB+AC+BC

13 Design Procedure Given a problem statement: –Determine the number of inputs and outputs –Derive the truth table –Simplify the Boolean expression for each output –Produce the required circuit Example: Design a security alarm circuit: ?

14 Design Example Design a circuit to convert a “BCD” code to “Excess 3” code

15 Design Example BCD-to-Excess 3 Converter A B C D w x y z x x x x x x x x x x 1 1 x x C 111 B A xxxx 11 xx D C B A xxxx 1 xx D C B A xxxx 1 xx D C B A xxxx 1 xx D w = A+BC+BDx = B’C+B’D+BC’D’ y = C’D’+CDz = D’

16 Design Procedure BCD-to-Excess 3 Converter A B C D w x y z x x x x x x x x x x 1 1 x x w = A + B(C+D) x = B’(C+D) + B(C+D)’ y = (C+D)’ + CD z = D’

17 More Blocks: Binary Adders Half Adders: adds 2 1-bit operands (x and y) to produce 2-bit result (a carry and a sum) Sum = S = a’b+ab’ = a  b Carry = C = ab

18 Half Adders Example: built a four bit adder using Half adders only. Half adders doesn’t consider the previous carry => need to include carry-in

19 Full Adders Carry is included as another input => 3 inputs and 2 outputs: ab C in ab C in SUM C out

20 Full Adders 1-bit Full adder: S = a  b  C in C out = a b+a C in +b C in 4-bit full adder: 4 cascaded (connecting one after the other) full adders, called ripple adder.

21 Ripple Adder The carry has to propagate (ripple) through all adders, Next adder has to wait for carry-in from previous adder, delay of two gates (AND-OR) per adder => 4-bit adder => 8 gate delay. What about 64-bit adder => 128 gate delay=> delay is too high. Ripple adder rarely used.

22 Carry Look Ahead Adder Attempt to generate the carry-in using a separate logic, eliminate waiting time (does not wait for the previous adder to generate the carry). Carry Generate: for a particular combination of inputs a i and b i, adder stage i is said to generate a carry if it produces carry-out of 1 (c i+1 =1) independent of the inputs a 0 -a i-1, b 0 -b i-1, and c 0 Carry Propagate: for a particular combination of inputs a i and b i, adder stage i is said to propagate carries if it produces carry-out of 1 (c i+1 =1) in the presence of the input combination a 0 -a i-1, b 0 -b i-1, and c 0 that causes a carry-in of 1 (c i =1)

23 To realize the propagate and generate cases, we introduce two functions as shown: Back to the carry equation: C i+1 = (a i.b i )+(a i +b i ).C i = g i + p i.C i Carry Look Ahead Adder a b C in C out S propagate generate G P.C in

24 Carry Look Ahead Adder C i+1 = (a i.b i )+(a i +b i ).C i = g i + p i.C i => Stage 0: C 1 = g 0 + p 0.C 0 = (a 0.b 0 )+(a 0 +b 0 ).C 0 Stage 1: C 2 = g 1 + p 1.C 1 = (a 1.b 1 )+(a 1 +b 1 ).C 1 =g 1 +p 1.g 0 +p 1. p 0.C 0 Stage 2: C 3 = g 2 + p 2.C 2 =g 2 + p 2.(g 1 + p 1.C 1 ) = g 2 +p 2 g 1 + p 2 p 1 g 0 + p 2 p 1 p 0.C 0 Stage 3: C 4 = g 3 + p 3.C 3 =g 3 + p 3.(g 2 + p 2.C 2 ) = g 3 + p 3.(g 2 + p 2.(g 1 + p 1.(g 0 + p 0.C 0 ) )) = g 3 + p 3 g 2 +p 3 p 2 g 1 +p 3 p 2 p 1 g 0 +p 3 p 2 p 1 p 0 C 0

25 Carry Look Ahead Adder Basically we will add a separate hardware to break up dependency between sum and carry => duplicating logic area Still suffer from gates with large number of inputs => increasing Fan-In (more inputs) => larger transistors => higher power consumption and slower.

26 Ripple Carry and CLA

27CLA

28 CLA Adders Use a combination of CLA Adders and Ripple Adders, Optimization between delay, power and area can take place here to find the optimal size of the CLA Adders.

29 Cascaded CLA Adders Example: 16-bit Adder, then cascade 4 CLA Adders of 4-bit size.

30 Binary Subtractor Use 2’s complement with binary adder –x – y = x + (-y) = x + y’ + 1

31Adder/Subtractor The M signal has to be 1 when subtraction operation is needed and 0 if addition is needed:

32 BCD Adder 4-bits plus 4-bits Operands and Result: 0 to 9 + x 3 x 2 x 1 x 0 + y 3 y 2 y 1 y 0 ──────── Cy S 3 S 2 S 1 S 0 X +Y x 3 x 2 x 1 x 0 y 3 y 2 y 1 y 0 SumCyS 3 S 2 S 1 S = = = = = = = = A = = Invalid Code Wrong BCD Value

33 BCD Adder X +Yx 3 x 2 x 1 x 0 y 3 y 2 y 1 y 0 SumCyS 3 S 2 S 1 S 0 Required BCD OutputValue = = = = = = = = = = = = = = = = = = = = 

34 BCD Adder Correct Binary Adder’s Output (+6) –If the result is between ‘A’ and ‘F’ –If Cy = 1 S 3 S 2 S 1 S 0 Err S1S1 S2S2 S3S S0S0 Err = S 3 S 2 + S 3 S 1

35 BCD Adder Err

36 Overflow Unsigned Binary Numbers 2’s Complement Numbers FA x 3 x 2 x 1 x 0 FA y 3 y 2 y 1 y 0 S 3 S 2 S 1 S 0 C 4 C 3 C 2 C 1 0 Carry FA x 3 x 2 x 1 x 0 FA y 3 y 2 y 1 y 0 S 3 S 2 S 1 S 0 C 4 C 3 C 2 C 1 0 Overflow

37  Binary Multiplier ●Two 2-bit numbers (A=A 1 A 0 ) and (B=B 1 B 0 ). X0X0 X0X0 X1X1 X1X1 X2X2 X2X2 X3X3 X3X3

38  Binary Multiplier ●Two binary numbers : ●J multiplier bits ●K multiplicand bits.  We need: ●(J  K) AND gates. ●(J  1) K-bit adders

39  Binary Multiplier B0B0 B2B2 B1B1 A0A0 A0B0A0B0 _________________________________ A1A1 A2A2 A0B1A0B1 B3B3 A0B2A0B2 A0B3A0B3 A1B0A1B0 A1B1A1B1 A1B2A1B2 A1B3A1B3 A2B0A2B0 A2B1A2B1 A2B2A2B2 A2B3A2B3 _____________________________________ Z0Z0 Z2Z2 Z1Z1 Z3Z3  __________________________________________________ Z4Z4 + + C0C0 C2C2 C1C1 C3C3 C4C4 C5C5 C6C6 J = 3 K = 4 AND gates (12 gates) 4-bit Adder (2 units) 0

40  Binary Multiplier Z0Z0 Z2Z2 Z1Z1 Z3Z3 Z4Z4

41 Decoders and Encoders A code is a string of several bits, with an n-bit code, it is possible to represent 2 n. A decoder translate the n- bit pattern into a specific code of 2 n possible values. A decoder translate a binary value into a non-binary output. An encoder, translate a non-binary value into a binary value. An n-input decoder has n-inputs and 2 n outputs

42Decoders One-hot encoding (only one output high at a time) Example: a 3-bit binary to decimal decoder, called 3- to-8 decoder.

43 Functions using Decoders We can implement functions using decoders. Example: F(A,B,C) = Σ m (1,3,7) and G(A,B,C) = Σ m (2,3,6) using decoder Less efficient than our optimized AND-OR logic, but sometimes used in small circuits (MSI).

44 Decoder-Based Adder One decoder to implement a full adder with sum and carry output. C = Σm(3,5,6,7) and S =Σm(1,2,4,7)

45 Code Conversion Decoders are also used for code conversion, Example code conversion can be: -BCD-to-7 segment display -BCD-to-decimal -BCD-to-Gray -Binary-to-Gray

46 BCD-to-7 segment display Example

47 Cascading Decoders 3-to-8 decoder requires 8 gates 4-t0-16 requires 16 gates 5-to-32 requires 32 gates Number of gates increases exponentially with number of inputs. You might not need all outputs (BCD-to- decimal) Cascade decoders and use only the required number of outputs

48 Building 3-8 out of 2-4 Decoders Another way to design a decoder is to break it into smaller decoders: –When S2 = 0, outputs Q0-Q3 are generated as in a 2-to-4 decoder. –When S2 = 1, outputs Q4-Q7 are generated as in a 2-to-4 decoder. Q0= S2’ S1’ S0’= m 0 Q1= S2’ S1’ S0= m 1 Q2= S2’ S1 S0’= m 2 Q3= S2’ S1 S0= m 3 Q4= S2 S1’ S0’= m 4 Q5= S2 S1’ S0= m 5 Q6= S2 S1 S0’= m 6 Q7= S2 S1 S0= m 7

Decoder Enable input used to select lower or higher nibble:

50 Cascading Decoders 4-to-16 decoder made of 2x 3-to-8 decoders

51 Active-Low Decoder So far we looked at active high decoders. Active-low decoders are similar but with inverted input and outputs

52 Active Low Decoders An active low 2-to-4 decoder with enable, Active Low => use Maxterms: D 0 = E+A+B =(E’.A’.B’)’; D 1 = E+A+B’ =(E’.A’.B)’; D 2 = E+A’+B =(E’.A.B’)’; D 3 = E+A’+B’ =(E’.A.B)’; Using NAND will convert Maxterms to minterms

53 Active Low Decoders Active-low decoders generate Maxterms Example: f(x,y,z)= ΠM(4,5,7) Use a NAND to generate minterms Q3’= (S1 S0)’ = S1’ + S0’ Q2’= (S1 S0’)’ = S1’ + S0 Q1’= (S1’ S0)’ = S1 + S0’ Q0’= (S1’ S0’)’ = S1 + S0

54Encoders An encoder performs the reverse function of a decoder => has fewer outputs to inputs. A binary encoder has 2 n -n input to output. Usually only one input is 1 the rest is zero.

55 Example: 8-to-3 Encoder Only one input at a time is high, the rest is zero, Idle = I 7 ’. I 6 ’. I 5 ’. I 4 ’. I 3 ’. I 2 ’. I 1 ’. I 0 ’ Valid = I 7 + I 6 + I 5 + I 4 + I 3 + I 2 + I 1 + I I 7 I 6 I 5 I 4 I 3 I 2 I 1 I 0 Y 2 Y 1 Y 0 Idle Valid x x x x x x

56 Priority Encoders The assumption of having a single input as a one and the rest are zeros might be violated (sending multiple interrupt requests to the encoder in a micro- processor). Example: I 2 and I 4 are one which it will produce Y 2 Y 1 Y 0 = 110 (it should’ve been either 010 or 100) Priority encoder ensures this never happen by assigning priority to the input lines. Thus, if more than one input is high, the encoder produces the proper binary output associated with the input that has the highest priority.

57 Priority Encoders Introduce an intermediate function H’s: I 7 I 6 I 5 I 4 I 3 I 2 I 1 I 0 0x x xx xx xxx100000xxx xxxx10000xxxx1000 0xxxxx1000xxxxx100 0xxxxxx100xxxxxx10 0xxxxxxx10xxxxxxx1 A 2 A 1 A 0 Idle x x x x x x H 7 H 6 H 5 H 4 H 3 H 2 H 1 H

58 Priority Encoder Example: I 7 I 6 I 5 I 4 I 3 I 2 I 1 I 0 = => I 5 is higher priority than I 2 => H 7 H 6 H 5 H 4 H 3 H 2 H 1 H 0 = => A 2 A 1 A 0 = 101

59 Multiplex the inputs and pass one or more signal to the output using a selector. 2 n inputs to one output with n selectors. Multiplexers: Data Selector

60Multiplexers 4-to-1 Multiplexer: Y = S 1 ’.S 0 ’.X 0 + S 1 ’.S 0.X 1 +S 1.S 0 ’.X 2 +S 1.S 0.X S 1 S 0 Y X0 X1 X2 X3

61 4-ways Multiplexer Output = Minterm. Input Out = m0.W+m1.X+m2.Y+m3.Z Out = S1’.S0’.W+S1’.S0.X+S1.S0’.Y+S1.S0.Z S 1 S 0 out WXYZWXYZ

62 Bus Multiplexing Multiplexing a bus of MxN data lines into N data lines. Needs M selectors Output Bus A or Bus B Each bus is 4-bit wide

63 Build Multiplexers Using Decoders Use a decoder to generate the minterms

64 Building Logic Functions Using MUXs The variables has to be split into inputs and selectors of the multiplexer. A common way to use n-1 as selectors and the remaining variable with its complement as an input. Example: given the function: F(A,B,C) = Σm(2,3,5,7) To be implemented using 8-to-1 multiplexer

65 Building Logic Functions Using MUXs F(A,B,C) = Σm(2,3,5,7)

66 Building Logic Functions Using MUXs F(A,B,C) = Σm(2,3,5,7) Using 4-to-1 MUX

67 Building Logic Functions Using MUXs Example: F(A,B,C) = Σm(1,3,5,6) Can you use 4-to-1 MUX? 2 variables as selectors

68 Building Logic Functions Using MUXs Example: implement the following function using 8-to-1 MUX: 4-to-1 MUX?

69 Designing Using MUXs Design an Adder/ Subtractor using MUXs and a single Adder to that can do the following operations: A-B, -A+B, B-A, -B+A

70Demultiplexer One input to 2 n outputs with n selectors Y 0 = S 1 ’.S 0 ’.X Y 1 = S 1 ’.S 0.X Y 2 = S 1.S 0 ’.X Y 3 = S 1.S 0.X similar to decoders? S 1 S 0 Y 0 Y 1 Y 2 Y X000X000 0X000X00 00X000X0 000X000X

71 Tri-State Buffer A Tri-state buffer can output either 1, 0, or high impedance.

72Comparators Inputs A and B each of n-bits Output is 1 if A=B A>B A<B and 0 if A≠B A 0 B 0 A 0 =B

73Comparators Output 1 if A> B and 0 otherwise A 0 B 0 A 0 >B