54
CS1104: Computer Organisation http://www.comp.nus.edu.sg/~cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits

CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

Embed Size (px)

Citation preview

Page 1: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104: Computer Organisation

http://www.comp.nus.edu.sg/~cs1104

Lecture 6: Combinational CircuitsDesign Methods/Arithmetic Circuits

Page 2: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 L ecture 6:Combinational Circuits: Design Methods/Arithmetic Circuits

2

Lecture 6: Combinational Circuits:Design Methods/Arithmetic Circuits Introduction Analysis Procedure Design Methods Gate-level (SSI) Design

Half Adder Full Adder BCD-to-Excess-3 Code Converter

Block-Level Design 4-bit Parallel Adder BCD-to-Excess-3 Code Converter 16-bit Parallel Adder 4-bit Parallel Adder cum Subtractor

Page 3: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Lecture 6: Combinational Circuits: Design Methods/Arithmetic Circuits

3

Lecture 6: Combinational Circuits:Design Methods/Arithmetic Circuits

Arithmetic Circuits Adders Parallel Adders Cascading Adders Parallel Adder-Subtractor Comparator

Calculations of Circuit Delays

Faster Circuits

Look-Ahead Carry Adder

Page 4: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Introduction 4

Introduction (1/2) Two classes of logic circuits:

combinational sequential

Combinational Circuit:

Each output depends entirely on the immediate (present) inputs.

CombinationalLogic: : : :inputs outputs

Page 5: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Introduction 5

Introduction (2/2) Sequential Circuit: (not covered)

Output depends on both present and past inputs.Memory (via feedback loop) contains past information.

CombinationalLogic: :inputs outputs: :

Mem

ory

Page 6: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Analysis Procedure 6

Analysis Procedure Given a combinational circuit, can you analyze its

function?

Steps: 1. Label the inputs and outputs.

AB 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.

A B (A+B) (A'+B') F1 F20 0 0 1 0 00 1 1 1 1 01 0 1 1 1 01 1 1 0 0 1

4. Deduce the functionality of the circuit half adder.

Page 7: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Design Methods 7

Design Methods (1/2)

Different combinational circuit design methods: Gate-level method (with logic gates) Block-level design method

Design methods make use of logic gates and useful functional blocks. These are available as Integrated Circuit (IC) chips.

Page 8: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Design Methods 8

Design Methods (2/2) Type of IC chips (based on packing density) :

Small-scale integration (SSI): up to 12 gates Medium-scale integration (MSI): 12-99 gates Large-scale integration (LSI): 100-9999 gates Very large-scale integration (VLSI): 10,000-99,999 gates Ultra large-scale integration (ULSI): > 100,000 gates

Main objectives of circuit design: (i) reduce cost

reduce number of gates (for SSI circuits) reduce IC packages (for complex circuits)

(ii) increase speed (iii) design simplicity (reuse blocks where possible)

Page 9: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Gate-level (SSI) Design: Half Adder

9

Gate-level (SSI) Design: Half Adder (1/2)

Design procedure:1) State Problem

Example: Build a Half Adder to add two bits

2) Determine and label the inputs & outputs of circuit.Example: Two inputs and two outputs labelled, as

follows:

HalfAdder

X

Y

S

C

(X + Y)

3) Draw truth table.

X Y C S0 0 0 00 1 0 11 0 0 11 1 1 0

Page 10: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Gate-level (SSI) Design: Half Adder

10

Gate-level (SSI) Design: Half Adder (2/2)

4) Obtain simplified Boolean function.

Example: C = X.Y S = X'.Y + X.Y' = XY

X Y C S0 0 0 00 1 0 11 0 0 11 1 1 0

XY

S

C

Half Adder

5) Draw logic diagram.

Page 11: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Gate-level (SSI) Design: Full Adder

11

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: 1 1 1 carry0 0 1 1 X

+ 0 1 1 1 Y1 0 1 0 S

Need Full Adder (so called as it can be made from two half-adders).

FullAdder

XYZ

S

C

(X + Y + Z)

Page 12: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Gate-level (SSI) Design: Full Adder

12

Gate-level (SSI) Design: Full Adder (2/5)

Truth table:

X Y Z C S0 0 0 0 00 0 1 0 10 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 1

Note:Z - carry in (to the current

position)C - carry out (to the next position)

Using K-map, simplified SOP form:C = X.Y + X.Z + Y.Z

S = X'.Y'.Z + X'.Y.Z'+X.Y'.Z'+X.Y.Z

0 1

00 01 11 10XYZ

111

1

C

0 1

00 01 11 10XYZ

11

11

S

Page 13: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Gate-level (SSI) Design: Full Adder

13

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 + ((XY) + X.Y).Z

= X.Y + (XY).Z + X.Y.Z

= X.Y + (XY).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'.(YZ) + X.(YZ)'

= X(YZ) or (XY)Z

Page 14: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Gate-level (SSI) Design: Full Adder

14

Gate-level (SSI) Design: Full Adder (4/5)

Circuit for above formulae:

C = X.Y + (XY).Z

S = (XY)Z

Full Adder made from two Half-Adders (+ OR gate).

(XY)XY S

C

Z

(XY)

Page 15: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Gate-level (SSI) Design: Full Adder

15

Gate-level (SSI) Design: Full Adder (5/5)

Circuit for above formulae:

C = X.Y + (XY).Z

S = (XY)Z

Full Adder made from two Half-Adders (+ OR gate).

(XY)XY S

C

Z

(X.Y)

HalfAdder

HalfAdder

XY

XY

Sum

Carry

Sum

Carry

Block diagrams.

Page 16: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Code Converters 16

Code Converters

Code converters – take an input code, translate to its equivalent output code.

Codeconverter

Inputcode

Outputcode

Example: BCD to Excess-3 Code Converter.Input: BCD digit

Output: Excess-3 digit

Page 17: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 BCD-to-Excess-3 Code Converter 17

BCD-to-Excess-3 Code Converter (1/2)

Truth table: BCD Excess-3

A B C D W X Y Z0 0 0 0 0 0 0 1 11 0 0 0 1 0 1 0 02 0 0 1 0 0 1 0 13 0 0 1 1 0 1 1 04 0 1 0 0 0 1 1 15 0 1 0 1 1 0 0 06 0 1 1 0 1 0 0 17 0 1 1 1 1 0 1 08 1 0 0 0 1 0 1 19 1 0 0 1 1 1 0 0

10 1 0 1 0 X X X X11 1 0 1 1 X X X X12 1 1 0 0 X X X X13 1 1 0 1 X X X X14 1 1 1 0 X X X X15 1 1 1 1 X X X X

1

A

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X XA

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X X

A

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X XA

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X X

1

1 11

1

W

1

111

1

1

11

11

11

11

X

Y Z

K-maps:

Page 18: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 BCD-to-Excess-3 Code Converter 18

BCD-to-Excess-3 Code Converter (2/2)

1A

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X X

11

11

Z

A

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X X1

1 11

1

W

W = A + B.C + B.D

X = B'.C + B‘.D + B.C'.D'

Y = C.D + C'.D'

Z = D'

A

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X X

1

111

1

X

A

C

00

01

11

10

00 01 11 10

D

AB

CD

BX XX X

X X1

11

11

Y

Page 19: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Block-Level Design Method 19

Block-Level Design Method

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 Conversion (2) 16-Bit Parallel Adder (3) Adder cum Subtractor

Page 20: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder 20

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-bitParallel Adder

C5 C1

X2 X1 Y4 Y3

S4 S3 S2 S1

Y2 Y1X4 X3

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

Page 21: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder 21

4-bit Parallel Adder (2/4)

SSI design technique should not be used.

Truth table for 9 inputs very big, i.e. 29=512 entries:

X4X3X2X1 Y4Y3Y2Y1 C1 C5 S4S3S2S1

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

... ... ... ... ...0 1 0 1 1 1 0 1 1 1 0 0 1 1

... ... ... ... ...1 1 1 1 1 1 1 1 1 1 1 1 1 1

Simplification very complicated.

Page 22: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder 22

4-bit Parallel Adder (3/4)

Alternative design possible.

Addition formulae for each pair of bits (with carry in),

Ci+1Si = Xi + Yi + Ci

has the same function as a full adder.

Ci+1 = Xi .Yi + (Xi Yi ) .Ci

Si = Xi Yi Ci

Page 23: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder 23

4-bit Parallel Adder (4/4)

Cascading 4 full adders via their carries, we get:

C1

Y1 X1

S1

FA

C2

C5

Y2 X2

S2

FA

C3

Y3 X3

S3

FA

C4

Y4 X4

S4

FA

Output

Input

Page 24: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Parallel Adders 24

Parallel Adders

Note that carry 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.

Page 25: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 BCD-to-Excess-3 Code Converter 25

BCD-to-Excess-3 Code Converter (1/2)

Excess-3 code can be converted from BCD code using truth table:

BCD Excess-3A B C D W X Y Z

0 0 0 0 0 0 0 1 11 0 0 0 1 0 1 0 02 0 0 1 0 0 1 0 13 0 0 1 1 0 1 1 04 0 1 0 0 0 1 1 15 0 1 0 1 1 0 0 06 0 1 1 0 1 0 0 17 0 1 1 1 1 0 1 08 1 0 0 0 1 0 1 19 1 0 0 1 1 1 0 0

10 1 0 1 0 X X X X11 1 0 1 1 X X X X12 1 1 0 0 X X X X13 1 1 0 1 X X X X14 1 1 1 0 X X X X15 1 1 1 1 X X X X

Gate-level design can be used since only 4 inputs.

However, alternative design possible.

Use problem-specific formulae:

Excess-3 Code

= BCD Code + (0011)2

Page 26: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 BCD-to-Excess-3 Code Converter 26

BCD-to-Excess-3 Code Converter (2/2)

Excess-3 Code = BCD Code + (0011)2

Block-level circuit:

4-bit P

arallel A

dder

X4

X3

X2

X1

Y4

Y3

Y2

Y1

0011

S4

S3

S2

S1

BCDcode

Excess-3code

unused

0

Cin

Cout

A BCD-to-Excess-3 Code Converter

Page 27: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 16-bit Parallel Adder 27

16-bit Parallel Adder (1/2)

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

X4..X1 Y4..Y1

C1

S4..S1

4-bit // adder

X8..X5 Y8..Y5

C5

S8..S5

4-bit // adder

X12..X9 Y12..Y9

C9

S12..S9

4-bit // adder

X16..X13 Y16..Y13

C13

S16..S13

C17

4444

444 4444 4

A 16-bit parallel adder

Page 28: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 16-bit Parallel Adder 28

16-bit Parallel Adder (2/2)

Shortened notation for multiple lines.

16-bit parallel adder ripples carry from one 4-bit block to the next. Such ripple-carry circuits are “slow” because of long delays needed to propagate the carries.

4

S4 .. S1 S4 S3 S2 S1

is a shortened notation for

Page 29: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder cum Subtractor

29

4-bit Parallel Adder cum Subtractor (1/4)

Subtraction can be performed through addition using 2s-complement numbers.

Hence, we can design a circuit which can perform both addition and subtraction, using a parallel adder.

4-bit addercum subtractor

S: control signal for add/subtract

X2 X1 Y4 Y3

Result: either X+Y or X-Y

Y2 Y1X4 X3

Page 30: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder cum Subtractor

30

4-bit Parallel Adder cum Subtractor (2/4)

The control signal S=0 means add S=1 means subtract

Recall that:

X-Y = X + (-Y)

= X + (2’s complement of Y)

= X + (1’s complement of Y) +1

X+Y = X + (Y)

Page 31: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder cum Subtractor

31

4-bit Parallel Adder cum Subtractor (3/4)

Design requires: (i) XOR gates:

such that: output = Y when S=0 = Y' when S=1

(ii) S connected to carry-in.

S = 0

YY

S = 1

Y'Y

Page 32: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 4-bit Parallel Adder cum Subtractor

32

4-bit Parallel Adder cum Subtractor (4/4)

Adder cum subtractor circuit:

Analysis:

If S=1, then X + (1's complement of Y) +1 appears as the result.

If S=0, then X+Y appears as

the result.

4-bit parallel adder

X2 X1

Y4 Y3 Y2 Y1

X4 X3

S2 S1S4 S3

C

S

CinCout

A 4-bit adder cum subtractor

Page 33: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Adders 33

Arithmetic Circuits: Adders

Half adderx y C S0 0 0 00 1 0 11 0 0 11 1 1 0

X

Y

Cout

Sum

Carry

Input bits

Output bits

xy'

S = xy' + x'yx'y

xy C

xy

S = (x+y)(x'+y')x'y'

xy C

x'y'

S = (C+x'y')'xy C

xy

C

S = x y

Revision

Page 34: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Adders 34

Arithmetic Circuits: Adders

Full adder x y z C S0 0 0 0 00 0 1 0 10 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 1

Sum

Carry

Input bits

Output bits

A

B

Cout

Cin

0

1

00 01 11 10xyz

C = xy + xz + yz

11 1

1

1

S = x'y'z + x'yz' + xy'z' + xyz

0

1

00 01 11 10xyz

1

1

1

xy S = (xy)z

C = xy + (xy)zz

xy

xy

X'y'z

S

x'yz'xy'z'xyz

Cxz

yz

xy

Revision

Page 35: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Parallel Adders

35

Arithmetic Circuits: Parallel Adders

Example: Adding two 4-bit numbers

Subscript i 4 3 2 1Input carry 0 1 1 0 Ci

Augend 1 0 1 1 Ai

Addend 0 0 1 1 Bi

Sum 1 1 1 0 Si

Output carry 0 0 1 1 Ci+1

2 ways: Serial (one FA) Parallel (n FAs for n bits)

C1

Y1 X1

S1

C2

C5

Y2 X2

S2

C3

Y3 X3

S3

C4

Y4 X4

S4

FA FA FA FA

X

Y

Cout

S

CinInput carry

Binary no. B

Binary no. A

Output carry

4-bit sum

Revision

Page 36: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Cascading Adders

36

Arithmetic Circuits: Cascading Adders

4-bit parallel adder: cascade 4 full adders classical method: 9 input variables 29 = 512 rows in truth

table!

Cascading method can be extended to larger numbers, example: 16-bit parallel adder.

4-bit // adder

X4..X1 Y4..Y1

C1

S4..S1

4-bit // adder

X8..X5 Y8..Y5

C5

S8..S5

4-bit // adder

X12..X9 Y12..Y9

C9

S12..S9

4-bit // adder

X16..X13 Y16..Y13

C13

S16..S13

C17

4444

444 4444 4

Revision

Page 37: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Cascading Adders

37

Arithmetic Circuits: Cascading Adders

Application: 6-person voting system. Use FAs and a 4-bit binary 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

1234

B

1234

S

1234

Parallel adder

Page 38: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Adder-Subtractor

38

Arithmetic Circuits: Adder-Subtractor Make use of 2’s complement:

X - Y = X + (-Y)

2’s complement of Y = Inverting bits in Y and plus 1.

When S=0,Cin=0, Zi = Yi S = X + Y

When S=1,Cin=1, Zi = Yi' S = X + Y' + 1

4-bit parallel adder

X2 X1

Y4 Y3 Y2 Y1

X4 X3

S2 S1S4 S3

C

S

CinCout

Z4 Z3 Z2 Z1

Zi = S.Yi' + S'.Yi

Revision

Page 39: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Comparator 39

Arithmetic Circuits: Comparator (1/3)

Magnitude comparator: compares 2 values A and B, to see if A>B, A=B or A<B.

Classical method requires 22n rows in truth table!

We exploit regularity.

How do we compare two 4-bit values A (a3a2a1a0) and B (b3b2b1b0)?

If (a3 > b3) then A > B

If (a3 < b3) then A < B

If (a3 = b3) then if (a2 > b2) ….

Page 40: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Comparator 40

Arithmetic Circuits: Comparator (2/3)Let A = A3A2A1A0 , B = B3B2B1B0; xi = Ai.Bi + Ai'.Bi'

A2

B2

A3

B3

A0

B0

A1

B1

(A < B)

(A > B)

(A = B)

x3

x2

x1

x0

A3'.B3A3.B3'

A3'.B3 + x3.A2'.B2

+ x3.x2.A1'.B1

+ x3. x2.x1.A0'.B0

A3.B3' + x3.A2.B2'

+ x3.x2.A1.B1'

+ x3. x2.x1.A0.B0'

x3. x2.x1.x0

Page 41: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Arithmetic Circuits: Comparator 41

Arithmetic Circuits: Comparator (3/3)

A3

A2

A1

A0

4-bit comp

(A < B)(A > B)(A = B)

B3

B2

B1

B0

0110

1010

100

Block diagram of a 4-bit magnitude comparator

Page 42: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Calculation of Circuit Delays 42

Calculation of Circuit Delays (1/5)

In general, given a logic gate with delay, t.

If inputs are stable at times t1,t2,..,tn, respectively; then the earliest time in which the output will be stable is:

max(t1, t2, .., tn) + t

LogicGate

t1

t2

tn

: :

max (t1, t2, ..., tn ) + t

To calculate the delays of all outputs of a combinational circuit, repeat above rule for all gates.

Page 43: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Calculation of Circuit Delays 43

Calculation of 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.)

where outputs S and C, experience delays of 2t and 3t, respectively.

XY S

C

Z

max(0,0)+t = t

t

0

0

0

max(t,0)+t = 2t

max(t,2t)+t = 3t2t

Page 44: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Calculation of Circuit Delays 44

Calculation of Circuit Delays (3/5)

More complex example: 4-bits parallel adder.

C1

Y1 X1

S1

FA

C2

C5

Y2 X2

S2

FA

C3

Y3 X3

S3

FA

C4

Y4 X4

S4

FA0

00 00 00 00

Page 45: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Calculation of Circuit Delays 45

Calculation of Circuit Delays (4/5)

Analyse the delay for the repeated block:

where Xi, Yi are stable at 0t, while Ci is assumed to be stable at mt.

FullAdder

Xi

Yi

Ci

Si

Ci+1

0

0

mt

Performing the delay calculation gives:

Xi

Yi Si

Ci+1

Ci

max(0,0)+t = t

t

0

0

mt

max(t,mt)+t

max(t,mt)+2tmax(t,mt)+t

Page 46: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Calculation of Circuit Delays 46

Calculation of Circuit Delays (5/5)

Calculating: When i=1, m=0: S1 = 2t and C2 = 3t.

When i=2, m=3: S2 = 4t and C3 = 5t.

When i=3, m=5: S3 = 6t and C4 = 7t.

When i=4, m=7: S4 = 8t and C5 = 9t.

In general, an n-bit ripple-carry parallel adder will experience:

Sn = ((n-1)*2+2)t

Cn+1 = ((n-1)*2+3)t

as their delay times. Propagation delay of ripple-carry parallel adders is

proportional to the number of bits it handles. Maximum Delay: ((n-1)*2+3)t

Page 47: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Faster Circuits 47

Faster Circuits

Three ways of improving the speed of these circuits:

(i) Use better technology (e.g. ECL faster than TTL gates), BUT

(a) faster technology is more expensive, needs more power, lower-level of integrations.

(b) physical limits (e.g. speed of light, size of atom).

(ii) Use gate-level designs to two-level circuits! (use sum- of-products/product-of-sums) BUT

(a) complicated designs for large circuits. (b) product/sum terms need MANY inputs!

(iii) Use clever look-ahead techniques BUT there are additional costs (hopefully reasonable).

Page 48: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Look-Ahead Carry Adders 48

Look-Ahead Carry Adder (1/6)

Consider the full adder:where intermediate signals are labelled as Pi, Gi, and defined as: Pi = XiYi

Gi = Xi.Yi

The outputs, Ci+1,Si, in terms of Pi ,Gi ,Ci , are:

Si = Pi Ci …(1)

Ci+1 = Gi + Pi.Ci …(2)

If you look at equation (2), Gi = Xi.Yi is a carry generate signal Pi = Xi Yi is a carry propagate signal

Xi

YiSi

Ci+1

Ci

Pi

Gi

Page 49: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Look-Ahead Carry Adder 49

Look-Ahead Carry Adder (2/6)

For 4-bit ripple-carry adder, the equations to obtain four carry signals are:

Ci+1 = Gi + Pi.Ci

Ci+2 = Gi+1 + Pi+1.Ci+1

Ci+3 = Gi+2 + Pi+2.Ci+2

Ci+4 = Gi+3 + Pi+3.Ci+3

These formula are deeply nested, as shown here for Ci+2:

Ci

PiCi+1

Gi

Pi+1

Gi+1

Ci+2

4-level circuit for Ci+2 = Gi+1 + Pi+1.Ci+1

Page 50: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Look-Ahead Carry Adder 50

Look-Ahead Carry Adder (3/6)

Nested formula/gates cause ripple-carry propagation delay.

Can reduce delay by expanding and flattening the formula for carries. For example, Ci+2

Ci+2 = Gi+1 + Pi+1.Ci+1

= Gi+1 + Pi+1.(Gi + Pi.Ci )

= Gi+1 + Pi+1.Gi + Pi+1.Pi.Ci

New faster circuit for Ci+2 Ci

Pi

Pi+1

Gi

Pi+1

Gi+1

Ci+2

Page 51: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Look-Ahead Carry Adder 51

Look-Ahead Carry Adder (4/6)

Other carry signals can also be similarly flattened. Ci+3 = Gi+2 + Pi+2Ci+2

= Gi+2 + Pi+2(Gi+1 + Pi+1Gi + Pi+1PiCi)

= Gi+2 + Pi+2Gi+1 + Pi+2Pi+1Gi + Pi+2Pi+1PiCi

Ci+4 = Gi+3 + Pi+3Ci+3

= Gi+3 + Pi+3(Gi+2 + Pi+2Gi+1 + Pi+2Pi+1Gi + Pi+2Pi+1PiCi)

= Gi+3 + Pi+3Gi+2 + Pi+3Pi+2Gi+1 + Pi+3Pi+2Pi+1Gi + Pi+3Pi+2Pi+1PiCi

Notice 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, Ci.

Page 52: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Look-Ahead Carry Adder 52

Look-Ahead Carry Adder (5/6)

We employ the look-ahead formula in this lookahead-carry adder circuit:

Page 53: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1104-6 Look-Ahead Carry Adder 53

Look-Ahead Carry Adder (6/6)

The 74182 IC chip allows faster lookahead adder to be built.

Maximum propagation delay is 4t (t to get generate & propagate signals, 2t to get the carries and t for the sum signals) where t is the average gate delay.

Page 54: CS1104: Computer Organisation cs1104 Lecture 6: Combinational Circuits Design Methods/Arithmetic Circuits cs1104

CS1103 Introduction

End of file