Chapter 4 Modular Combinational Logic. Decoders n to 2 n decoder n inputs 2 n outputs For each...

162
Chapter 4 Modular Combinational Logic

Transcript of Chapter 4 Modular Combinational Logic. Decoders n to 2 n decoder n inputs 2 n outputs For each...

Page 1: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Chapter 4

Modular Combinational Logic

Page 2: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Decoders

Page 3: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Decoders

n to 2n decoder n inputs 2n outputs

For each input, one and only one output will be active.

Uses: “Minterm generator” Wordline (memory) circuit Code conversion Routing data

Page 4: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder Example

Page 5: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder – Truth Table

2 to 4 decoder

X1 X0 Y3 Y2 Y1 Y0

0 0 0 0 0 1

0 1 0 0 1 0

1 0 0 1 0 0

1 1 1 0 0 0

Page 6: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder Equations

0 1 0

1 1 0

2 1 0

3 1 0

Y X X

Y X X

Y X X

Y X X

Page 7: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder: Circuit

Page 8: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder: Block Symbol

SymbolCircuit

Page 9: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

3 to 8 Decoder Example

Page 10: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

3 to 8 Decoder – Truth Table

x2 x1 x0 y7 y6 y5 y4 y3 y2 y1 y0

0 0 0 0 0 0 0 0 0 0 1

0 0 1 0 0 0 0 0 0 1 0

0 1 0 0 0 0 0 0 1 0 0

0 1 1 0 0 0 0 1 0 0 0

1 0 0 0 0 0 1 0 0 0 0

1 0 1 0 0 1 0 0 0 0 0

1 1 0 0 1 0 0 0 0 0 0

1 1 1 1 0 0 0 0 0 0 0

Page 11: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

3 to 8 Decoder Equations

0 2 1 0

1 2 1 0

2 2 1 0

3 2 1 0

Y X X X

Y X X X

Y X X X

Y X X X

4 2 1 0

5 2 1 0

6 2 1 0

7 2 1 0

Y X X X

Y X X X

Y X X X

Y X X X

Page 12: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

3 to 8 Decoder: Circuit

Page 13: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

3 to 8 Decoder: Block Symbol

Symbol

Circuit

Page 14: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Design Example

Page 15: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example

Using only a 3x8 decoder and two-input OR gates, design a logic circuit which implements the following Boolean equation

, , 2, 4,5F a b c m

Page 16: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Solution

m2

m4m5

Page 17: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder with Enable

Page 18: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2x4 Decoder with Enable

Enable is abbreviated as EN EN is called a Control Signal Control Signals can be

Active High Signal EN = 1 – Turns “ON” Decoder

Active Low Signal EN=0 – Turns “ON” Decoder

Page 19: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 x 4 Decoder with Active High Enable – Truth Table

En x1 x0 y3 y2 y1 y0

0 0 0 0 0 0 0

0 0 1 0 0 0 0

0 1 0 0 0 0 0

0 1 1 0 0 0 0

1 0 0 0 0 0 1

1 0 1 0 0 1 0

1 1 0 0 1 0 0

1 1 1 1 0 0 0

Page 20: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder with Enable Equations

0 1 0

1 1 0

2 1 0

3 1 0

n

n

n

n

Y E X X

Y E X X

Y E X X

Y E X X

Page 21: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder with Enable Circuit

Page 22: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder with Enable Symbol

Page 23: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 x 4 Decoder with Active High Enable – Truth Table (Short hand notation)

En x1 x0 y3 y2 y1 y0

0 d d 0 0 0 0

1 0 0 0 0 0 1

1 0 1 0 0 1 0

1 1 0 0 1 0 0

1 1 1 1 0 0 0

d = don’t care

En has “highest” priority. If En=0, we “don’t care” about x1 or x0 because Y=0

Page 24: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 x 4 Decoder with Active Low Enable – Truth Table (Short hand notation)

EnL x1 x0 y3 y2 y1 y0

1 d d 0 0 0 0

0 0 0 0 0 0 1

0 0 1 0 0 1 0

0 1 0 0 1 0 0

0 1 1 1 0 0 0

d = don’t care

En has “highest” priority. If En=1, we “don’t care” about x1 or x0 because Y=0

Page 25: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2 to 4 Decoder with Active Low Enable Circuit

Page 26: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Design Example

Page 27: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example

Design a 3x8 decoder using only 2x4 decoders and NOT gates.

Page 28: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Solution

“On” when A=1

“On” when A=0

Page 29: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

TPS Quiz

Page 30: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Encoders

Page 31: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Encoders

Opposite of a decoder 2n to n encoder

2n inputs n outputs

For each input, the circuit will produce an “encoded” output

Page 32: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: 4 to 2 Binary EncoderTruth Table

X3 X2 X1 X0 Y1 Y0

0 0 0 1 0 0

0 0 1 0 0 1

0 1 0 0 1 0

1 0 0 0 1 1

Assume only one input high at a time!!

Page 33: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

4 to 2 Encoder Equations

0 1 3

1 2 3

Y X X

Y X X

Page 34: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Problems with initial design

Q: How do we tell the difference between an input of all 0’s (i.e. X=0) and X=1?

A: Add another output (IA) that indicates that the input is valid. Let’s make IA active low.

0 1 2 3IA X X X X

Page 35: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Problems with initial design

If IA = 1 => all lines are 0If IA = 0 => at least one line is 1

Q: What happens if more than one input is high at the same time?

A: Design a “priority” encoder that will encode the input with the highest priority.

Let’s set X3 with the highest priority, followed by X2, X1, and X0

Page 36: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: 4 to 2 Priority Binary EncoderTruth Table

X3 X2 X1 X0 Y1 Y0

0 0 0 1 0 0

0 0 1 d 0 1

0 1 d d 1 0

1 d d d 1 1

Page 37: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Solution

x3x2x1x0 00 01 11 10

00

01

11

10

Y1

x3x2x1x0 00 01 11 10

00

01

11

10

Y0

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1 2 3Y X X 0 1 2 3Y X X X

Page 38: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

4 to 2 Priority Encoder Equations

0 1 2 3

1 2 3

Y X X X

Y X X

0 1 2 3IA X X X X

Page 39: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Multiplexer/Data Selectors

MUXVery Important Module!!!

Page 40: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Multiplexer(MUX)/Data Selector

N to 1 multiplexer n data input lines Log2(n) control inputs One output

This circuit will “connect” the selected input to the output. The selected input is specified by a decoding of the control inputs.

Page 41: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: 4 to 1 MUX Truth Table

D3 D2 D1 D0 A B F

d d d D0 0 0 D0

d d D1 d 0 1 D1

d D2 d d 1 0 D2

D3 d d d 1 1 D3

d = don’t care / Di = data on input i

Data InputsControlInputs

Output

Page 42: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

4 to 1 MUX Equation

0 1 2 3F D AB D AB D AB D AB

3

0i i

i

F Dm

D’s are the DATA inputs, AB are control inputs and calledthe “select” lines.

Page 43: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

4 to 1 MUX Circuit

2x4 Decoder Only a single AND gate willbe “ON” at a time.

Output

Control Inputs Data Inputs

Page 44: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

4 to 1 MUX Symbol

DataInputs

ControlInputs

Output

Page 45: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Data and Control Paths

Logic

Data PathInputs

Data PathOutputs

Control PathInputs

Control PathOutputs

Page 46: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

MUX Applications

Page 47: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example

Using a 4x1 MUX, design a logic circuit which implements:

Y a b We have,

Y

0 1 2 3Y D AB D AB D AB D AB

Page 48: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example

Using a 4x1 MUX, design a logic circuit which implements:

Y a b a b Y Dn

0 0 0 D0

0 1 1 D1

1 0 1 D2

1 1 0 D3

0 1 1 0Y AB AB AB AB AB AB

Page 49: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Solution

Page 50: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Multibit Multiplexers

Page 51: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Multi-bit Multiplexers

J-bit nx1 mux

sel

d0d1

dn-1

d2 FJ bitsdeep

log2n

J bitsdeep

0

j

i ii

F j D j m

j=0 to 3

This is just J separate nx1 multiplexers

Page 52: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4-bit 4x1 MUX

A B

D0[3..0]

D1[3..0]

D3[3..0]

D2[3..0]F[3..0] 4 bits

deep

D0[3..0]

D1[3..0]

D2[3..0]

D3[3..0]

A B

F[3..0]

3

0i i

i

F j D j m

j=0 to 3 This is just 4 separate 4x1 muxes

Page 53: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example

4-bit 4x1 MUX

0 1 2 30 0 0 0 0F D AB D AB D AB D AB

0 1 2 31 1 1 1 1F D AB D AB D AB D AB

0 1 2 32 2 2 2 2F D AB D AB D AB D AB

0 1 2 33 3 3 3 3F D AB D AB D AB D AB

Bit 0

Bit 3

Bit 2

Bit 1

Page 54: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4 bit 4x1 MUX

For the jth output, we have

D0[j]D1[j]D2[j]D3[j]AB

F[j]

Page 55: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4 bit 4x1 MUX

For the bit 0 output, we have

D0[0]D1[0]D2[0]D3[0]AB

F[0]

Page 56: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4 bit 4x1 MUX

For the bit 1 output, we have

D0[1]D1[1]D2[1]D3[1]AB

F[1]

Page 57: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4 bit 4x1 MUX

For the bit 2 output, we have

D0[2]D1[2]D2[2]D3[2]AB

F[2]

Page 58: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4 bit 4x1 MUX

For the bit 3 output, we have

D0[3]D1[3]D2[3]D3[3]AB

F[3]

Page 59: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4 bit 4x1 Mux

F[0]

F[1]

F[2]

F[3]

Complete Circuit

Bit 0

Bit 1

Bit 2

Bit 3

Page 60: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example 4 bit 4x1 MUX

Symbol

Page 61: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Design Example

Using a 4bit 4x1 MUX, design a 8bit4x1 MUX

Page 62: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Solution

Page 63: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

DeMultiplexers/Data Distributors

Page 64: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Demultiplexer/Data Distributor

Opposite of a multiplexer 1 to N demultiplexer

1 data input N data outputs Log2(n) control inputs

This circuit will “connect” a data input to one and only one output. The selected output is specified by a decoding of the control inputs.

Page 65: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: 1 to 4 DeMUX Truth Table

D A B F3 F2 F1 F0

D 0 0 0 0 0 D

D 0 1 0 0 D 0

D 1 0 0 D 0 0

D 1 1 D 0 0 0

d = don’t care / Di = data on input i

Page 66: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

1 to 4 DeMUX Equations

3 3F DAB Dm

j jF Dm

D is the DATA inputs, AB are control inputs and calledthe “select” lines.

1 1F DAB Dm 2 2F DAB Dm

0 0F DAB Dm

Page 67: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

1 to 4 DEMUX Circuit

Only 1 AND gate willbe “ON”

2x4 DecoderOnly oneF will beactive

Page 68: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

1 to 4 DEMUX Symbol

DataInput

SelectedLines

Outputs

Page 69: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example

Design a 3x8 decoder using only 2x4 decoders and NOT gates.

Page 70: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Solution

“On” when A=1

“On” when A=0

Page 71: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

TPS Quiz

Page 72: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Basic Arithmetic Elements

Half Adder

Page 73: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Half Adder-Truth Table

S=A+B (arithmetic sum)

A B S1 S0

0 0 0 0

0 1 0 1

1 0 0 1

1 1 1 0

0S a b

1S ab

Page 74: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Half Adder Circuit

Page 75: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Full Adder-Truth Table

S=A+B+C (arithmetic sum)

A B C S1 S0

0 0 0 0 0

0 0 1 0 1

0 1 0 0 1

0 1 1 1 0

0S a b c 1S ab ac bc

A B C S1 S0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 0

1 1 1 1 1

Page 76: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Full Adder

0S a b c

1S ab ac bc

You can show!!!

1S ab c a b

Page 77: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Synthesis

(0)S A B C Logic Equation

Logic Circuit

Page 78: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Synthesis

(1)S AB C A B Logic Equation

Logic Circuit

Page 79: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

17

AND2 18

OR2

19 coutOUTPUT16

AND2

VCC14 Cin INPUT

VCC13 B INPUT10

XOR

11

XOR

15 sumOUTPUT

VCC12 A INPUT

Synthesis Full Adder Circuit

S(0)

S(1)

C

AB

S(0)S(1)

Simulation

Page 80: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Verification

S(0)S(1)

We verify the circuit via a simulation

Logic SimulationInputs

OutputsS 00 01 01 10 01 01 01 11

Page 81: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

17

AND2 18

OR2

19 coutOUTPUT16

AND2

VCC14 Cin INPUT

VCC13 B INPUT10

XOR

11

XOR

15 sumOUTPUT

VCC12 A INPUT

Verification Summary

S(0)

S(1)

C

AB

S(0)S(1)

Simulation

Circuit

Page 82: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Documentation

17

AND2 18

OR2

19 coutOUTPUT16

AND2

VCC14 Cin INPUT

VCC13 B INPUT10

XOR

11

XOR

15 sumOUTPUT

VCC12 A INPUT

S(0)

S(1)

C

AB

FullAdderC

AB

S(0)

S(1)

Block Diagram

Page 83: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Ripple Carry Adder

Page 84: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Conceptualization

4-bit adder (worst case)

11111111

11110

111

For the “worst case” we need to addthree bits to generate a single output bitwith a possible carry out.Can we use our single bit adder for this?

Page 85: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Ripple Carry Adder

We can cascade several full adders to create a ripple carry adder

The circuit gets its name because the carry bit “ripples” from one bit position to the next

Page 86: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Conceptualization

FullAdderC

AB

S(0)

S(1)

FullAdderC

AB

S(0)

S(1)

First, let’s look at two bits

A(0)B(0)

B(1)A(1)

Sum(0)

Sum(1)

What about the carry?

Page 87: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Conceptualization

FullAdderC

AB

S(0)

S(1)

FullAdderC

AB

S(0)

S(1)

Let’s connect the two full adders

A(0)B(0)

B(1)A(1)

S(0)

S(1)

Set carry in for first bit to 0. Why?

Cout

Cin

0

Page 88: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Analysis

FullAdderC

AB

S(0)

S(1)

FullAdderC

AB

S(0)

S(1)

Let’s test this for a few cases:

0

0

00

0

000

0

0

0000

000

Correct!!!

Rule of thumb: Always test simple cases first!!

Page 89: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Analysis

FullAdderC

AB

S(0)

S(1)

FullAdderC

AB

S(0)

S(1)

Let’s test this for the a few cases

0

1

11

1

110

1

1

1111

110

Correct!!!

Page 90: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Analysis

FullAdderC

AB

S(0)

S(1)

FullAdderC

AB

S(0)

S(1)

Let’s test this for the a few cases

11

00

0

1

1

1

0

0

0101

010

Correct!!!

Page 91: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Four Bit “Ripple” Adder

Carry in

Carry out

Page 92: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Simulation

Page 93: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

8-bit Ripple Carry Adder

Use two 4-bit adders

Page 94: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

16-bit Ripple Carry Adder

Use two 8-bit adders

Page 95: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Subtraction Circuit

Page 96: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Subtraction Circuit

Calculate 2’s complement of B Add –B to A

ADDER

INV

A

B

S

1

Cin

A

B

1S A B A B A B

B

1

1S A B

Page 97: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Add/Sub Circuit

Page 98: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Add/Sub Circuit Module

Add/SubModule

A

B

S

Add

A

B

Add

S

Page 99: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Function Table for Add/Sub Module

Add FunctionalResult

0 S=A+B

1 S=A-B

Add is a control input. It is active low. This means that the module will compute A+B when Add=0. It will compute A-B when Add=1.

Page 100: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Add/Sub Circuit

Design using Modules

Page 101: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Add/Sub Circuit

ADDER

INV2x1

MUX

A

B

S

B

B

A

S Cin

A

Add

Page 102: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Add/Sub Circuit

ADDER

INV2x1

MUX

A

B

S

B

B

A

S Cin

A

Add

Add operation. Add=0

0 0

S A B

Page 103: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Add/Sub Circuit

ADDER

INV2x1

MUX

A

B

S

B

B

A

S Cin

A

Add

Sub operation. Add=1

1 1

1S A B

B

Page 104: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

TPS Quiz

17-18

Page 105: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Overflow/Underflow Detection

Page 106: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Numerical Overflow/Underflow

2’s complement number We have S=A+B

Range of sum

Overflow occurs if

Underflow occurs if

1 12 2 1n nS

12 1nS

12nS

Page 107: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: Overflow

Let n=4, Range is

Let A=$7, B=$7, then S=$7+$7=$E, but $E=%1110 = -2, so Overflow has occurred.

8 7S

3 32 2 1S

Page 108: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: Overflow

Let’s examine this more closely

-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7

+7

So, overflow is the same as “wrap around.”

8,9,A,B,C,D,E,F,0,1,2,3,4,5,6,7

Page 109: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: Underflow

Let n=4, let A=-7 and B=-7, in 2’s complement, A=B=$9,

S=$9+$9=$12=$02 so underflow has occurred.

Page 110: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example: Underflow

Let’s examine this more closely

-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7

+6

So, underflow is the same as “wrap around.”

+1

Page 111: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Overflow/Underflow Detection

How do we detect overflow and underflow? First adding a positive to a negative

number is always OK. 4 bit example: 7 + (-8) = -1

Let’s examine the sum of the MSB’s to determine overflow and underflow.

Set V=1, if overflow/underflow occurs

Page 112: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Examination of MSB

b a cin S Co V Explanation

0 0 0 0 0 0 A+B < 2n-1 (OK)

0 0 1 1 0 1 A+B>2n-1 -1 (overflow)

0 1 0 1 0 0 -A+B (OK)

0 1 1 0 1 0 -A+B (OK)

1 0 0 1 0 0 A-B (OK)

1 0 1 0 1 0 A-B (OK)

1 1 0 0 1 1 -A-B< -2n-1 (underflow)

1 1 1 1 1 0 -A-B > -2n-1 (OK)

a,b are the MSBs of A and B. cin is carry in; cout=carry out

Page 113: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Overflow/Underflow Detection

We find

1 1 , 1 1 1 , 1n n in n n n in nV a b c a b c

Page 114: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Overflow/Underflow Detection

, 1 , 1in n out nV c c

You can also use

That is, if for the MSB carry_in is not equal to carry_out, overflow or underflow has occurred.

Page 115: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

TPS Quiz

19-20

Page 116: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Comparators

Page 117: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Equal Comparator

Design a logic circuit which will compute

F0 = (A = B)

Page 118: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2-bit Equal Comparator Truth Table

b1 b0 a1 a0 F0

0 0 0 0 1

0 0 0 1 0

0 0 1 0 0

0 0 1 1 0

0 1 0 0 0

0 1 0 1 1

0 1 1 0 0

0 1 1 1 0

Page 119: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2-bit Equal Comparator Truth Table

b1 b0 a1 a0 F0

1 0 0 0 0

1 0 0 1 0

1 0 1 0 1

1 0 1 1 0

1 1 0 0 0

1 1 0 1 0

1 1 1 0 0

1 1 1 1 1

Page 120: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Solution

0 1 1 0 0F a b a b

You can show,

Page 121: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

N-bit Equal Comparator

0 1 1 1 1 0 0n nF a b a b a b

Page 122: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Not Equal Comparator

Design a logic circuit which will compute

F = (A <> B)

F = (A = B)

i.e. Just invert our Equal Comparator circuit

Page 123: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Magnitude Comparator

Design a logic circuit which will compute

F2 = (A>B)F1 = (A<B)

Let’s develop a truth table for 2-bits

Page 124: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2-bit Magnitude (unsigned) Comparator

Truth Table

b1 b0 a1 a0 F2 F1

0 0 0 0 0 0

0 0 0 1 1 0

0 0 1 0 1 0

0 0 1 1 1 0

0 1 0 0 0 1

0 1 0 1 0 0

0 1 1 0 1 0

0 1 1 1 1 0

Page 125: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

2-bit Magnitude (unsigned) Comparator

Truth Table

b1 b0 a1 a0 F2 F1

1 0 0 0 0 1

1 0 0 1 0 1

1 0 1 0 0 0

1 0 1 1 1 0

1 1 0 0 0 1

1 1 0 1 0 1

1 1 1 0 0 1

1 1 1 1 0 0

Page 126: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

You can show

2 1 1 0 1 0 1 0 0F a b a b b a a b

1 1 1 1 0 0 0 1 0F a b a a b a bb

Page 127: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

TPS Quiz

21

Page 128: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Logic Units (ALUs)

Page 129: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Logic Unit (ALU)

ALU

A[n-1,,0]

B[n-1..0]

F

S[m-1..0]

A,B are data inputs of n bits each in depthS is a control input. We have 2m operationsF is the output

Page 130: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Example Let n=4,m=3 We have A[3..0] and B[3..0] With m=3, we have 23 = 8 operations Let’s look at a possible function table

Page 131: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Function Table

s2 s1 s0 Function

0 0 0 F=AB

0 0 1 F=A+B (logical OR)

0 1 0 F=NOT A

0 1 1 F=A XOR B

1 0 0 F=A+B (Arithmetic)

1 0 1 F=A-B

1 1 0 F=A + 1

1 1 1 F=A - 1

Page 132: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Design using a Truth Table

How large is the truth table? 2n from data inputs A and B

Example: n=8, we have 16 data inputs A[7..0] and B[7..0]

3 control inputs Total of 2n+3 inputs

N=8, we have 19 inputs Our truth table will have 192 (361) rows and 8 outputs

Too complex. Let’s explore another alternative using a “system” or modular approach

Page 133: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Design using Modules

Note: For S2=0, we have logic operations For S2=1, we have arithmetic

operations So, let’s use S2 to control a 2x1 MUX to select between logic and arithmetic

operations, so our top level design would look like:

Page 134: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

ALU Design

LogicModule

ArithmeticModule

2x1MUX

S[2]

A B

A

A

B

F

A

BF

S[1..0]

S[1..0]

B

F F

Page 135: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

ALU Design S2=0

LogicModule

ArithmeticModule

2x1MUX

S[2]

A B

A

A

B

F

A

BF

S[1..0]

S[1..0]

B

F F

With S2=0, F is the output fromthe logic module

Page 136: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

ALU Design S2=1

LogicModule

ArithmeticModule

2x1MUX

S[2]

A B

A

A

B

F

A

BF

S[1..0]

S[1..0]

B

F F

With S2=1, F is the output fromthe arithmetic module

Page 137: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Module Design

Page 138: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Function Table for Logic Module

S2=0

s2 s1 s0 Function

0 0 0 F=AB

0 0 1 F=A+B (logical OR)

0 1 0 F=NOT A

0 1 1 F=A XOR B

We can use a 4x1 mux to implement this module

Page 139: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Module Design

OR

NOT

XOR

AND

A

B

C

D

4X1

F

S[1..0]

S1 S0

A

A

B

F

A

B

F

A

B

F

A F

B

Page 140: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Module Design

OR

NOT

XOR

AND

A

B

C

D

4X1

F

S[1..0]

S1 S0

A

A

B

F

A

B

F

A

B

F

A F

B

AND OperationS[1..0]=00

0 0

F=AB

Page 141: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Module Design

OR

NOT

XOR

AND

A

B

C

D

4X1

F

S[1..0]

S1 S0

A

A

B

F

A

B

F

A

B

F

A F

B

OR OperationS[1..0]=01

0 1

F=A+B

Page 142: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Module Design

OR

NOT

XOR

AND

A

B

C

D

4X1

F

S[1..0]

S1 S0

A

A

B

F

A

B

F

A

B

F

A F

B

NOT OperationS[1..0]=10

1 0

F=A

Page 143: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Module Design

OR

NOT

XOR

AND

A

B

C

D

4X1

F

S[1..0]

S1 S0

A

A

B

F

A

B

F

A

B

F

A F

B

XOR OperationS[1..0]=11

1 1

F=A XOR B

Page 144: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

What do these logic moduleslook like?

Page 145: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

AND Module

ANDA

B

F

Page 146: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

OR Module

Page 147: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

NOT Module

NOTA F

Page 148: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

XOR Module

Page 149: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Module

Let’s use our ADD/SUB Module

Page 150: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Add/Sub Circuit Module

Add/SubModule

A

B

S

Add

A

B

Add

S

Page 151: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Function Table for Arithmetic Ops

s2 s1 s0 Function

1 0 0 F=A+B (Arithmetic)

1 0 1 F=A-B

1 1 0 F=A + 1

1 1 1 F=A - 1

Note:S0 can be use to indicate Addition or Subtraction.S1 can be use to indicate the B data input

Page 152: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Module Design

Add/SubModule

S0

A

B

Add

S

S

2X1

A

B

FVDD

S1

B

A

S

Page 153: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Module Design

Add/SubModule

S0

A

B

Add

S

S

2X1

A

B

FVDD

S1

B

A

S

00

F=A+B

S[1..0]=00

Page 154: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Module Design

Add/SubModule

S0

A

B

Add

S

S

2X1

A

B

FVDD

S1

B

A

S

10

F=A-B

S[1..0]=01

Page 155: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Module Design

Add/SubModule

S0

A

B

Add

S

S

2X1

A

B

FVDD

S1

B

A

S

01

F=A+1

S[1..0]=10

Page 156: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Module Design

Add/SubModule

S0

A

B

Add

S

S

2X1

A

B

FVDD

S1

B

A

S

11

F=A-1

S[1..0]=11

Page 157: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Overall Design

We have

Page 158: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

ALU Design

LogicModule

ArithmeticModule

2x1MUX

S[2]

A B

A

A

B

F

A

BF

S[1..0]

S[1..0]

B

F F

Page 159: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Logic Module Design

OR

NOT

XOR

AND

A

B

C

D

4X1

F

S[1..0]

S1 S0

A

A

B

F

A

B

F

A

B

F

A F

B

Page 160: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Arithmetic Module Design

Add/SubModule

S0

A

B

Add

S

S

2X1

A

B

FVDD

S1

B

A

S

Page 161: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

Total Design

OR

NOT

XOR

AND

A

B

C

D

4X1

F

S[1..0]

Add/SubModule

A

S

S0

A

B

Add

S

B

S

F2X1

S2

S

2X1

A

B

FVDD

S1 S0

S1

A B

A

B

F

A

B

F

A

B

F

A F

Logic Module

Arithmetic Module

Page 162: Chapter 4 Modular Combinational Logic. Decoders  n to 2 n decoder n inputs 2 n outputs  For each input, one and only one output will be active.  Uses:

End of Chapter 4