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

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

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

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

Добавлен: 13.06.2025

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

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

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

26 C H A P T E R 2 • Logic Functions and Gates

Electronic Engineers and the American National Standards Institute. It uses a set of symbols called rectangular-outline symbols.

Logic gates can be used as electronic switches to block or allow passage of digital waveforms. Each logic gate has a different set of properties for enabling (passing) or inhibiting (blocking) digital waveforms. ■

2.1 Basic Logic Functions

K E Y T E R M S

Boolean variable A variable having only two possible values, such as

HIGH/LOW, 1/0, On/Off, or True/False.

Boolean algebra A system of algebra that operates on Boolean variables. The binary (two-state) nature of Boolean algebra makes it useful for analysis, simplification, and design of combinational logic circuits.

Boolean expression An algebraic expression made up of Boolean variables and operators, such as AND, OR, or NOT. Also referred to as a Boolean function or a logic function.

Logic gate An electronic circuit that performs a Boolean algebraic function.

At its simplest level, a digital circuit works by accepting logic 1s and 0s at one or more inputs and producing 1s or 0s at one or more outputs. A branch of mathematics known as Boolean algebra (named after 19th-century mathematician George Boole) describes the relation between inputs and outputs of a digital circuit. We call these input and output values Boolean variables and the functions Boolean expressions, logic functions, or

Boolean functions. The distinguishing characteristic of these functions is that they are made up of variables and constants that can have only two possible values: 0 or 1.

All possible operations in Boolean algebra can be created from three basic logic functions: AND, OR, and NOT.1 Electronic circuits that perform these logic functions are called logic gates. When we are analyzing or designing a digital circuit, we usually don’t concern ourselves with the actual circuitry of the logic gates, but treat them as black boxes that perform specified logic functions. We can think of each variable in a logic function as a circuit input and the whole function as a circuit output.

In addition to gates for the three basic functions, there are also gates for compound functions that are derived from the basic ones. NAND gates combine the NOT and AND functions in a single circuit. Similarly, NOR gates combine the NOT and OR functions. Gates for more complex functions, such as Exclusive OR and Exclusive NOR, also exist. We will examine all these devices later in the chapter.

NOT, AND, and OR Functions

K E Y T E R M S

Truth table A list of all possible input values to a digital circuit, listed in ascending binary order, and the output response for each input combination.

Inverter Also called a NOT gate or an inverting buffer. A logic gate that changes its input logic level to the opposite state.

Bubble A small circle indicating logical inversion on a circuit symbol.

1Words in uppercase letters represent either logic functions (AND, OR, NOT) or logic levels (HIGH, LOW). The same words in lowercase letters represent their conventional nontechnical meanings.

Table 2.1 NOT Function

Truth Table

A Y

0 1

1 0

FIGURE 2.1

Inverter Symbols

Table 2.2 2-input AND

Function Truth Table

A B Y

0 0 0

0 1 0

1 0 0

1 1 1

2.1 • Basic Logic Functions

27

Distinctive-shape symbols Graphic symbols for logic circuits that show the function of each type of gate by a special shape.

IEEE/ANSI Standard 91-1984 A standard format for drawing logic circuit symbols as rectangles with logic functions shown by a standard notation inside the rectangle for each device.

Rectangular-outline symbols Rectangular logic gate symbols that conform to

IEEE/ANSI Standard 91-1984.

Qualifying symbol A symbol in IEEE/ANSI logic circuit notation, placed in the top center of a rectangular symbol, that shows the function of a logic gate. Some of the qualifying symbols include: 1 “buffer”; & “AND”; 1 “OR”

Buffer An amplifier that acts as a logic circuit. Its output can be inverting or noninverting.

NOT Function

The NOT function, the simplest logic function, has one input and one output. The input can be either HIGH or LOW (1 or 0), and the output is always the opposite logic level. We can show these values in a truth table, a list of all possible input values and the output resulting from each one. Table 2.1 shows a truth table for a NOT function, where A is the input variable and Y is the output.

The NOT function is represented algebraically by the Boolean expression:

Y A

This is pronounced “Y equals NOT A” or “Y equals A bar.” We can also say “Y is the complement of A.”

The circuit that produces the NOT function is called the NOT gate or, more usually, the inverter. Several possible symbols for the inverter, all performing the same logic function, are shown in Figure 2.1.

The symbols shown in Figure 2.1a are the standard distinctive-shape symbols for the inverter. The triangle represents an amplifier circuit, and the bubble (the small circle on the input or output) represents inversion. There are two symbols because sometimes it is convenient to show the inversion at the input and sometimes it is convenient to show it at the output.

Figure 2.1b shows the rectangular-outline inverter symbol specified by IEEE/ANSI Standard 91-1984. This standard is most useful for specifying the symbols for more complex digital devices. We will show the basic gates in both distinctive-shape and rectangu- lar-outline symbols, although most examples will use the distinctive-shape symbols.

The “1” in the top center of the IEEE symbol is a qualifying symbol, indicating the logic gate function. In this case, it shows that the circuit is a buffer, an amplifying circuit used as a digital logic element. The arrows at the input and output of the two IEEE symbols show inversion, like the bubbles in the distinctive-shape symbols.

AND Function

K E Y T E R M S

AND gate A logic circuit whose output is HIGH when all inputs (e.g., A AND B AND C) are HIGH.

Logical product AND function.

The AND function combines two or more input variables so that the output is HIGH only if all the inputs are HIGH. The truth table for a 2-input AND function is shown in Table 2.2.


28 C H A P T E R 2 • Logic Functions and Gates

Algebraically, this is written:

Y A B

FIGURE 2.2

2-Input AND Gate Symbols

Pronounce this expression “Y equals A AND B.” The AND function is similar to multiplication in linear algebra and thus is sometimes called the logical product. The dot between variables may or may not be written, so it is equally correct to write Y AB. The logic circuit symbol for an AND gate is shown in Figure 2.2 in both distinctive-shape and IEEE/ANSI rectangular-outline form. The qualifying symbol in IEEE/ANSI notation is the ampersand (&).

We can also represent the AND function as a set of switches in series, as shown in Figure 2.3. The circuit consists of a voltage source, a lamp, and two series switches. The lamp turns on when switches A AND B are both closed. For any other condition of the switches, the lamp is off.

Table 2.3 3-input AND

Function Truth Table

A

B

C

Y

0

0

0

0

0

0

1

0

0

1

0

0

0

1

1

0

1

0

0

0

1

0

1

0

1

1

0

0

1

1

1

1

Table 2.4

2-input OR

Function Truth Table

A

B

Y

0

0

0

0

1

1

1

0

1

1

1

1

A

B

Voltage

Lamp

source

A

B

FIGURE 2.3

AND Function Represented by Switches

Table 2.3 shows the truth table for a 3-input AND function. Each of the three inputs can have two different values, which means the inputs can be combined in 23 8 different ways. In general, n binary (i.e., two-valued) variables can be combined in 2n ways.

Figure 2.4 shows the logic symbols for the device. The output is HIGH only when all inputs are HIGH.

FIGURE 2.4

3-Input AND Gate Symbols

OR Function

K E Y T E R M S

OR gate A logic circuit whose output is HIGH when at least one input (e.g., A OR B OR C) is HIGH.

Logical sum OR function.

The OR function combines two or more input variables in such a way as to make the output variable HIGH if at least one input is HIGH. Table 2.4 gives the truth table for the 2-in- put OR function.


FIGURE 2.5

2-Input OR Gate Symbols

Table 2.5

3-input OR

Function Truth Table

A

B

C

Y

0

0

0

0

0

0

1

1

0

1

0

1

0

1

1

1

1

0

0

1

1

0

1

1

1

1

0

1

1

1

1

1

2.1 • Basic Logic Functions

29

The algebraic expression for the OR function is:

Y A B

which is pronounced “Y equals A OR B.” This is similar to the arithmetic addition function, but it is not the same. The last line of the truth table tells us that 1 1 1 (pronounced “1 OR 1 equals 1”), which is not what we would expect in standard arithmetic. The similarity to the addition function leads to the name logical sum. (This is different from the “arithmetic sum,” where, of course, 1 1 does not equal 1.)

Figure 2.5 shows the logic circuit symbols for an OR gate. The qualifying symbol for the OR function in IEEE/ANSI notation is “ 1,” which tells us that one or more inputs must be HIGH to make the output HIGH.

The OR function can be represented by a set of switches connected in parallel, as in Figure 2.6. The lamp is on when either switch A OR switch B is closed. (Note that the lamp is also on if both A and B are closed. This property distinguishes the OR function from the Exclusive OR function, which we will study later in this chapter.)

A

B

Voltage

Lamp

source

A B

FIGURE 2.6

OR Function Represented by Switches

Like AND gates, OR gates can have several inputs, such as the 3-input OR gates shown in Figure 2.7. Table 2.5 shows the truth table for this gate. Again, three inputs can be combined in eight different ways. The output is HIGH when at least one input is HIGH.

FIGURE 2.7

3-Input OR Gate Symbols

EXAMPLE 2.1

Application

State which logic function is most suitable for the following operations. Draw a set of switches to represent each function.

1.A manager and one other employee both need a key to open a safe.

2.A light comes on in a storeroom when either (or both) of two doors is open. (Assume the switch closes when the door opens.)

3.For safety, a punch press requires two-handed operation.

SOLUTION

1.Both keys are required, so this is an AND function. Figure 2.8a shows a switch representation of the function.


30 C H A P T E R 2 • Logic Functions and Gates

FIGURE 2.8

Example 2.1

2.One or more switches closed will turn on the lamp. This OR function is shown in Figure 2.8b.

3.Two switches are required to activate a punch press, as shown in Figure 2.8c. This is an AND function.

Key switch

Key switch

(manager)

(employee)

DC

Electronic

voltage

lock

source

a. Two keys to open a safe (AND)

Door switch A

AC

voltage

Lamp

source

Door switch B

b. One or more switches turn on a lamp (OR)

Hand

Hand

switch A

switch B

AC

Solenoid

voltage

(punch)

source

c. Two switches are required to activate a punch press (AND)

Active Levels

K E Y T E R M S

Active level A logic level defined as the “ON” state for a particular circuit input or output. The active level can be either HIGH or LOW.

Active HIGH An active-HIGH terminal is considered “ON” when it is in the logic HIGH state. Indicated by the absence of a bubble at the terminal in distinc- tive-shape symbols.

Active LOW An active-LOW terminal is considered “ON” when it is in the logic LOW state. Indicated by a bubble at the terminal in distinctive-shape symbols.

An active level of a gate input or output is the logic level, either HIGH or LOW, of the terminal when it is performing its designated function. An active LOW is shown by a bubble or an arrow symbol on the affected terminal. If there is no bubble or arrow, we assume the terminal is active HIGH.