Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 8081

Скачиваний: 6

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

5.4 • Demultiplexers

201

CMOS Analog Multiplexer/Demultiplexer

K E Y T E R M S

CMOS analog switch A CMOS device that will pass an analog or digital signal in either direction, when enabled. Also called a transmission gate. There is no TTL equivalent.

An interesting device used in some CMOS medium-scale integration multiplexers and demultiplexers, as well as other applications, is the CMOS analog switch, or transmission gate. This device has the property of allowing signals to pass in two directions, instead of only one, thus allowing both positive and negative voltages and currents to pass. It also has no requirement that the voltages be of a specific value such as 5 volts. These properties make the device suitable for passing analog signals.

FIGURE 5.53

Line Drivers

Figure 5.53 shows several symbols, indicating the development of the transmission gate concept. Figures 5.53a and b show amplifiers whose output and input are clearly defined by the direction of the triangular amplifier symbol. A signal has one possible direction of flow. Figure 5.53b includes an active-LOW gating input, which can turn the signal on and off.

Figure 5.53c shows two opposite-direction overlapping amplifier symbols, with a gating input to enable or inhibit the bidirectional signal flow. The signal through the transmission gate may be either analog or digital.

Analog switches are available in packages of four switches with part numbers such as 4066B (standard CMOS) or 74HC4066 (high-speed CMOS).

Several available CMOS MUX/DMUX chips use analog switches to send signals in either direction. Figure 5.54 illustrates the design principle as applied to a 4-channel MUX/DMUX.

FIGURE 5.54

4-Channel CMOS MUX/DMUX

S

S

If four signals are to be multiplexed, they are connected to inputs D0 to D3. The decoder, activated by S1 and S0, selects which one of the four switches is enabled. Figure 5.54 shows Channel 2 active (S1S0 10).

202 C H A P T E R 5 • Combinational Logic Functions

Since all analog switch outputs are connected together, any selected channel connects

to Y, resulting in a multiplexed output. To use the circuit in Figure 5.54 as a demultiplexer,

the inputs and outputs are merely reversed.

EXAMPLE 5.12

A CMOS 4097B dual 8-channel MUX/DMUX can be used simultaneously as a multi-

plexer on one half of the device and as a demultiplexer on the other side.

FIGURE 5.55

Example 5.12

4097B MUX/DMUX as a Time

Division MUX/DMUX

S0

Q0

S1

Q1

S2

Q2


5.5 • Magnitude Comparators

203

A circuit in a recording studio uses one side of a 4097B MUX/DMUX to multiplex 8 digital audio channels into a digital signal processor (DSP), using time division multiplexing. The other half of the 4097B takes the processed signals from a DSP output and distributes them to 8 channels on a digital audio tape (DAT) unit. Draw the circuit.

Solution Figure 5.55 shows a possible circuit. The counter can be part of the DSP. An audio source channel is selected by the counter inputs, data are sent to the DSP, where they are processed and sent to the same channel of the DAT. The counter advances by one, se-

lecting a new channel and repeating the process.

SomeanalogMUX/DMUXdevicesinhigh-speedCMOSinclude:74HC40518-channel MUX/DMUX, 74HC4052 dual 4-channel MUX/DMUX, and 74HC4053 triple 2-channel MUX/DMUX.

5.5 Magnitude Comparators

K E Y T E R M S

Magnitude comparator A circuit that compares two n-bit binary numbers, indi-

cates whether or not the numbers are equal, and, if not, which one is larger.

FIGURE 5.56

Exclusive NOR Gate

Table 5.11

XNOR

Truth Table

A

B

Y

0

0

1

0

1

0

1

0

0

1

1

1

If we are interested in finding out whether or not two binary numbers are the same, we can use a magnitude comparator. The simplest comparison circuit is the Exclusive NOR gate, whose circuit symbol is shown in Figure 5.56 and whose truth table is given in Table 5.11.

The output of the XNOR gate is 1 if its inputs are the same (A B, symbolized AEQB) and 0 if they are different. For this reason, the XNOR gate is sometimes called a coincidence gate.

We can use several XNORs to compare each bit of two multi-bit binary numbers. Figure 5.57 shows a 2-bit comparator with one output that goes HIGH if all bits of A and B are identical.

FIGURE 5.57

2-bit Magnitude Comparator

If the most significant bit (MSB) of A equals the MSB of B, the output of the upper XNOR is HIGH. If the least significant bits (LSBs) are the same, the output of the lower XNOR is HIGH. If both these conditions are satisfied, then A B, which is indicated by a HIGH at the AND output. This general principle applies to any number of bits:

AEQB (An 1

Bn 1) (An 2

Bn 2) ... (A1

B1) (A0 B0)

for two n-bit numbers, A and B.

Some magnitude comparators also include an output that activates if A is greater than B (symbolized A B or AGTB) and another that is active when A is less than B (symbolized A B or ALTB). Figure 5.58 shows the comparator of Figure 5.57 expanded to include the “greater than” and “less than” functions.

Let us analyze the AGTB circuit. The AGTB function has two AND-shaped gates that compare A and B bit-by-bit to see which is larger.


204 C H A P T E R 5 • Combinational Logic Functions

FIGURE 5.58

2-bit Comparator With AEQB,

AGTB, and ALTB Outputs

AEQB

AGTB

ALTB

1.The 2-input gate examines the MSBs of A and B. If A1 1 AND B1 0, then we know that A B. (This implies one of the following inequalities: 10 00; 10 01; 11 00; or 11 01.)

2.If A1 B1, then we don’t know whether or not A B until we compare the next most significant bits, A0 and B0. The 3-input gate makes this comparison. Since this gate is enabled by the XNOR, which compares the two MSBs, it is only active when A1 B1.

This yields the term (A B )A B in the Boolean expression for the AGTB function.

1 1 0 0

3.If A1 B1 AND A0 1 AND B0 0, then the 3-input gate has a HIGH output, telling us, via the OR gate, that A B. (The only possibilities are (01 00) and (11 10).)

Similar logic works in the ALTB circuit, except that inversion is on the A, rather than the B bits. Alternatively, we can simplify either the AGTB or the ALTB function by using a NOR function. For instance, if we have developed a circuit to indicate AEQB and ALTB, we can make the AGTB function from the other two, as follows:

AGTB AEQB ALTB

This Boolean expression implies that if A is not equal to or less than B, then it must be greater than B.

Figure 5.59 shows a 4-bit comparator with AEQB, ALTB, and AGTB outputs. The Boolean expressions for the outputs are:

AEQB (A3 B3)(A2 B2)(A1 B1)(A0 B0)

(A3 B3)

ALTB A3B3 (A3 B3)A2

B2 (A3 B3)(A2 B2)A1B1

(A2 B2)(A1 B1)A0B0

AGTB AEQB ALTB

This comparison technique can be expanded to as many bits as necessary. A 4-bit comparator requires four AND-shaped gates for its ALTB function. We can interpret the Boolean expression for this function as follows.

A B if:

1.The MSB of A is less than the MSB of B, OR

2.The MSBs are equal, but the second bit of A is less than the second bit of B, OR

3.The first two bits are equal, but the third bit of A is less than the third bit of B, OR

4.The first three bits are equal, but the LSB of A is less than the LSB of B

Expansion to more bits would use the same principle of comparing bits one at a time, beginning with the MSBs.


5.5 • Magnitude Comparators

205

ALTB

AEQB

AGTB

FIGURE 5.59

4-bit Magnitude Comparator

EXAMPLE 5.13

Application

A digital thermometer has two input probes. A circuit in the thermometer converts the measured temperature at each probe to an 8-bit number, as shown by the block in Figure

Probe

Probe

input

input

A

B

Converter

A7 A6 A5 A4 A3 A2 A1 A0

B7 B6 B5 B4 B3 B2 B1 B0

FIGURE 5.60

Example 5.13

Two-channel Digital Thermometer

5.60.

In addition to measuring the temperature at each input, the thermometer has a comparison function that indicates whether the temperature at one input is greater than, equal to, or less than the temperature at the other input.

Draw a logic diagram showing how a magnitude comparator could be connected to light a green LED for AGTB, an amber LED for AEQB, and a red LED for ALTB.

Solution Figure 5.61 shows the logic diagram of the magnitude comparator connected


206

C H A P T E R 5 • Combinational Logic Functions

Probe

Probe

input

input

Vcc

Vcc

Vcc

A

B

Converter

A7 A6 A5 A4 A3 A2 A1 A0

B7 B6 B5 B4 B3 B2 B1 B0

A7 A6 A5 A4 A3 A2 A1 A0

B7 B6 B5 B4 B3 B2 B1 B0

G

A

R

Comparator

ALTB

AEQB

AGTB

FIGURE 5.61

Example 5.13

Temperature Comparator Block Diagram

to the thermometer’s digital output.

When one of the comparator outputs goes HIGH, it sets the output of the corresponding inverter LOW. This provides a current path to ground for the indicator LED for that

output, causing it to illuminate.

compare2.vhd

compare2.scf

VHDL Magnitude Comparators

The most obvious way to create a VHDL representation of a magnitude comparator is to use a concurrent signal assignment statement for each comparing function. For example, the following VHDL code can represent the 2-bit magnitude comparator of Figure 5.57:

—— compare2.vhd

ENTITY compare2 IS

PORT(

a, b : IN BIT_VECTOR (1 downto 0); agtb, aeqb, altb : OUT BIT);

END compare2;

ARCHITECTURE a OF compare2 IS

BEGIN

altb

<=

(not (a(1))

and b(1))

or

((not (a(1)

xor b(1))) and (not (a(0)) and b(0)));

aeqb

<=

(not (a(1) xor b(1))) and (not (a(0)

xor b(0)));

agtb

<=

(a(1)

and not (b(1)))

or

((not

(a(1)

xor b(1))) and (a(0) and

not (b(0))));

END a;

A simulation for this file is shown in Figure 5.62. The comparison outputs go HIGH to indicate A B, A B, or A B.

Although this approach works, it is not a very good one. Due to the complexity of the Boolean equations for ALTB and AGTB, it is difficult to type them without making errors. (Try it!) The difficulty increases greatly with the number of required inputs.