chapter 3 – combinational logic designlogic designhoangtrang/lecture...

31
Computer Engineering 1 (ECE290) Chapter 3 Combinational Logic Design Logic Design Part 1 – Implementation Technology and Logic Design HOANG Trang Reference: © 2008 Pearson Education Inc Design Reference: © 2008 Pearson Education, Inc.

Upload: others

Post on 29-Mar-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Computer Engineering 1 (ECE290)

Chapter 3 – Combinational Logic DesignLogic Design

Part 1 – Implementation Technology and Logic Design

HOANG Trang

Reference: © 2008 Pearson Education Inc

Design

Reference: © 2008 Pearson Education, Inc.

Page 2: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Overview

Part 1 – Design ProcedureS• Steps Specification Formulation Optimization Technology Mapping

Beginning Hierarchical Design• Beginning Hierarchical Design• Technology Mapping - AND, OR, and NOT to NAND

or NOR• Verification

ManualSi i

Hoang Trang Reference Chapter 3 - Part 1 2

Simulation

Page 3: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Overview (continued)

Part 2 – Combinational Logic• Functions and functional blocks• Rudimentary logic functions• Decoding using Decoders Implementing Combinational Functions with

D dDecoders

• Encoding using EncodersS l i i M l i l• Selecting using Multiplexers Implementing Combinational Functions with

Multiplexers

Hoang Trang Reference Chapter 3 - Part 1 3

Multiplexers

Page 4: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Combinational Circuits

A combinational logic circuit:+ n switching functions each maps the 2m input+ n switching functions, each maps the 2m input combinations to an output+ The current output depends only on the current input values

A block diagram:

CombinatorialLogicCircuit

Hoang Trang Reference Chapter 3 - Part 1 4

m Boolean Inputs n Boolean Outputs

Page 5: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Procedure1. Specification

• Write a specification for the circuit if one is notWrite a specification for the circuit if one is not already available

2. FormulationDeri e a tr th table or initial Boolean eq ations• Derive a truth table or initial Boolean equations (define the required relationships between the inputs and outputs, if not in the specification)

• Apply hierarchical design if appropriate• Apply hierarchical design if appropriate3. Optimization

• Apply optimization• Draw a logic diagram or • Provide a netlist for the resulting circuit using

ANDs, ORs, and inverters

Hoang Trang Reference Chapter 3 - Part 1 5

, ,

Page 6: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Procedure

4. Technology Mapping• Map the logic diagram or netlist to the

implementation technology selected5. Verification

• Verify the correctness of the final design manually or using simulation

Hoang Trang Reference Chapter 3 - Part 1 6

Page 7: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Procedure example

1 SpecificationBCD to Excess-3 code converter

1. Specification • Transforms BCD code for the decimal digits to

Excess-3 code for the decimal digitsExcess 3 code for the decimal digits• BCD code words for digits 0 through 9: 4-bit

patterns 0000 to 1001, respectively• Excess-3 code words for digits 0 through 9: 4-

bit patterns consisting of 3 (binary 0011) added to each BCD code wordto each BCD code word

• Implementation: multiple-level circuit

Hoang Trang Reference Chapter 3 - Part 1 7

multiple-level circuit NAND gates (including inverters)

Page 8: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Example (continued)

2. Formulation• Conversion of 4-bit codes can be most easily

formulated by a truth table• Variables Input BCD Output Excess 3Variables

- BCD:A,B,C,D

Input BCD A B C D

Output Excess-3WXYZ

0 0 0 0 0 0 1 10 0 0 1 0 1 0 0• Variables

- Excess-3W,X,Y,Z

0 0 0 1 0 1 0 00 0 1 0 0 1 0 10 0 1 1 0 1 1 00 1 0 0 0 1 1 1, , ,

• Don’t Cares- BCD 1010

t 1111

0 1 0 0 0 1 1 10 1 0 1 1 0 0 00 1 1 0 1 0 0 10 1 1 1 1 0 1 0

Hoang Trang Reference Chapter 3 - Part 1 8

to 1111 1 0 0 0 1 0 1 11 0 0 1 1 0 1 1

Page 9: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Example (continued)

3. Optimization C0 1 3 2

1 1C

0 1 3 21 1

z ya. 2-level using

K-maps BA

0 1 3 2

4 5 7 6

12 13 15 14

11

X X X X BA

0 1 3 2

4 5 7 6

12 13 15 14

11

X X X X

W = A + BC + BDX = C + D + BY = CD +

D

A8 9 11 10

1 X X

D

A8 9 11 10

1 X X

B CDBCDY = CD +

Z = C0 1 3 2

1 1 1C

0 1 3 2

wxCD

D

BA

0 1 3 2

4 5 7 6

12 13 15 14

1

X X X X BA

0 1 3 2

4 5 7 6

12 13 15 14

1 1

X X X X

1

Hoang Trang Reference Chapter 3 - Part 1 9D

A8 9 11 10

1 X X

D

A8 9 11 10

1 X X1

Page 10: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Example (continued)

3. Optimization (continued)b. Multiple-level using transformations

W = A + BC + BDX = C + D + BB CDBX = C + D + BY = CD + Z = G = 7 + 10 + 6 + 0 = 23

B CDBCD

DAddi i l OR• Perform extraction, finding factor:

T1 = C + DW A + BT It is optimized?

Additional OR gate

W = A + BT1X = T1 + BY = CD +

B CDCD

It is optimized?

Hoang Trang Reference Chapter 3 - Part 1 10

Z = G = 2 + 4 + 7 + 6 + 0 = 19D

Page 11: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Example (continued)

3. Optimization (continued)b. Multiple-level using transformations

T1 = C + DW = A + BT11X = T1 + BY = CD + Z = G = 19

B CDCD

DZ = G = 19• An additional extraction using Boolean transformation: ( = C + D = ):

D

CD T1using Boolean transformation: ( C D ):W = A + BT1X = T1 + B

CB T1

T

1

Hoang Trang Reference Chapter 3 - Part 1 11

Y = CD + Z = G = 2 +1 + 4 + 6 + 4 + 0 = 16!D

T1

Page 12: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Design Example (continued)4. Technology Mapping

• Mapping with a library containing inverters and 2-inputMapping with a library containing inverters and 2 input NAND, 2-input NOR, and 2-2 AOI gates

A

W

A

W

BB

CX

B X

C

D YCD

Y

Hoang Trang Reference Chapter 3 - Part 1 12Z

Z

Page 13: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Beginning Hierarchical Design To control the complexity of the function mapping inputs to

outputs: p• Decompose the function into smaller pieces called blocks• Decompose each block’s function into smaller blocks, repeating as

necessary until all blocks are small enoughnecessary until all blocks are small enough• Any block not decomposed is called a primitive block• The collection of all blocks including the decomposed ones is a

hierarchyhierarchy

Example: 9-input parity tree (see next slide)• Top Level: 9 inputs, one output• 2nd Level: Four 3-bit odd parity trees in two levels• 3rd Level: Two 2-bit exclusive-OR functions• Primitives: Four 2-input NAND gates

Hoang Trang Reference Chapter 3 - Part 1 13

• Design requires 4 X 2 X 4 = 32 2-input NAND gates

Page 14: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Hierarchy for Parity Tree ExampleX0X1X2X3X4X5

ZO

9-Inputodd

functionX5X6X7X8

function

(a) Symbol for circuit

3-Inputodd

function

A 0

A 1

A 2

BO

3 I tA 0 3 I t

A 0

X0

X1

X2

X3 3-Inputodd

function

A 0

A 1

A 2

BO

3-Inputodd

function

A 0

A 1

A 2

BO

3-InputA 0

X3

X4

X5

X6

ZO

BOodd

functionA 1

A 2

X7

X8

(b) Circuit as interconnected 3-input oddfunction blocks

A0

BO

A0

A1

A2

(c) 3-input odd function circuit asinterconnected exclusive-ORblocks

Hoang Trang Reference Chapter 3 - Part 1 14

blocks

(d) Exclusive-OR block as interconnectedNANDs

Page 15: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Reusable Functions

Whenever possible, we try to decompose l d i i t bla complex design into common, reusable

function blocks These blocks are

• verified and well-documented• placed in libraries for future use

Hoang Trang Reference Chapter 3 - Part 1 15

Page 16: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Top-Down versus Bottom-Up

A top-down design proceeds from an abstract, high-level specification to a more and more detailed designlevel specification to a more and more detailed design by decomposition and successive refinement

A bottom-up design starts with detailed primitive blocks and combines them into larger and more complex functional blocks

Design usually proceeds top-down to known buildingDesign usually proceeds top-down to known building blocks ranging from complete CPUs to primitive logic gates or electronic components.

Much of the material in this chapter is devoted to learning about combinational blocks used in top-down design.

Hoang Trang Reference Chapter 3 - Part 1 16

design.

Page 17: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Technology Mapping

Mapping Procedures• To NAND gates• To NOR gates• Mapping to multiple types of logic blocks in

covered in the reading supplement: A iAdvanced Technology Mapping.

Hoang Trang Reference Chapter 3 - Part 1 17

Page 18: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Mapping to NAND gates

Assumptions:• Gate loading and delay are ignored• Cell library contains an inverter and n-input NAND

gates n = 2 3gates, n = 2, 3, …• An AND, OR, inverter schematic for the circuit is

available

The mapping is accomplished by:• Replacing AND and OR symbols,p g y ,• Pushing inverters through circuit fan-out points,

and

Hoang Trang Reference Chapter 3 - Part 1 18

• Canceling inverter pairs

Page 19: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

NAND Mapping Algorithm1. Replace ANDs and ORs:

. ......

2. Repeat the following pair of actions until there

......

p g pis at most one inverter between :

a. A circuit input or driving NAND gate output, andb. The attached NAND gate inputs.

.. ..

Hoang Trang Reference Chapter 3 - Part 1 19

.. ..

Page 20: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

NAND Mapping ExampleAB

AB

5

6

X

OI

C

D

F C7

1 2

4

Y

38D

F

OI

DE

(a)

938D

E(b)

AAB

X5

C

D

F

5

5

7

6Y

Hoang Trang Reference Chapter 3 - Part 1 20

E

(d)(c)

Page 21: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Mapping to NOR gates

Assumptions:• Gate loading and delay are ignored• Cell library contains an inverter and n-input NOR

gates n = 2 3gates, n = 2, 3, …• An AND, OR, inverter schematic for the circuit is

available

The mapping is accomplished by:• Replacing AND and OR symbols,p g y ,• Pushing inverters through circuit fan-out points,

and

Hoang Trang Reference Chapter 3 - Part 1 21

• Canceling inverter pairs

Page 22: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

NOR Mapping Algorithm1. Replace ANDs and ORs:

......

2. Repeat the following pair of actions until there

......

p g pis at most one inverter between :

a. A circuit input or driving NAND gate output, andb. The attached NAND gate inputs.

.. ..

Hoang Trang Reference Chapter 3 - Part 1 22

.. ..

Page 23: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

NOR Mapping Example

AA

F

B

X

C

B

C F

2

1

A

FC

D

E(b)

C

DE

(a)

3

B

C

(b)

C

D

E

F

(c)

Hoang Trang Reference Chapter 3 - Part 1 23

(c)

Page 24: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Verification

Verification - show that the final circuit d i d i l t th i i l ifi tidesigned implements the original specification

Simple specifications are:t th t bl• truth tables

• Boolean equations• HDL codeHDL code

If the above result from formulation and are not the original specification, it is critical thatnot the original specification, it is critical that the formulation process be flawless for the verification to be valid!

Hoang Trang Reference Chapter 3 - Part 1 24

Page 25: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Basic Verification Methods

Manual Logic Analysis• Find the truth table or Boolean equations for the final circuit• Find the truth table or Boolean equations for the final circuit• Compare the final circuit truth table with the specified truth

table, orSh th t th B l ti f th fi l i it l• Show that the Boolean equations for the final circuit are equal to the specified Boolean equations

Simulation• Simulate the final circuit (or its netlist, possibly written as an

HDL) and the specified truth table, equations, or HDL description using test input values that fully validate correctness.

• The obvious test for a combinational circuit is application of all possible “care” input combinations from the specification

Hoang Trang Reference Chapter 3 - Part 1 25

Page 26: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Verification Example: Manual Analysis

BCD-to-Excess 3 Code ConverterFi d h SOP B l i f h fi l• Find the SOP Boolean equations from the final circuit.

• Find the truth table from these equationsFind the truth table from these equations• Compare to the formulation truth table

Finding the Boolean Equations:Finding the Boolean Equations:T1 = C + D = C + DW = A (T1 B) = A + B T1( )X = (T1 B) (B ) = T1 + B Y = C + D = CD + D

C DC

B C DCD

Hoang Trang Reference Chapter 3 - Part 1 26

Page 27: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Verification Example: Manual Analysis Find the circuit truth table from the equations and compare

to specification truth table:Input BCD

A B C DOutput Excess-3

WXYZ 0 0 0 0 0 0 1 1

Input BCDA B C D

Output Excess-3WXYZ

0 0 0 0 0 0 1 10 0 0 0 0 0 1 10 0 0 1 0 1 0 00 0 1 0 0 1 0 10 0 1 1 0 1 1 0

0 0 0 0 0 0 1 10 0 0 1 0 1 0 00 0 1 0 0 1 0 10 0 1 1 0 1 1 00 0 1 1 0 1 1 00 1 0 0 0 1 1 10 1 0 1 1 0 0 0

0 0 1 1 0 1 1 00 1 0 0 0 1 1 10 1 0 1 1 0 0 00 1 1 0 1 0 0 10 1 1 1 1 0 1 01 0 0 0 1 0 1 1

0 1 1 0 1 0 0 10 1 1 1 1 0 1 01 0 0 0 1 0 1 1

Hoang Trang Reference Chapter 3 - Part 1 27

1 0 0 0 1 0 1 11 0 0 1 1 0 1 1

The tables match!1 0 0 1 1 0 1 1

Page 28: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Verification Example: Simulation

Simulation procedure:• Use a schematic editor or text editor to enter

a gate level representation of the final circuit• Use a waveform editor or text editor to enter

a test consisting of a sequence of input combinations to be applied to the circuitcombinations to be applied to the circuit This test should guarantee the correctness of the

circuit if the simulated responses to it are correctp Short of applying all possible “care” input

combinations, generation of such a test can be diffi lt

Hoang Trang Reference Chapter 3 - Part 1 28

difficult

Page 29: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Verification Example: Simulation

Enter BCD-to-Excess-3 Code Converter Circuit SchematicINV W

A

NAND2

NAND2

INV

INV

W

NOR2INV

NAND2INV

B

XNAND2

NAND2

NAND3INV

C

X

AOI symbolnot available

AND2INV

NOR2

D

Y

not available

Hoang Trang Reference Chapter 3 - Part 1 29

AND2 AOI

Z

Page 30: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Verification Example: Simulation

Enter waveform that applies all possible input combinations:

INPUTS

ABBCD

Are all BCD input combinations present? (Low is a 0 and high i )

0 50 ns 100 ns

is a one)

Hoang Trang Reference Chapter 3 - Part 1 30

Page 31: Chapter 3 – Combinational Logic DesignLogic Designhoangtrang/lecture note/ECE290/Slide/ECE29… · Design usually proceeds topDesign usually proceeds top-down to known buildingdown

Verification Example: Simulation

Run the simulation of the circuit for 120 nsINPUTS INPUTS

ABCCD

OUTPUTSWWXYZ

Do the simulation output combinations match the original0 50 ns 100 ns

Z

Hoang Trang Reference Chapter 3 - Part 1 31

Do the simulation output combinations match the original truth table?