• Aucun résultat trouvé

Functions and Functional Blocks

N/A
N/A
Protected

Academic year: 2022

Partager "Functions and Functional Blocks"

Copied!
53
0
0

Texte intégral

(1)

ELEN0040 - Electronique num´erique

Patricia ROUSSEAUX

Ann´ee acad´emique 2014-2015

(2)

CHAPITRE 3

Combinational Logic Circuits

ELEN0040 3 - 96

(3)

1 Combinational Functional Blocks 1.1 Rudimentary Functions

1.2 Functions and Functional Blocks 1.3 Decoders

1.4 Encoders 1.5 Multiplexers

1.6 Implementing Combinational Functions with Multiplexers

2 Arithmetic Functions 2.1 Binary Adders

2.2 Binary Arithmetic

2.3 Binary Adders-Subtractors 2.4 Overflow

2.5 Other Arithmetic Functions

(4)

Functions and Functional Blocks

Introduction of fundamental components performing basic combinational functions

The basic functions considered are those found to be very useful in design : decoding, encoding, selecting

Corresponding to each of the functions is a combinational circuit implementation called a functional block : decoder, encoder and multiplexer

In the past, functional blocks were packaged as

small-scale-integrated (SSI), medium-scale integrated (MSI), and large-scale-integrated (LSI) circuits.

Today, they are often simply implemented within a very-large-scale-integrated (VLSI) circuit.

ELEN0040 3 - 98

(5)

Multiple-bit Rudimentary Functions

Multi-bit Examples:

A wide line is used to represent a bus which is a vector signal

In (b) of the example, F = (F3, F2, F1, F0) is a bus.

The bus can be split into individual bits as shown in (b)

Sets of bits can be split from the bus : (c) bits 2 and 1 of F.

The sets of bits need not be continuous : (d) bits 3, 1, and 0 of F.

F (d) 0

F3

1 F2

F1

A F0

(a)

0 1 A

1 2 3

4 F

0

(b)

4 2:1 2 F(2:1) F

(c)

4 3,1:0 3 F(3), F(1:0)

A A

(6)

Enabling Function

Enabling permits an input signal to pass through to an output

Disabling blocks an input signal from passing through to an output, replacing it with a fixed value !

The value on the output when it is disable can be 0 , or 1

When disabled, 0 output

When disabled, 1 output

100

X F

EN

(a)

EN

X F

(b)

(7)

Decoding ( n → m ; n < m )

Decoding - the conversion of an n-bit input code to an m-bit output code with

nm ≤ 2

n

such that each valid input code word produces a unique output code

Circuits that perform decoding are called decoders Here, functional blocks for decoding are

• called : n-to-m line decoders, where m ≤ 2

n

, and

• generate 2

n

(or fewer) minterms for the n input

variables

(8)

Decoder Examples

1-to-2-Line Decoder

2-to-4-Line Decoder

102

The 2-4-line decoder is made up of 2 1-to-2-line decoders and 4 AND gates.

A D0 D1

0 1 0

1 0 1

(a) (b)

D15 A A

D05 A

A1

0 0 1 1

A0

0 1 0 1

D0

1 0 0 0

D1

0 1 0 0

D2

0 0 1 0

D3

0 0 0 1 (a)

(b)

D0 5 A1A0

D1 5 A1A0

D2 5 A1A0

D3 5 A1A0 A1

A0

(9)

Decoder Expansion

For a larger decoder with n inputs and 2n outputs, use hierarchical design

Split the decoder into smaller dimensions ones At each stage, divide by 2 the number of inputs The output AND gates are driven by two decoders with their numbers of inputs either equal or differing by 1.

These decoders are then designed using the same procedure until 2-to-1-line decoders are reached.

The procedure can be modified to apply to decoders with the number of outputs ≠ 2n

(10)

Decoder Expansion - Example 1

3-to-8-line decoder

Number of inputs n=3

• Number of output ANDs m=23=8

• First split : 3 = 1*2 + 1

One 2-to-4-line decoder One 1-to-2-line decoder

• Second split : split the 2-to-4-line decoder, 2=2*1

Two 1-to-2-line decoders

At each stage, each decoder with k (k>1) inputs provides its 2k outputs through 2k 2-AND gates

104

(11)

Decoder Expansion - Example 1

Circuit

1-to-2-Line decoders

4 2-input ANDs 8 2-input ANDs

2-to-4-Line decoder

D0 A0

A1

A2

D1

D2

D3

D4

D5

D6

D7

(12)

Decoder Expansion - Example 2

7-to-128-line decoder

• Number of output ANDs m=27= 128

Number of inputs n= 7

• First split : 7=1*4+1*3

One 4-to-16-line decoder One 3-to-8-line decoder

• Second split :

4-to-16-line decoder : 4=2*2 Two 2-to-4-line decoders 3-to-8-line decoder : 3=1*2+1 One 2-to-4-line decoder + one 1-to-2-line decoder

• Third split :

2-to-4-line decoders : 2=2*1 Two 1-to-2-line decoders

106

(13)

7-to-128-line decoder : hierarchical structure

128 2-ANDs 16 2-ANDs

8 2-ANDs 4 2-ANDs

4 2-ANDs

4 2-ANDs DEC 1-2

DEC 1-2

DEC 1-2

DEC 1-2

DEC 1-2

DEC 1-2

DEC 1-2 DEC 2-4

DEC 2-4

DEC 2-4

DEC 3-8 DEC 4-16

7 inputs

(14)

Decoder with Enable

In general, attach m-enabling circuits to the outputs See truth table below for function

Note the use of X’s to denote both 0 and 1 in the inputs

Combination containing two X’s represent four binary combinations

Demultiplexer : distribute value of signal EN to 1 of 4 outputs

In this case,

input data =EN

Selection inputs = A1, A0

108

EN A1

A0

D0

D1

D2

D3

(b) EN A1 A0 D0 D1 D2 D3

0 1 1 1 1

X 0 0 1 1

X 0 1 0 1

0 1 0 0 0

0 0 1 0 0

0 0 0 1 0

0 0 0 0 1 (a)

(15)

Combinational Logic Implementation

Decoder and OR Gates A decoder provides 2

n

minterms

Any function can be represented by its SOM expression

A decoder can be used to implement m functions of n variables :

• Find the sum-of-minterms expressions

Use one n-to-2n-line decoder

Use m OR gates, one for each output

Not always the best solution !

(16)

Decoder and OR Gates Example

Implement the following set of odd parity functions of (A7, A6, A5, A3)

P1 = A7 A5 A3 P2 = A7 A6 A3 P4 = A7 A6 A5

Finding sum of

minterms expressions

P1 = Σm(1,2,5,6,8,11,12,15) P2 = Σm(1,3,4,6,8,10,13,15) P4 = Σm(2,3,4,5,8,9,14,15)

Find circuit

Best solution ? Better to resort to XOR gates

110

+ + +

+ + +

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

A7 A6 A5 A3

P

1

P

4

P

2

DEC 4-16

(17)

Encoding

Encoding - the opposite of decoding - the conversion of an m-bit input code to a n-bit output code with

nm ≤ 2

n

such that each valid code word produces a unique output code

Circuits that perform encoding are called encoders

An encoder has 2

n

(or fewer) input lines and n output lines which generate the binary code corresponding to the input values

Typically, an encoder converts a code containing

exactly one bit that is 1 to a binary code corresponding

to the position in which the 1 appears.

(18)

Encoder Example

A decimal-to-BCD encoder

• Inputs: 10 bits corresponding to decimal digits 0 through 9, (D0, …, D9)

• Outputs: 4 bits with BCD codes

• Function: If input bit Di is a 1, then the output (A3, A2, A1, A0) is the BCD code for i

The truth table could be formed, but alternatively, the equations for each of the four outputs can be obtained directly.

112

(19)

Encoder Example (continued)

(20)

Encoder Example (continued)

Input D

i

is a term in equation A

j

if bit A

j

is 1 in the binary coded value of i.

Equations:

A

3

= D

8

+ D

9

A

2

= D

4

+ D

5

+ D

6

+ D

7

A

1

= D

2

+ D

3

+ D

6

+ D

7

A

0

= D

1

+ D

3

+ D

5

+ D

7

+ D

9

114

(21)

Priority Encoder

If more than one input value is 1, then the encoder just designed does not work.

One encoder that can accept all possible combinations of input values and produce a meaningful result is a priority encoder.

It implements a priority function, one 1 value is given the priority above others

For example, among the 1s that appear, it selects the most significant input position (or the least significant input position) containing a 1 and responds with the corresponding binary code for that position.

(22)

Priority Encoder Example

Priority encoder with 5 inputs (D4, D3, D2, D1, D0) - highest priority to most significant 1 present –

Code outputs A2, A1, A0 and V where V indicates at least one 1 present.

In the Table, X in input variable represent 0 or 1 so that row 6 of the table represents 16 rows of the truth table

116

No. of Min- terms/Row

Inputs Outputs

D4 D3 D2 D1 D0 A2 A1 A0 V

1 0 0 0 0 0 X X X 0

1 0 0 0 0 1 0 0 0 1

2 0 0 0 1 X 0 0 1 1

4 0 0 1 X X 0 1 0 1

8 0 1 X X X 0 1 1 1

16 1 X X X X 1 0 0 1

(23)

Priority Encoder Example (continued)

Equations (after simplification) :

A

2

= D

4

A

1

= D

3

+ D

2

= F

1

, F

1

= (D

3

+ D

2

) A

0

= D

3

+ D

1

= (D

3

+ D

1

)

V = D

4

+ F

1

+ D

1

+ D

0

D

3

D

4

D

4

D

3

D

4

D

4

D

4

D

2

D

4

D

2

(24)

Selecting

Selecting data or information is a critical function in digital systems and computers

Circuits that perform selecting have:

A set of information inputs from which the selection is made

A single output

A set of control lines for making the selection

Logic circuits that perform selecting are called multiplexers

118

(25)

Multiplexers

A multiplexer selects information from an input line and directs the information to the output line A typical multiplexer has n control inputs

(S

n - 1

, … S

0

) called selection inputs, 2

n

information inputs (I

2n - 1

, … I

0

), and one output Y A multiplexer can be designed to have m

information inputs with m < 2

n

as well as n

selection inputs

(26)

Multiplexers (2)

120

Input Selection

Inputs Output

(27)

2-to-1-Line Multiplexer

Two information inputs I

0

, I

1

, so n=1 A single selection input S:

S = 0 selects input I0

S = 1 selects input I1

Truth table : The equation:

Y = I S

0

+ SI

1

(28)

2-to-1-Line Multiplexer

The circuit:

We recognize :

1-to-2-line Decoder

2 Enabling circuits

2-input OR gate

122

S

I0

I1

Decoder Enabling

Circuits

Y

(29)

2

n

-to-1-Line Multiplexer

For n>1 selecting inputs

An 2

n

-to-1-line multiplexer can be built from :

one n-to-2n-line decoder generating the mi

• one 2n × 2 AND-OR circuit combining the enabling circuits and the OR gate

Example : n=2 Equation

+

+ +

(30)

Example: 4-to-1-line Multiplexer

one 2-to-22-line decoder one 22 × 2 AND-OR

124

S1

Decoder

S0

Y S1

Decoder

S0

Y

S1 Decoder

4 3 2 AND-OR S0

Y I2

I3 I1 I0

Inputs !

4×2 AND-OR mi

(31)

Multiplexer with m outputs

Select “vectors of bits” instead of “bits”

Use multiple copies of 2

n

× 2 AND-OR in parallel Example: m=4

4-to-1-line quad multi- plexer

4 3 2 AND-OR

2-to-4-Line decoder

4 3 2 AND-OR

4 3 2 AND-OR

4 3 2 AND-OR I0,0

I3,0

I0,1

I3,1

I0,2

I3,2

I0,3

I3,3

Y0

D0

D3 A0

A1

Y1

Y2

Y3 ..

.

.. .

.. .

.. .

.. . 4×2 AND-OR

4×2 AND-OR

4×2 AND-OR

4×2 AND-OR

(32)

Combinational Logic Implementation - Multiplexer Approach 1

Multiplexing is a universal function

Any combinational n-variable function can be implemented with a

• A sum-of-minterms expression

• An 2n-to-1-line multiplexer

Design :

• Apply the function input variables to the multiplexer selection inputs Sn - 1, … , S0

• Find the SOM expression from the truth table

• Put values to multiplexer inputs :

If minterm mj is present in SOM, put Ij=1

If minterm mj is not present in SOM, put Ij=0

126

(33)

Example : F(X,Y) = Ʃm(0, 3)

S1 Decoder

S0

Y

S1 Decoder

S0

Y

S1 Decoder

4 3 2 AND-OR S0

Y I2

I3 I1 I0

Y X

m0

m1

m2

m3

1

1 0 0

4×2 AND-OR

(34)

Example: Gray to Binary Code

Design a circuit to convert a 3-bit Gray code to a binary code The formulation gives the truth table on the right

It is obvious from this table that X = C and the Y and Z are more complex

128

Gray A B C

Binary x y z 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 1 1 1 1

(35)

Gray to Binary (continued)

Rearrange the table so

that the input combinations are in counting order

Functions y and z can be implemented using a dual 8-to-1-line

multiplexer by:

• connecting A, B, and C to the multiplexer select inputs

• placing y and z on the two multiplexer outputs

• connecting their respective truth table values to the inputs

Gray A B C

Binary x y z 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 1 0 1 1 1 1 0 1

(36)

Gray to Binary (continued)

, , , , , ,

130

D04 D05 D06 D07 S1 S0 A

B

S2 D03 D02 D01 D00

Out

C

D14 D15 D16 D17 S1 S0 A

B

S2 D13 D12 D11 D10

Out

C 1

1

1 1 1

1

1 1

0 0 0

0

0

0 0

0

Y Z

8-to-1 MUX

8-to-1 MUX

Gray A B C

Binary x y z 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 1 0 1 1 1 1 0 1

(37)

Combinational Logic Implementation

- Multiplexer Approach 2

(more economical !)

A simpler implementation is obtained by using :

• A 2n-1-to-1-line multiplexer

A single inverter

Design:

• Apply the first n-1 function input variables to the multiplexer selection inputs Sn - 2, … , S0

• Find the SOM expression from the truth table

• Define the multiplexer inputs to get the minterms of the function :

let be the n-th function input variable each multiplexer input is either : 1, 0, or

(38)

Gray to Binary (continued)

132

Gray A B C

Binary x y z

Rudimentary Functions of

C for y

Rudimentary Functions of

C for z

0 0 0 0 0 0

0 0 1 1 1 1

0 1 0 0 1 1

0 1 1 1 0 0

1 0 0 0 0 1

1 0 1 1 1 0

1 1 0 0 1 0

1 1 1 1 0 1

F = C F = C

F = C F = C F = C

F = C F = C

F = C

(39)

Gray to Binary (continued)

Assign the variables and functions to the multiplexer inputs:

Note that this approach (Approach 2) reduces the cost by almost half compared to Approach 1.

S1 S0 A

B

D03 D02 D01 D00

Out Y

8-to-1 MUX C

C C

C D13

D12 D11 D10

Out Z

8-to-1 S1 MUX

S0 A

B C

C C

C C C

Y m 1,2,5,6 Z m 1,2,4,7

(40)

Summary

Decoder :

n inputs

m outputs, n m 2n

generate minterms : output Di = mi

Encoder :

2n inputs = 2n minterms, only one equal to 1

n outputs

generate the binary

representation of the input values : n-bit representation

ELEN0040 3 - 134

(41)

Summary (continued)

Multiplexer :

n selecting inputs

2n information inputs

one output

select binary information from one input

F = ¯S1S¯0D0 + ¯S1S0D1 + S1S¯0D2 + S1S0D3

(42)

1 Combinational Functional Blocks 1.1 Rudimentary Functions

1.2 Functions and Functional Blocks 1.3 Decoders

1.4 Encoders 1.5 Multiplexers

1.6 Implementing Combinational Functions with Multiplexers

2 Arithmetic Functions 2.1 Binary Adders

2.2 Binary Arithmetic

2.3 Binary Adders-Subtractors 2.4 Overflow

2.5 Other Arithmetic Functions

ELEN0040 3 - 136

(43)

Arithmetic circuits

An arithmetic circuit is a combinational circuit that performs arithmetic operations :

addition

subtraction

multiplication

division

The operations are performed with binary numbers or decimal numbers in a binary code

Apply the rules of arithmetic with binary numbers

rules for numbers representation

resort to 1 or 2’s complements

An arithmetic circuit :

operates on binary vectors

uses the same subfunction for each bit position

is made of the iterative interconnection of basic functional blocks, one for each bit position = iterative array

(44)

Adders

Functional blocks :

Half-Adder : a 2-input, 2-output functional block that performs the addition of the two input bits

Full-Adder : a 3-input, 2-output functional block that performs the addition of the three input bits, including a third carry input bit obtained from a previous adder

Multiple bit adders :

Ripple Carry Adder : an iterative array to perform binary addition

Carry Look Ahead Adder : an improved structure with higher performance

ELEN0040 3 - 138

(45)

Half-Adder

A Half-Adder performs the following computations:

It adds two bits to produce a two-bit sum

The sum is expressed as a Sum bit, S and a Carry bit, C

X 0 0 1 1

+ Y + 0 + 1 + 0 + 1

C S 0 0 0 1 0 1 1 0

(46)

Half-Adder : Truth table

From the truth table, we get the equations :

For S

And for C :

140

X Y C S

0 0 0 0

0 1 0 1

1 0 0 1

1 1 1 0

) Y X

( ) Y X

( S

Y X

Y X

Y X

S

++++

⋅⋅⋅⋅

++++

====

⊕ ⊕

====

⋅⋅⋅⋅

++++

⋅⋅⋅⋅

====

) (

C

Y X

C

) Y X ( ⋅⋅⋅⋅

====

⋅⋅⋅⋅

====

X

Y

(47)

Half-Adder : Five Implementations

We can derive the 5 following sets of equations for a half-adder:

(a), (b), and (e) are SOP, POS, and XOR implementations for S.

In (c), the C function is used as a term in the AND- NOR implementation of S, and in (d), the function is used in a POS term for

S.

Y X

C

) (

S ) c (

Y X

C

) Y X

( ) Y X

( S

) b (

Y X

C

Y X

Y X

S ) a (

Y C X

⋅⋅⋅⋅

==== ==== ==== ==== ==== ==== ⋅⋅⋅⋅ ⋅⋅⋅⋅ ⋅⋅⋅⋅ ++++ ++++ ⋅⋅⋅⋅ ⋅⋅⋅⋅ ++++

⋅⋅⋅⋅

++++

Y X

C

Y X

S ) e (

) Y X

( C

C )

Y X

( S

) d (

⋅⋅⋅⋅

==== ⊕ ⊕ ⊕ ⊕

==== ==== ==== ++++ ++++ ⋅⋅⋅⋅

C

(48)

142

Half-Adder : Implementations

The most common half

adder implementation is: (e)

A NAND only implementation is: (d)

Y X

C

Y X

S ==== ==== ⊕ ⊕ ⊕ ⊕ ⋅⋅⋅⋅

) (

C

C )

Y X

( S

) Y X ( ⋅⋅⋅⋅

==== ++++ ⋅⋅⋅⋅

====

X Y

C S

X

Y

C

C S

XOR

(49)

Full-Adder

A full adder is similar to a half adder, but includes a carry-in bit from previous stages.

Like the half-adder, it computes a sum bit, S and a carry bit, C.

It performs the following computations For a carry-in Z=0

it is the same as the half-adder

For a carry- in Z=1

Z 0 0 0 0

X 0 0 1 1

+ Y + 0 + 1 + 0 + 1 C S 0 0 0 1 0 1 1 0

Z 1 1 1 1

X 0 0 1 1

+ Y + 0 + 1 + 0 + 1 C S 0 1 1 0 1 0 1 1

(50)

Full-Adder : Truth table

From the truth table, we get the equations :

After simplification :

Odd function

144

X Y Z C S

0 0 0 0 0

0 0 1 0 1

0 1 0 0 1

0 1 1 1 0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 0

1 1 1 1 1

Z X Y C

Z Y X Z

Y X Z

Y X Z

Y X S

++++ ++++

====

++++

++++

++++

====

Z

X Y X Y Z ++++ X Y Z

Z Y

X

S ==== ⊕ ⊕ ⊕ ⊕ ⊕ ⊕ ⊕ ⊕

Z ) Y (

Y X

C ==== ++++ ⊕ ⊕ ⊕ ⊕ Z G P

C ==== ++++

X X

Y

Z

(51)

Full-Adder : Implementation

Z Y

X

S ==== ⊕ ⊕ ⊕ ⊕ ⊕ ⊕ ⊕ ⊕ C ==== G ++++ P Z

The term G=X·Y is carry generate.

The term P= X⊕Y is carry propagate P

G

(52)

R´ef´erences

Logic and Computer Design Fundamentals, 4/E, M. Morris Mano Charles Kime , Course material

http ://writphotec.com/mano4/

Cours d’´electronique num´erique, Aur´elie Gensbittel, Bertrand Granado, Universit´e Pierre et Marie Curie

http ://bertrand.granado.free.fr/Licence/ue201/

coursbeameranime.pdf

ELEN0040 3 - 146

(53)

Références

Documents relatifs

This procedure allows the calculation of multiplier effects induced by changes in final demand for all goods both in quantities and in prices, a distinct and

It signals the central control or the processor (depending on the Medium Data Processing System) to au- tomatically translate EBCDIC to BCL informa- tion as it is

The approach is based on linear algebra theory: we show that the normalized rank of a matrix Z (whose columns are analysis blocks taken from the interleaved stream) decreases when

This model represents the distribution of an output sequence when given an input sequence of the same length, using a hidden state variable and a Markovian independence assumption,

The Data Read is delayed from Data Write and may be shifted into an external register by using the negative-going edge of the Data Read Shift Clocks or the

With a parallel printer port, three serial ports (one standard and two optional), and a game port, the Magic I/O packs more features and connectors on a true

If a program writes to its standard output, which is normally the screen, you can make it write to a file instead by using the greater-than symbol ( &gt; ) operator.. The pipe

Ecrit un byte, en fait un int pour qu'il marche avec le read. void write(int b) Ne