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

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

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

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

Добавлен: 13.06.2025

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

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

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

278 C H A P T E R 7 • Introduction to Sequential Logic

SOLUTION The Q and Q waveforms are shown in Figure 7.3. Note that the outputs respond only to the first set or reset command in a sequence of several pulses.

EXAMPLE 7.2

Figure 7.4 shows a latching HOLD circuit for an electronic telephone. When HIGH, the

HOLD output allows you to replace the handset without disconnecting a call in progress.

FIGURE 7.4

Example 7.2

Latching HOLD Button

The two-position switch is the telephone’s hook switch (the switch the handset pushes down when you hang up), shown in the off-hook (in-use) position. The normally closed pushbutton is a momentary-contact switch used as a HOLD button. The circuit is such that the HOLD button does not need to be held down to keep the HOLD active. The latch “remembers” that the switch was pressed, until told to “forget” by the reset function.

Describe the sequence of events that will place a caller on hold and return the call from hold. Also draw timing diagrams showing the waveforms at the HOLD input, hook switch inputs, S input, and HOLD output for one hold-and-return sequence. (HOLD output 1 means the call is on hold.)

SOLUTION To place a call on hold, we must set the latch. We can do so if we press and hold the HOLD switch, then the hook switch. This combines two HIGHs—one from the HOLD switch and one from the on-hook position of the hook switch—into the AND gate, making S 1 and R 0. Note the sequence of events: press HOLD, hang up, release HOLD. The S input is HIGH only as long as the HOLD button is pressed. The handset can be kept on-hook and the HOLD button released. The latch stays set, as S R 0 (neither SET not RESET active) as long as the handset is on-hook.

To restore a call, lift the handset. This places the hook switch into the off-hook position and now S 0 and R 1, which resets the latch and turns off the HOLD condition.

Figure 7.5 shows the timing diagram for the sequence described.

FIGURE 7.5

Example 7.2

HOLD Timing Diagram

7.2 • NAND/NOR Latches

279

SECTION 7.1 REVIEW PROBLEM

7.1A latch with active-HIGH S and R inputs is initially set. R is pulsed HIGH three times, with S 0. Describe how the latch responds.

7.2NAND/NOR Latches

An SR latch is easy to build with logic gates. Figure 7.6 shows two such circuits, one made from NOR gates and one from NANDs. The NAND gates in the second circuit are drawn in DeMorgan equivalent form.

FIGURE 7.6

SR Latch Circuits

The two circuits both have the following three features:

1.OR-shaped gates

2.Logic level inversion between the gate input and output

3.Feedback from the output of one gate to an input of the opposite gate

During our examination of the NAND and NOR latches, we will discover why these features are important.

A significant difference between the NAND and NOR latches is the placement of SET and RESET inputs with respect to the Q and Q outputs. Once we define which output is Q and which is Q, the locations of the SET and RESET inputs are automatically defined.

In a NOR latch, the gates have active-HIGH inputs and active-LOW outputs. When the input to the Q gate is HIGH, Q 0, since either input HIGH makes the output LOW. Therefore, this input must be the RESET input. By default, the other is the SET input.

In a NAND latch, the gate inputs are active LOW (in DeMorgan equivalent form) and the outputs are active HIGH. A LOW input on the Q gate makes Q 1. This, therefore, is the SET input, and the other gate input is RESET.

Since the NAND and NOR latch circuits have two binary inputs, there are four possible input states. Table 7.1 summarizes the action of each latch for each input combination. The functions are the same for each circuit, but they are activated by opposite logic levels.

Table 7.1 NOR and NAND Latch Functions

S

R

Action (NOR Latch)

S

R

Action (NAND Latch)

0

0

Neither SET nor RESET

0

0

Both SET and RESET

active; output does not

active; forbidden condi-

change from previous

tion

state

0

1

RESET input active

0

1

SET input active

1

0

SET input active

1

0

RESET input active

1

1

Both SET and RESET

1

1

Neither SET nor RESET

active; forbidden condi-

active; output does not

tion

change from previous

state


280 C H A P T E R 7 • Introduction to Sequential Logic

We will examine the NAND latch circuit for each of the input conditions in Table 7.1.

The analysis of a NOR latch is similar and will be left as an exercise.

NAND Latch Operation

Figure 7.7 shows a NAND latch in its two possible stable states. In each case the inputs S and R are both HIGH (inactive).

S 1

Q 1

S 1

Q 0

0

1

1

Q 0

0

Q 1

R 1

R 1

a. Set

b. Reset

FIGURE 7.7

NAND Latch Stable States

Figure 7.7a shows the latch in its SET condition (Q 1). The feedback connections from each gate output to the input of the opposite gate keep the latch in a stable condition. The upper gate has a LOW on the “inner” input. Since, for a NAND gate, either input LOW makes the output HIGH, this makes Q 1. This HIGH value is fed to the gate on the other side of the latch. The lower gate has both inputs HIGH, thus keeping its output LOW. The LOW at Q feeds back to the upper gate, forming a closed loop of consistent logic levels. There is no tendency for the outputs to change under these conditions.

Figure 7.7b shows a similar state for the latch in a RESET condition (Q 0). As with the SET state, the stability of the latch depends on the feedback connections. The logic values of the latch gate inputs are the same as before, except that the LOW input is on the lower gate, not the upper gate as in the SET condition.

Figure 7.8 shows a NAND latch as a Graphic Design File created with MAX PLUS II. The inputs are labeled nS and nR and one output as nQ as we cannot enter input names with bars over them. (BOR2 “Bubbled OR, 2-inputs”.)

INPUT

BOR2

nS

OUTPUT

Q

BOR2

OUTPUT

INPUT

nQ

nR

FIGURE 7.8

Graphic Design File representation of a NAND Latch.

N O T E

The documentation for MAX PLUS II recommends that you do not create your own latch circuits or similar cross-coupled structures. Rather, you should use primitives such as LATCH, or components such as lpm_latch, which can be used in gdf or vhd files. We will use the design in Figure 7.8 only to illustrate the function of a NAND latch and to generate some timing data with the MAX PLUS II simulator.

In order to make MAX PLUS II synthesize this circuit as we have drawn it in Figure 7.8, we must select Global Project Logic Synthesis from the Assign Menu (Figure 7.9).


nd_latch.gdf

7.9

7.2 • NAND/NOR Latches

281

In the resulting dialog box (Figure 7.10), we must choose the WYSIWYG (What You See Is What You Get) synthesis style and check the box that says Multi-Level Synthesis for

MAX5000/7000 Devices.

FIGURE 7.10

Choosing WYSIWYG Synthesis Style

When we compile the graphic file, MAX PLUS II synthesizes the following equations, which we can read in the project report file:

** EQUATIONS **

nR

:

INPUT;

nS

:

INPUT;

——Node name is ‘nQ’ ‘:3’

——Equation name is ‘nQ’, type is output nQ LCELL( _EQ001 $ GND);

_EQ001 !nR

#!Q;

——Node name is ‘Q’ ‘:2’

——Equation name is ‘Q’, type is output Q LCELL ( _EQ002 $ GND);

_EQ002 !nS

#!nQ;

We can rewrite the synthesized latch equations as:

Q nS nQ nQ nR Q

282 C H A P T E R 7 • Introduction to Sequential Logic

When we run the MAX PLUS II Timing Analyzer, we get the delay matrix shown in Figure 7.11. The delays are symmetrical for this circuit. The delay from nS to Q (7.5 ns) is through one gate; from nS to nQ (12.5 ns) is through two gates. These values are the same for the path from nR to nQ (7.5 ns; one gate) and from nR to Q (12.5 ns; two gates). We can see these changes on simulation waveforms for the SET and RESET functions.

FIGURE 7.11

NAND Latch Delay Matrix (WYSIWYG Synthesis)

Figures 7.12 and 7.13 show the transition of a NAND latch from the RESET to the SET

condition. In Figure 7.12a, the latch is stable in the RESET condition (Q 0) at time t 0

www.electronictech.com

(i.e., before a SET pulse is applied to the latch). At time t 0, the S input goes LOW (Fig-

ure 7.12b) and 7.5 ns later, the output Q goes HIGH (Figure 7.12c). This applies a HIGH

to the lower gate in the latch and at t 12.5 ns (Figure 7.12d), the Q output goes LOW,

closing the loop. The latch is now in a new stable configuration and the S input can go back

HIGH, as shown in Figure 7.12e.

S 1

Q

S 0

S 0

Q 1

0

Q 1

1

1

0

Q 1

Q 0

1

Q 1

R 1

R 1

R 1

a. Stable (t 0)

b. Initiate set (t 0)

c. t 7.5ns

S 0

Q 1

S 1

1

Q

0

1

Q 0

Q 0

R 1

R 1

d. t 12.5ns

e. Stable (t 12.5ns)

FIGURE 7.12

RESET-to-SET transition


7.2 • NAND/NOR Latches

283

FIGURE 7.13

NAND Latch SET function simulation

The waveforms in Figure 7.13 also show this transition. The simulation window has a 2.5 ns grid, so three grid spaces are equivalent to 7.5 ns and five grid spaces to 12.5 ns. The waveforms show Q going HIGH 7.5 ns after nS goes LOW, followed by nQ going LOW at 12.5 ns after nS.

Figures 7.14 and 7.15 show the same thing for the RESET function. The latch is in a stable SET condition at time t 0 (Figure 7.14a). Input R goes LOW at t 0 (Figure 7.14b). At time t 7.5 ns, Q goes HIGH, which is transferred to the upper gate in the latch circuit Figure 7.14c). Since both inputs of the upper gate are now HIGH, Q goes LOW at time t 12.5 ns (Figure 7.14d). At this point the latch is stable in the RESET condition and the input R can return to the HIGH (inactive) state, as shown in Figure 7.14e. Figure 7.15 shows the simulation waveforms for this transition.

S 1

Q

1

S 1

Q

S 1

Q 1

1

0

0

1

1

Q

0

1

Q 0

1

Q 1

R 1

R 0

R 0

a. Stable (t 0)

b. Initiate reset (t 0)

c. t 7.5ns

S 1

Q 0

S 1

Q

0

1

1

0

Q 1

0

Q

1

R 0

R 1

d. t 12.5ns

e. Stable (t 12.5ns)

FIGURE 7.14

SET-to-RESET Transition

FIGURE 7.15

NAND latch RESET function simulation