• 沒有找到結果。

# 楊伏夷

N/A
N/A
Protected

Share "楊伏夷"

Copied!
82
0
0

(1)

數位系統 Digital Systems

### Department of Computer Science and Information Engineering, Chaoyang University of Technology

Speaker: Fuw-Yi Yang

### 夷

(2)

Text Book: Digital Design 4th Ed.

Chap 5 Synchronous Sequential Logic

### 5.8 Design Procedure

(3)

Text Book: Digital Design 4th Ed.

Chap 5.1 Introduction

Although every digital system is likely to have some combinational circuits, most systems encountered in

practice also include storage elements, which require that the system be described in terms of sequential logic.

First, we need to understand what distinguishes sequential logic from combinational logic.

(4)

Text Book: Digital Design 4th Ed.

Chap 5.2 sequential circuits

A block diagram of a sequential circuit is shown above.

(5)

Text Book: Digital Design 4th Ed.

Chap 5.2 Sequential circuits

There are two main types of sequential circuits, and their classification is a function of the timing of their signals.

A synchronous sequential circuit is a system whose

behavior can be defined from the knowledge of its signals at discrete instants of time.

The behavior of an asynchronous sequential circuit

depends upon the input signals at any instant of time and

## the order

in which the inputs change.

(6)

Text Book: Digital Design 4th Ed.

Chap 5.2 Sequential circuits

A synchronous sequential circuit employs signals that

affect the storage elements at only discrete instants of time.

Synchronization is achieved by a time device called a

## clock generator, which provides a clock signal having the

form of a period train of clock pulses.

Synchronous sequential circuits that use clock pulses to control storage elements are called clocked sequential

## circuits

and are the type most frequently encountered in practice. (next page)

(7)

Text Book: Digital Design 4th Ed.

Chap 5.2 Sequential Circuits –

Synchronous Clocked Sequential Circuit

(8)

Text Book: Digital Design 4th Ed.

Chap 5.3 Storage Elements: Latches

A storage element in a digital circuit can maintain a

## binary state

indefinitely, until directed by an input signal to switch state.

Storage elements that operate with signal levels are referred to as latches; those controlled by a clock

are

## flip-flops.

Latches are said to be level sensitive devices; flip-flops are edge-sensitive devices.

(9)

Text Book: Digital Design 4th Ed.

Chap 5.3 Storage Elements: Latches – SR Latch with NOR gates

(10)

Text Book: Digital Design 4th Ed.

Chap 5.3 Storage Elements: Latches – SR Latch with NAND gates

(11)

Text Book: Digital Design 4th Ed.

Chap 5.3 Storage Elements: Latches – SR Latch with Control input

(12)

Text Book: Digital Design 4th Ed.

Chap 5.3 Storage Elements: Latches – D Latch

(13)

Text Book: Digital Design 4th Ed.

Chap 5.3 Storage Elements: Latches – Graphic symbols for latches

(14)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

The state of a latch or flip-flop is switched by a change in the control input. This momentary change is called a

## trigger, and the transition it causes is said to trigger the

flip-flop.

(15)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

Responses---level signal or edged signal

(16)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

Master-slave D flip-flop (↓trigger)

(17)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

## D-type positive-edge-triggered flip-flop

(18)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

Graphic symbol for edge-triggered D flip-flop

0

1 0 1

## Characteristic equation: Q(t+1) = D

(19)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

0 0

0 1 1 0 1 1

0 1

## Characteristic equation: Q(t+1) = J Q′ + K′Q

(20)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

0

## Characteristic equation: Q(t+1) = T

⊕ Q

(21)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

## D flip-flop with asynchronous reset

(22)

Text Book: Digital Design 4th Ed.

Chap 5.4 Storage Elements: Flip-Flops

## R Clk D Q

0 X X

1 ↑ 0 1 ↑ 1

0 0 1

(23)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits State equation

The behavior of a clocked sequential circuit can be described by means of state equation. A state equation

(also called transition equation) specifies the next state as a function of the present state and inputs.

For example, the characteristic equations of T flip-flop, D flip-flop, and JK flip-flop specifies their next states as:

⊕ Q,

## Q(t+1) = J Q′ + K′Q, respectively.

An example of sequential circuit is analyzed in next page.

(24)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits

## B(t) x(t)B(t+1) = A′(t) x(t),y(t) =

(A(t) + B(t)) x′(t) or in compact form

## y = (A + B) x′

(25)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits State table for sequential circuit

## y = (A + B) x′

(26)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits State table for sequential circuit

## y = (A + B) x′

(27)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits State Diagram

(28)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Flip-Flop input equations

The logic diagram of a sequential circuit consists of

## flip-flops

and gates.

The interconnections among the gates form a

combinational circuit and may be specified algebraically with Boolean expressions.

The knowledge of the type of flip-flops and a list of the

## Boolean expressions

of the combinational circuit provide the information needed to draw the logic diagram of the sequential circuit.

(29)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Flip-Flop input equations

The part of the combinational circuit that generates external outputs is described algebraically by a set of

Boolean functions called output equations.

The part of the circuit that generates the inputs of flip-flops is described algebraically by a set of Boolean functions called flip-flop input equations (or excitation

## equations).

For the circuit in Fig 5-15, we have (next page) Input equations: D

= A x+ B x, D

### B

= A′ x,

Output equations: y = (A + B) x′

(30)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Flip-Flop input equations

Input equations:

= A x+ B x,

## DB

= A′ x.

Output equations:

## y = (A + B) x′

These equations provide the necessary

information for drawing the logic diagram of the sequential circuit.

(31)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with D Flip-Flops

= A ⊕ x ⊕ y,

## A(t + 1) = A

⊕ x ⊕ y

(32)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with JK Flip-Flops

= B,

= Bx′,

= x′,

## KB

= A⊕ x

(33)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with JK Flip-Flops — State table

= B,

= Bx′,

= x′,

## KB

= A⊕ x

(34)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits

Analysis with JK Flip-Flops—State equations Input equations:

= B, K

= Bx′,

## JB

= x′, K

### B

= A⊕ x

Characteristic equation: Q(t+1) = J Q′ + K′Q

## A(t+1) = JAA′ + KA

′A = BA′ + (Bx′)′A = BA′ + B′A + xA

## B(t+1) = JBB′ + KB

′B = x′B′ + (A⊕ x)′B = x′B′ + ABx+ A′Bx′

(35)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with JK Flip-Flops—State diagram

## S0: A = 0, B = 0

on x = 1, A(t+1) = 0,

## B(t+1) = 0

⇒ S0→ S0

on x = 0, A(t+1) = 0,

## B(t+1) = 1

⇒ S0→ S1

(36)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with T Flip-Flops

= Bx,

= x

## y = AB

(37)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with T Flip-Flops – State table

= Bx,

= x

## y = AB

(38)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with T Flip-Flops – State equations Input equations: T

= Bx, T

### B

= x

Output equation: y = AB

Characteristic equation: Q(t+1) = T ⊕ Q

## A(t+1) = (TA

⊕ A) = (Bx ⊕ A)

= (Bx)′A + (Bx)A′ = AB′ + Ax′ + A′Bx

## B(t+1) = (TB

⊕ B) = (x ⊕ B)

(39)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits Analysis with T Flip-Flops – State diagram

⊕ A)

⊕ B)

## y = AB

00/0: A = 0, B = 0, y = 0 on x = 1:

## A(t+1) = 0, B(t+1) = 1, y = 0

⇒ 00/0 → 01/0 on x = 0:

## A(t+1) = 0, B(t+1) = 0, y = 0

⇒ 00/0 → 00/0

(40)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits

Mealy and Moore Models of Finite State Machine The most general model of a sequential circuit has inputs, outputs, and internal states. It is customary to distinguish between two models of sequential circuits: the Mealy

## model

and the Moore model. They differ only in the way the outputs is generated.

In the Mealy model, the output is a function of both the present state and the input.

In the Moore model, the output is a function of only the present state. See next page

(41)

Text Book: Digital Design 4th Ed.

Chap 5.5 Analysis of Clocked Sequential Circuits

Mealy and Moore Models of Finite State Machine

(42)

Text Book: Digital Design 4th Ed.

Chap 5.6 Synthesizable HDL Models of Sequential Circuits // Description of D flip-flop

// See Fig. 5-11

module D_flip_flop (Q, D, CLK);

output Q;

input D, CLK;

reg Q;

always @ (posedge CLK) Q <= D;

Endmodule

(43)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment

The analysis of sequential circuits starts from a circuit diagram and culminates in a state table or diagram.

The design (synthesis) of a sequential circuit starts from a set of specifications and culminates in a logic diagram.

(44)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment

Two sequential circuits may exhibit the same input-output behavior, but have a different number of internal states

## (flip-flops)

in their state diagram.

Reducing the number of internal states may simplify a design. The reduction in the number of flip-flops in a

sequential circuit is referred to as state-reduction problem.

(45)

State input output

0 0

1 0

0 0

1 0

0 0

1 1

1 1

1 1

0 0

0 0

0… 0 …

## Example

(46)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment – example -- state reduction

If identical input sequences are applied to the two circuits and identical outputs occur for all input sequences, then the two circuits are said to be equivalent (as far as the input-out is concerned) and one may be replaced by the other.

The problem of state reduction is to find ways of

reducing the number of states in a sequential circuit without altering the input-output relationship.

(47)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment – example -- state reduction

The following algorithm for the state reduction of a completely specified state table is given without proof:

Two states are said to be equivalent if for each member of the set of inputs, they give exactly the same output and send the circuit either to the same state or to an equivalent state. When two states are equivalent one of them can be removed without altering the input-output relationship.

(48)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment – example – state reduction

(49)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment – example -- state reduction

(50)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment – example -- state reduction

(51)

## Reduced state diagram

(52)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment -- example – state assignment

In order to design a sequential circuit with physical

components, it is necessary to assign unique coded binary values to the states. For a circuit with m states, the codes must contains n bits, where m

## ≤ 2n

. (next page shows

examples of assignment)

Unused states are treated as don’t care conditions during the design.

Sometimes, the name transition table is used for a state table with a binary assignment. This convention

distinguishes it from a state table with symbolic names for

(53)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment -- example – state assignment

(54)

Text Book: Digital Design 4th Ed.

Chap 5.7 State Reduction and Assignment -- example – state assignment

(55)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure

Design procedures or methodologies specify hardware that will implement a desired behavior.

The design effort for small circuits may be manual, but industry relies on automated synthesis tools for designing massive integrated circuits.

The building block used by synthesis tools is the D flip-

behavior of

## JK

and T flip-flop.

(56)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure

The procedure for designing synchronous sequential

## circuits

can be summarized by a list of recommended steps:

1. From specification of the desired operation, derive a

## state diagram for the circuit.

2. Reduce the number of states if necessary.

3. Assign binary values to the states.

4. Obtain the binary-coded state table (transition table).

5. Choose the type of flip-flops to be used.

6. Derive the simplified flip-flop input equations and

## output equations.

(57)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Specification:

Suppose we wish to design a circuit that detects a

sequence of three or more consecutive 1’s in a string of bits coming through an input line.

(58)

## Specification:

State diagram (no further

reduction)

(59)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Binary coded state table (Transition table):

(60)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Synthesis using D flip-flops:

the characteristic equations of T flip-flop, D flip-flop, and

⊕ Q,

## Q(t+1) = J Q′ + K′Q, respectively.

From Transition table: A(t + 1) = D

### A

(A, B, x) = Σ(3, 5, 7)

## B(t + 1) = DB

(A, B, x) = Σ(1, 5, 7)

## y(A, B, x) = Σ(6, 7)

(61)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Simplified flip-flop input equation and output equation:

(62)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Simplified flip-flop input equation and output equation:

(63)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

(64)

## Logic Diagram:

(65)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – excitation tables

The design of a sequential circuit with flip-flops other than the D type flip-flop is complicated by the fact that the input equations for the circuit must be derived indirectly from the state table.

When D type flip-flop are employed, the input equations are obtained directly from the state table. This is not the case for the

## JK

and T types of flip-flops (refer to the

characteristic equations Q(t+1) = T

## Q(t+1) = J Q′ + K′Q, ).

(66)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – excitation tables

In order to determine the input equations for these flip- flops, it is necessary to derive a functional relationship between the state table and the input equations.

A table called excitation table lists the required inputs for a given change of state.

(67)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – excitation tables

(68)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – excitation tables

(69)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Synthesis using JK flip-flops:

(70)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Synthesis using JK flip-flops:

(71)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Synthesis using JK flip-flops:

(72)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Synthesis using JK flip-flops:

(73)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Synthesis using JK flip-flops:

(74)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure -- example

## Synthesis using JK flip-flops:

(75)
(76)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – another example

## Specification:

Design a three bit binary counter.

(77)
(78)

## Synthesis using T flip-flops:

(79)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – another example

## Synthesis using T flip-flops

(80)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – another example

## Synthesis using T flip-flops

(81)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – another example

## Synthesis using T flip-flops

(82)

Text Book: Digital Design 4th Ed.

Chap 5.8 Design procedure – another example

## Synthesis using T flip-flops

circuit sat: Given a circuit, is there a truth assignment such that the circuit outputs true?.. • circuit sat ∈ NP: Guess a truth assignment and then evaluate the

circuit sat: Given a circuit, is there a truth assignment such that the circuit outputs true?.. • circuit sat ∈ NP: Guess a truth assignment and then evaluate the

circuit sat: Given a circuit, is there a truth assignment such that the circuit outputs truea. • circuit sat ∈ NP: Guess a truth assignment and then evaluate

volume suppressed mass: (TeV) 2 /M P ∼ 10 −4 eV → mm range can be experimentally tested for any number of extra dimensions - Light U(1) gauge bosons: no derivative couplings. =&gt;

Courtesy: Ned Wright’s Cosmology Page Burles, Nolette &amp; Turner, 1999?. Total Mass Density

• Formation of massive primordial stars as origin of objects in the early universe. • Supernova explosions might be visible to the most

(Another example of close harmony is the four-bar unaccompanied vocal introduction to “Paperback Writer”, a somewhat later Beatles song.) Overall, Lennon’s and McCartney’s