functions of combaitional logic circuits...a decoder is a logic circuit that detects the presence of...

63
Unit Five FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS

Upload: others

Post on 10-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Unit Five

FUNCTIONS OF

COMBAITIONAL LOGIC

CIRCUITS

Page 2: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 3: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Basic rules of binary addition are performed by a half adder, which has two

binary inputs (A and B) and two binary outputs (Carry out and Sum).

Half-Adder

The inputs and outputs can be summarized on a truth table.

OutputsInputs

A B C out S

0011

0101

0 00 10 11 0

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 10

S= A B

Cout = A B

Page 4: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Half-Adder

A

B

S

Cout

The logic symbol and equivalent circuit are:

A

B

S

Cout

S

Page 5: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Full-Adder

By contrast, a full adder has three binary inputs (A, B, and Carry in) and

two binary outputs (Carry out and Sum). The truth table summarizes the

operation.

OutputsInputs

A B C out SCin

0

1

0

1

0

1

0

1

0

0

0

0

0

0

1

1

1

1

0

0

1

1

1

1

0

0

0

1

0

1

1

0

0

1

1

0

1

1

0

1

Page 6: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Full-Adder

By contrast, a full adder has three binary inputs (A, B, and Carry in) and

two binary outputs (Carry out and Sum). The truth table summarizes the

operation.

A full-adder can be constructed from two half adders as shown:

A

B

S

Cout

S A

B

S

Cout

S A

B

Sum

Cout

Cin

A

B

S

Cout

S

Cin

Symbol

Page 7: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Full-Adder A

B

S

Cout

S A

B

S

Cout

S

For the given inputs, determine

the intermediate and final outputs

of the full adder.

1

1

0

1

0

The first half-adder has inputs of 1 and 0;

therefore the Sum =1 and the Carry out = 0.

The second half-adder has inputs of 1 and 1; therefore the

Sum = 0 and the Carry out = 1.

The OR gate has inputs of 1 and 0, therefore the final carry

out = 1.

1

0

1

Sum

Cout

Page 8: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Full-Adder

OutputsInputs

A B C out SCin

0

1

0

1

0

1

0

1

0

0

0

0

0

0

1

1

1

1

0

0

1

1

1

1

0

0

0

1

0

1

1

0

0

1

1

0

1

1

0

1

A

B

S

Cout

S A

B

S

Cout

S 1

1

0

1

0 1

0

1

Sum

Cout

Notice that the result from the previous example can be read directly on

the truth table for a full adder.

Page 9: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Full-Adder

Determine the outputs of a full-adder for each of the following inputs:

Answers

What are the full-adder inputs that will produce each of the following

outputs:

Answers

Page 10: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Parallel Adders

Page 11: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Parallel Adders

Determine the sum generated by the 3-bit parallel adder in the Figure

and show the intermediate carries when the binary numbers 101 and

011 are being added.

Page 12: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Parallel Adders

Full adders are combined into parallel adders that can add binary numbers with multiple

bits. A 4-bit adder is shown.

A B

S Cout

Cin A B

S Cout

Cin A B

S Cout

Cin A B

S Cout

Cin

A1 B1

S1

C0

S2 S3 S4

C1 C2 C3 C4

A2 B2 A3 B3 A4 B4

The output carry (C4) is not ready until it propagates through all of the full adders.

This is called ripple carry, delaying the addition process.

Page 13: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Parallel Adders

Page 14: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Parallel Adders

The 74LS283 is an example. It features look-ahead carry, which adds logic to minimize

the output carry delay. For the 74LS283, the maximum delay to the output carry is 17

ns.

Page 15: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Parallel Adders

The logic symbol for a 4-bit parallel adder is shown. This 4-bit adder includes a carry in

(labeled (C0) and a Carry out (labeled C4).

Binary

number A

Binary

number

B

Input

carry

4-bit sum

Output

carry

1

2

3

4

1

2

3

4

1

2

3

4

C0 C4

S

Page 16: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Adder Expansion

Show how two 74LS283 adders can be connected to form an 8-bit

parallel adder. Show output bits for the following 8-bit input numbers:

Page 17: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Adder Expansion

Page 18: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 19: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

The input waveforms in the Figure are applied to a 2-bit adder.

Determine the waveforms for the sum and the output carry in relation to

the inputs by constructing a timing diagram

Page 20: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Comparators

The function of a comparator is to compare the magnitudes of two binary numbers to

determine the relationship between them. In the simplest form, a comparator can test for

equality using XOR or XNOR gates.

Page 21: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Comparators

Page 22: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Comparators

Page 23: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Comparators

Page 24: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 25: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Comparators

IC comparators provide outputs to indicate which of the numbers is larger or if they are

equal. The bits are numbered starting at 0, rather than 1 as in the case of adders.

Cascading inputs are provided to expand the comparator to larger numbers.

Outputs

A1

A0

A2

A3

B1

B0

B2

B3

Cascading

inputs

COMP

A = B

A < B

A > B

A = B

A < B

A > B

0

0

3

3

A

A

The IC shown is the

4-bit 74LS85.

Page 26: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 27: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 28: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Comparators

IC comparators can be expanded using the cascading inputs as shown. The lowest order

comparator has a HIGH on the A = B input.

Outputs

A1 A0

A2 A3

B1

B0

B2 B3

COMP

A = B

A < B

A > B

A = B

A < B

A > B

0

0

3

3

A

A

A5 A4

A6 A7

B5

B4

B6 B7

+5.0 V

COMP

A = B

A < B

A > B

A = B

A < B

A > B

0

0

3

3

A

A

LSBs MSBs

Page 29: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

A decoder is a logic circuit that detects the presence of a specific combination of bits at

its input. Two simple decoders that detect the presence of the binary code 0011 are

shown. The first has an active HIGH output; the second has an active LOW output.

A1

A0

A2

A3

X

Active HIGH decoder for 0011

A1

A0

A2

A3

X

Active LOW decoder for 0011

Page 30: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

A0 = 0

A1 = 1

A2 = 0

A3 = 1

1

Assume the output of the decoder shown is a

logic 1. What are the inputs to the decoder?

Page 31: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

Show the decoding logic for each of the following codes if an active-

HIGH (1) output is required:

a) 101010 b) 1110 110

Page 32: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

If the input waveforms are applied to the decoding logic as indicated in

the Figure, sketch the output waveform in proper relation to the inputs.

Page 33: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

THE 74HC154 4-To-16 DECODER ��

A specific

integrated circuit

decoder is the

74HC154 (shown

as a 4-to-16

decoder). It

includes two active

LOW chip select

lines which must

be at the active

level to enable the

outputs. These

lines can be used to

expand the decoder

to larger inputs.

Page 34: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

IC decoders have multiple outputs to decode any combination of inputs.

For example the binary-to-decimal decoder shown here has 16 outputs –

one for each combination of binary inputs.

Page 35: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

IC decoders have multiple outputs to decode any combination of inputs.

For example the binary-to-decimal decoder shown here has 16 outputs –

one for each combination of binary inputs.

Bin/Dec

A0

0123456789

101112131415

4-bit binary

input

Decimaloutputs

A1

A2

A3

1

1

0

1111111111101111

1

For the input shown, what is the output?

Page 36: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

A certain application requires that a 5-bit number be decoded. Use

74HCl54 decoders to implement the logic.

Page 37: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

BCD-to-decimal decoders

BCD-to-decimal decoders accept a binary coded decimal input and activate one of

ten possible decimal digit indications.

BCD/DEC0

1

2

3

4

5

6

7

8

9

1

2

4

8

74HC42

(11)

(10)

(9)

(7)

(6)

(5)

(4)

(3)

(2)

(1)

(15)

(14)

(13)

(12)

A1

A0

A2

A3

Page 38: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 39: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

BCD-to-decimal decoders accept a binary coded decimal input and activate one of

ten possible decimal digit indications. BCD/DEC

0

1

2

3

4

5

6

7

8

9

1

2

4

8

74HC42

(11)

(10)

(9)

(7)

(6)

(5)

(4)

(3)

(2)

(1)

(15)

(14)

(13)

(12)

A1

A0

A2

A3

Assume the inputs to the 74HC42

decoder are the sequence 0101, 0110,

0011, and 0010. Describe the output.

All lines are HIGH except for one active output, which is

LOW. The active outputs are 5, 6, 3, and 2 in that order.

Page 40: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

Page 41: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

Page 42: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

Page 43: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 44: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

BCD Decoder/Driver

BCD-to-seven segment

Another useful decoder is the 74LS47. This is a BCD-to-

seven segment display with active LOW outputs.

The a-g outputs are

designed for much

higher current than most

devices (hence the word

driver in the name).

a

b

c

d

e

f

g

1

2

4

8

(16)

(4)

(13)

(12)

(11)

(10)

(9)

(15)

(14)

(1)

(2)

(6)

(7)

(3)

(5)

(8)

BCD

inputs Outputs

to seven

segment

device

GND

VCC

BCD/7-seg

BI/RBO BI/RBO

LT

RBI

LT

RBI

74LS47

Page 45: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

BCD Decoder/Driver

Here the 7447A is an connected to an LED seven segment

display. Notice the current limiting resistors, required to

prevent overdriving the LED display.

VCC

GND

+5.0 V

+5.0 V

R's =

330 W

ab

cde

fg

ab

cde

fg

MAN7274LS47

LT

BI/RBO

RBI

1.0 kW

1

1 2

2

3, 9, 143

4

5

6

7

7

8

8

9

10

10

11

11

12 13

13

14

15

16

BCD/7-seg

BCDinput

D

C

B

A

Page 46: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decoders

Page 47: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Encoders

Encoder is a combinational circuit which is designed to

perform the inverse operation of the decoder. An encoder has

n number of input lines and m number of output lines. An

encoder produces an m bit binary code corresponding to the

digital input number.

Page 48: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

The decimal to BCD encoder, is an encoder with an input for each of the

ten decimal digits and four outputs that represent the BCD code for the

active digit. The basic logic diagram is shown. There is no zero input

because the outputs are all LOW when the input is zero.

975310 A

76321 A

76542 A

983 A

Decimal-To-BCD Encoder

Page 49: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decimal-To-BCD Encoder

Page 50: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Show how the decimal-to-BCD encoder converts the

decimal number 3 into a BCD 0011.

Page 51: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 52: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

This is a special type of encoder. Priority is given to the input lines. If

two or more input lines are 1 at the same time, then the input line with

highest priority will be considered.

Priority Encoder

Page 53: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

D3 D2 D1 D0 O1 O0

0 0 0 0 0 0

0 0 0 1 0 0

0 0 1 0 0 1

0 0 1 1 0 1

0 1 0 0 1 0

0 1 0 1 1 0

0 1 1 0 1 0

0 1 1 1 1 0

1 0 0 0 1 1

1 0 0 1 1 1

1 0 1 0 1 1

1 0 1 1 1 1

1 1 0 0 1 1

1 1 0 1 1 1

1 1 1 0 1 1

1 1 1 1 1 1

Priority Encoder

Page 54: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

2130 DDDO 231 DDO

Page 55: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

H.W. Deduce the logical expressions for the outputs

Q0,Q1,Q2

Page 56: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Here, inputs 0-7 are the input signals -- again, these are Active-LOW.

The chip encodes the input into a 3 digit output, A0 (1's bit), A1 (2's

bit), and A3 (4's bit).

EI enables the inputs. When it is LOW, the chip works properly.

When it's HIGH, all outputs are set to HIGH regardless of the input.

EO and GS are outputs that we can ignore for now.

74HC148 (8 to 3) Encoder

Page 57: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

How to implement 16-to-4 encoder from 8-to-3 encoders

Page 58: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Decimal-to-BCD Encoder

The 74HC147 is an example of an IC encoder. It is has ten active-LOW

inputs and converts the active input to an active-LOW BCD output.

This device is offers additional flexibility in that it is a priority encoder. This

means that if more than one input is active, the one with the highest order

decimal digit will be active.

Page 59: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Example

A 74HCI47 encoder has LOW levels on pins 2, 5, and 2. What BCD

code appears on the outputs if all the other inputs are HIGH?

Page 60: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the
Page 61: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Code converters There are various code converters that change one code to another. Two

examples are the four bit binary-to-Gray converter and the Gray-to-

binary converter.

Binary to Gray Converter

Page 62: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Gray to Binary Converter

Page 63: FUNCTIONS OF COMBAITIONAL LOGIC CIRCUITS...A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the

Show the conversion of binary 0111 to Gray and back.

0 0

0

1

1

1

Binary-to-Gray Gray-to-Binary

MSB

LSB

MSB

LSB

1

0

0

0

1

0

0

1

1

1

H.W. Design a binary to excess 3 converter