encoders three-state outputs multiplexers xor gates

64
Encoders Three-state Outputs Multiplexers XOR gates

Upload: wallis

Post on 25-Feb-2016

74 views

Category:

Documents


1 download

DESCRIPTION

Encoders Three-state Outputs Multiplexers XOR gates . Encoders. An encoder is a combinational logic module or a digital circuit that performs the inverse operation of a decoder . It assigns a unique output code for each input signal applied to the device. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Encoders  Three-state Outputs  Multiplexers XOR gates

Encoders Three-state Outputs

MultiplexersXOR gates

Page 2: Encoders  Three-state Outputs  Multiplexers XOR gates

Encoders• An encoder is a combinational logic module or a digital

circuit that performs the inverse operation of a decoder.• It assigns a unique output code for each input signal applied

to the device.• An encoder has 2n (or fewer) input lines and n output lines.• The output lines generate the binary code corresponding to

the input value.• An example of an encoder is the octal to-binary encoder,

74148.

Page 3: Encoders  Three-state Outputs  Multiplexers XOR gates

Encoders vs. Decoders

Decoder Encoder

Page 4: Encoders  Three-state Outputs  Multiplexers XOR gates

Decoders• A decoder is multiple-input, multiple-output logic circuit

that converts coded inputs into coded outputs.• Input code with fewer bits than the output bits.

– Typically n inputs, 2n outputs• 2-to-4, 3-to-8, 4-to-16, etc.

• There is a one-to-one mapping.

Page 5: Encoders  Three-state Outputs  Multiplexers XOR gates

Decoders• General decoder structure

• Typically n inputs, 2n outputs– 2-to-4, 3-to-8, 4-to-16, etc.

Page 6: Encoders  Three-state Outputs  Multiplexers XOR gates

Binary 2-to-4 decoder

Note “x” (don’t care) notation.

Page 7: Encoders  Three-state Outputs  Multiplexers XOR gates

Binary encoders

Page 8: Encoders  Three-state Outputs  Multiplexers XOR gates

Types of encoders• Encoders with mutually exclusive inputs:

– The inputs are mutually exclusive; that is, one and only one of the input lines is active at any particular instant of time.

– In this case the input combinations that never occur may be used as don’t-care conditions.

• Priority encoders:– It allows multiple input lines to be active and sends out

the binary value of the input line with highest priority.– Normally the highest priority is assigned to the highest

subscript.

Page 9: Encoders  Three-state Outputs  Multiplexers XOR gates

Design an encoder with mutually exclusive inputs:• Design an encoder for four input lines if one and only one is

active at any moment in time.• Truth table:

– the output function yield the binary value of the input variable’s subscript.

X3 X2 X1 X0 A1 A00 0 0 1 0 00 0 1 0 0 10 1 0 0 1 01 0 0 0 1 1

Page 10: Encoders  Three-state Outputs  Multiplexers XOR gates

Design an encoder with mutually exclusive inputs:• Karnaugh Map: A0 = X1 + X3

A0 X3X200

X3X201

X3X211

X3X210

X1X000

0

d4

012

d8

1

X1X001

1

05

d13

d9

d

X1X011

3

d7

d15

d11

d

X1X010

2

16

d14

d10

d

Page 11: Encoders  Three-state Outputs  Multiplexers XOR gates

Design an encoder with mutually exclusive inputs:• Karnaugh Map: A1 = X2 + X3

A1 X3X200

X3X201

X3X211

X3X210

X1X000

0

d4

112

d8

1

X1X001

1

05

d13

d9

d

1X011

3

d7

d15

d11

d

X1X010

2

06

d14

d10

d

Page 12: Encoders  Three-state Outputs  Multiplexers XOR gates

Design an encoder with mutually exclusive inputs:A0 = X1 + X3

A1 = X2 + X3

Page 13: Encoders  Three-state Outputs  Multiplexers XOR gates

Need priority in most applications• Inputs indicates a request for service. e.g., Interrupt requests

• if multiple requests are made simultaneously, the encoder gives undesirable results.

• The solution is to assign priority to the input lines, priority encoder.

Page 14: Encoders  Three-state Outputs  Multiplexers XOR gates

Logic symbol for an 8-input priority encoder

• Input I7 has the highest priority.• Outputs A2-A0 contain the number of the highest-priority

asserted input.• The IDLE output is asserted if no inputs are asserted.

Page 15: Encoders  Three-state Outputs  Multiplexers XOR gates

Priority-encoder logic equations• In order to write logic equations for the priority encoder’s

outputs, we first define eight intermediate variables H0-H7, such that Hi is 1 if and only if Ii is the highest priority input:

Page 16: Encoders  Three-state Outputs  Multiplexers XOR gates

Ambiguity• If two inputs are active simultaneously, the output produces

an undefined combination.For example, if X1 and X2 are 1 simultaneously, the output

will be 11. This does not represent 1 or 2.To resolve this ambiguity, encoder circuits must establish a

priority to ensure that only one input is encoded.• Another ambiguity is that an output with all 0’s is generated

when all the inputs are 0.The problem is that an output with all 0’s is also generated

when X0 is equal to 1. This ambiguity can be resolved by providing an additional

output that specifies the condition that none of the inputs are active.

Page 17: Encoders  Three-state Outputs  Multiplexers XOR gates

Design a priority encoder:• Design an encoder for four input lines if one and only one is

active at any moment in time.• Truth table:

– the output function yield the binary value of the input variable’s subscript.

X3 X2 X1 X0 A1 A0 GS0 0 0 0 0 0 00 0 0 1 0 0 10 0 1 d 0 1 10 1 d d 1 0 11 d d d 1 1 1

Page 18: Encoders  Three-state Outputs  Multiplexers XOR gates

Design a priority encoder:• Karnaugh Map: A0 = X3 + X1 X’2

A0 X3X200

X3X201

X3X211

X3X210

X1X000

0

04

012

18

1

X1X001

1

05

013

19

1

X1X011

3

17

015

111

1

X1X010

2

16

014

110

1

Page 19: Encoders  Three-state Outputs  Multiplexers XOR gates

Design a priority encoder:• Karnaugh Map: A1 = X2 + X3

A1 X3X200

X3X201

X3X211

X3X210

X1X000

0

04

112

18

1

X1X001

1

05

113

19

1

1X011

3

07

115

111

1

X1X010

2

06

114

110

1

Page 20: Encoders  Three-state Outputs  Multiplexers XOR gates

Design a priority encoder:• Group Select

GS = X0 + X1 + X2 + X3

X3 X2 X1 X0 A1 A0 GS0 0 0 0 0 0 00 0 0 1 0 0 10 0 1 d 0 1 10 1 d d 1 0 11 d d d 1 1 1

Page 21: Encoders  Three-state Outputs  Multiplexers XOR gates

74x148 8-input priority encoder

– Active-low I/O– Enable Input– “Got Something”– Enable Output

Page 22: Encoders  Three-state Outputs  Multiplexers XOR gates

74x148circuit

Page 23: Encoders  Three-state Outputs  Multiplexers XOR gates

74x148 Truth Table

Page 24: Encoders  Three-state Outputs  Multiplexers XOR gates

Cascading priority encoders

• 32-inputpriority encoder

Page 25: Encoders  Three-state Outputs  Multiplexers XOR gates

15-input priority encoder in ABEL• Declarations

Page 26: Encoders  Three-state Outputs  Multiplexers XOR gates

Constant expressions

Page 27: Encoders  Three-state Outputs  Multiplexers XOR gates

Outputs

Page 28: Encoders  Three-state Outputs  Multiplexers XOR gates

Alternative formulation

• WHEN is very natural for priority function

Page 29: Encoders  Three-state Outputs  Multiplexers XOR gates

Three-state buffers• Output = LOW, HIGH, or Hi-Z.

• Can tie multiple outputs together, if at most one at a time is driven.

Page 30: Encoders  Three-state Outputs  Multiplexers XOR gates

Three-state buffers• When the enable input is not asserted, the device output “floats”; that is, it goes to a high-impedance (Hi-

Z), disconnected state and functionally behaves as if it weren’t even there.

Page 31: Encoders  Three-state Outputs  Multiplexers XOR gates

Different flavors

Page 32: Encoders  Three-state Outputs  Multiplexers XOR gates
Page 33: Encoders  Three-state Outputs  Multiplexers XOR gates

timing• Typically three-state devices are designed so that they go

into the Hi-Z state faster than they come out of the Hi-Z state.

• That ensures the first device to get off the party line before the second one gets on.

• Otherwise excessive current will flow.• The safe way to use three-state devices is to design control

logic that guarantees a dead time, during which no one is driving the party line.

Page 34: Encoders  Three-state Outputs  Multiplexers XOR gates

Timing considerations

Page 35: Encoders  Three-state Outputs  Multiplexers XOR gates

Three-state drivers

Page 36: Encoders  Three-state Outputs  Multiplexers XOR gates

Standard MSI three-state buffer 74 541• It has 8 non-inverting three-state buffers.• The little rectangular symbols inside the buffer symbols

indicate hysteresis, an electrical characteristics of the inputs that improves noise immunity.

• The 74x541 inputs typically have 0.4 volts of hysteresis.

Page 37: Encoders  Three-state Outputs  Multiplexers XOR gates

Driver application

Page 38: Encoders  Three-state Outputs  Multiplexers XOR gates

Bus transceiver 74 245• A bus transceiver contains pairs of three-state buffers

connected in opposite directions between each pair of pins, so that data can be transferred in either direction.

• A bus transceiver is typically used between two bidirectional buses.

Page 39: Encoders  Three-state Outputs  Multiplexers XOR gates

Three-state transceiver

Page 40: Encoders  Three-state Outputs  Multiplexers XOR gates

Transceiver application

Page 41: Encoders  Three-state Outputs  Multiplexers XOR gates

Three-state enables in ABEL

Page 42: Encoders  Three-state Outputs  Multiplexers XOR gates

Multiplexers• A multiplexer is a digital switch - it connects data from one

of n sources to its output.• An n-input and b-bit multiplexer has n soureces of data,

each of which b bits wide, and there are b output bits.a multiplexer is a unidirectional device.

• Multiplexers are used in any application in which data must be switched from multiple sources to a destination.

e.g., processor’s registers to ALU

Page 43: Encoders  Three-state Outputs  Multiplexers XOR gates

Multiplexers

Page 44: Encoders  Three-state Outputs  Multiplexers XOR gates

Multiplexers• A multiplexer is a digital switch - it connects data from one

of n sources to its output.• An n-input and b-bit multiplexer has n soureces of data,

each of which b bits wide, and there are b output bits.a multiplexer is a unidirectional device.

• Multiplexers are used in any application in which data must be switched from multiple sources to a destination.

e.g., processor’s registers to ALU

Page 45: Encoders  Three-state Outputs  Multiplexers XOR gates

74x1518-input

multiplexer

Page 46: Encoders  Three-state Outputs  Multiplexers XOR gates

74x151 truth table

Page 47: Encoders  Three-state Outputs  Multiplexers XOR gates

Multiplexers• iY is a particular output bit, • Mj represents minterm j of the s select inputs; and • iDj is the input bit i of source j;

• When the mutiplexer is enabled and the value on the select inputs is j, each output iY equals the corresponding bit of the selected input, iDj.

n-1

j = 0

EN . Mj . iDjiY =

Page 48: Encoders  Three-state Outputs  Multiplexers XOR gates

4-input, 1-bit Multiplexer• Y is the output bit, • Mj represents minterm j (0~3) of the 2 select inputs; and • Dj is the input bit of source j;

• When the mutiplexer is enabled and the value on the select inputs is j, the output Y equals the corresponding bit of the selected input, Dj.

3

j = 0

EN . Mj . iDjY =

Page 49: Encoders  Three-state Outputs  Multiplexers XOR gates

CMOS transmission gates

• 2-input multiplexer

Page 50: Encoders  Three-state Outputs  Multiplexers XOR gates

Other multiplexer varieties

• 2-input, 4-bit-wide– 74x157

• 4-input, 2-bit-wide– 74x153

Page 51: Encoders  Three-state Outputs  Multiplexers XOR gates

ABEL code for 74x153-like mux

Page 52: Encoders  Three-state Outputs  Multiplexers XOR gates

Easier ABEL multiplexer code

Page 53: Encoders  Three-state Outputs  Multiplexers XOR gates

Barrel shifter design example• n data inputs, n data outputs• Control inputs specify number of positions to rotate or shift

data inputs• Example: n = 16

– DIN[15:0], DOUT[15:0], S[3:0] (shift amount)• Many possible solutions, all based on multiplexers

Page 54: Encoders  Three-state Outputs  Multiplexers XOR gates

16 16-to-1 muxes

16-to-1 mux = 2 x 74x151 8-to-1 mux + NAND gate

Page 55: Encoders  Three-state Outputs  Multiplexers XOR gates

4 16-bit 2-to-1 muxes

16-bit 2-to-1 mux = 4 x 74x157 4-bit 2-to-1 mux

Page 56: Encoders  Three-state Outputs  Multiplexers XOR gates

Properties of different approaches

Page 57: Encoders  Three-state Outputs  Multiplexers XOR gates

ABEL code for barrel shifter

20 inputs16 outputs16 product terms per output

Page 58: Encoders  Three-state Outputs  Multiplexers XOR gates

2-input XOR gates• Like an OR gate, but excludes the case where both inputs

are 1.

• XNOR: complement of XOR

Page 59: Encoders  Three-state Outputs  Multiplexers XOR gates

XOR and XNOR symbols

Page 60: Encoders  Three-state Outputs  Multiplexers XOR gates

Gate-level XOR circuits• No direct realization with just a few transistors.

Page 61: Encoders  Three-state Outputs  Multiplexers XOR gates

CMOS XOR with transmission gates

IF B==1 THEN Z = !A;ELSE Z = A;

Page 62: Encoders  Three-state Outputs  Multiplexers XOR gates

Multi-input XOR• Sum modulo 2• Parity computation

• Used to generate and check parity bits in computer systems.– Detects any single-bit error

Page 63: Encoders  Three-state Outputs  Multiplexers XOR gates

Parity tree• Faster with balanced tree structure

Page 64: Encoders  Three-state Outputs  Multiplexers XOR gates

Next time• Comparators• Adders• Multipliers• Read-only memories (ROMs)