Chapter 7 Sequential Logic Design Principles ( 时序逻辑设计原理 )

233

Click here to load reader

description

Digital Logic Design and Application ( 数字逻辑设计及应用 ). Chapter 7 Sequential Logic Design Principles ( 时序逻辑设计原理 ). Latches and Flip-Flops ( 锁存器和触发器 ) Clocked Synchronous State-Machine Analysis ( 同步时序分析 ) Clocked Synchronous State-Machine Design ( 同步时序设计 ). Introduction. - PowerPoint PPT Presentation

Transcript of Chapter 7 Sequential Logic Design Principles ( 时序逻辑设计原理 )

Page 1: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

1

Chapter 7 Sequential Logic Design Principles( 时序逻辑设计原理 )

Latches and Flip-Flops

( 锁存器和触发器 ) Clocked Synchronous State-Machine Analysis

(同步时序分析 ) Clocked Synchronous State-Machine Design

(同步时序设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 2: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

2

IntroductionCombinational circuit

Outputs depend solely on the present combination of the circuit inputs’ values

DigitalSystem

b=0 F=0

DigitalSystem

if b=0, then F=0if b=1, then F=1

b=1 F=1

(a)

DigitalSystem

b=0 F=0

DigitalSystem

b=1 F=1

DigitalSystem

b=0 F=1

Cannot determine value ofF solely from presentinput value

(b)

• Vs. sequential circuit: Has “memory” that impacts outputs too

Page 3: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

3

Basic Concepts (基本概念 )

Logic Circuits are Classified into

Two Types (逻辑电路分为两大类 ):Combinational Logic Circuit

(组合逻辑电路)Sequential Logic Circuit

(时序逻辑电路)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 4: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

4

Basic Concepts (基本概念 )Combinational Logic Circuit

(组合逻辑电路)

Outputs Depend Only on its Current Inputs.

( 任何时刻的输出仅取决与当时的输入 )

Character of Circuit: No Feedback Circuit,

No Memory Device

( 电路特点:无反馈回路、无记忆元件 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 5: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

5

Basic Concepts (基本概念 )Sequential Logic Circuit

(时序逻辑电路)Outputs Depend Not Only on its Current Inputs, But also on the Past Sequence of Inputs.

( 任一时刻的输出不仅取决与当时的输入,还取决于过去的输入序列 )

Character of Circuit: Have Feedback Circuit, Have Memory Device

( 电路特点:有反馈回路、有记忆元件 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 6: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

6

Basic Concepts (基本概念 )Sequential Logic Circuit

(时序逻辑电路)Finite-State Machine: Have Finite States.( 有限状态机:有有限个状态。)

A Clock Signal is Active High if state changes occur at the clock’ Rising Edge or when the clock is High, and Active Low in the complementary case.( 时钟信号高电平有效是指在时钟信号的上升沿或时钟的高电平期间发生变化。)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 7: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

7

Basic Concepts (基本概念 )Sequential Logic Circuit

(时序逻辑电路)Clock Period: The Time between Successive transitions in the same direction.( 时钟周期:两次连续同向转换之间的时间。)

Clock Frequency: The Reciprocal of the Clock Period( 时钟频率:时钟周期的倒数。)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Figure 7-1

Page 8: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

8

Basic Concepts (基本概念 )Sequential Logic Circuit

(时序逻辑电路)Clock Tick: The First Edge of Pulse in a clock period or sometimes the period itself.( 时钟触发沿:时钟周期内的第一个脉冲边沿,或时钟本身。)Duty Cycle: The Percentage of time that the clock signal is at its asserted level. ( 占空比:时钟信号有效时间与时钟周期的百分比。)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Figure 7-1

Page 9: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

9

思考:能否只用一片 1 位全加器进行串行加法??

C1

S0

X0 Y0

C0

X YCI CO

S

X YCI CO

S

X YCI CO

SC0

S0 S1 Sn

X0 Y0 X1 Y1 Xn Yn串行加法器

C1 C2

X YCI CO

SC2

S1

X1 Y1

C1

反馈利用反馈和时钟控制

C3

S2

X2 Y2

C2

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 10: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

10

暂存

X YCI CO

SCi+1

Si

Xi Yi

Ci

X YCI CO

S

X YCI CO

S

X YCI CO

SC0

S0 S1 Sn

X0 Y0 X1 Y1 Xn Yn串行加法器

C1 C1

时钟控制

需要具有记忆功能的逻辑单元,能够暂存运算结果。

利用反馈和时钟控制

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 11: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

11

7.1 Bistable Elements (双稳态元件 )

Q

Q_L

1

10

0 Q

Q_L

It has Two Stable State: Q = 1 ( HIGH ) and Q = 0 ( LOW )

( 电路有两种稳定状态: Q = 1 ( 1 态 ) 和 Q = 0 ( 0 态 ))

—— Bistable Circuit (双稳电路)

0

01

1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 12: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

12

7.1 Bistable Elements (双稳态元件 )

Q

Q_L

1

10

0 Q

Q_L

When Power is first Applied to the circuit, it

Randomly Comes up in One State or the Other

and Stays there Forever.

( 只要一接电源,电路就随机出现两种状态中的一种,并永久地保持这一状态。 )

0

01

1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 13: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

13

Vin1

Vout1

Vin2

Vout2

Vout2

Vin2

= Vin2

= Vout2

稳态 stable

亚稳态 metastableQ

Q_L

Vin1 Vout1

Vin2 Vout2

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 14: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

14

Metastable Behavior(亚稳态特性 )

Random Noise will tend to Drive a circuit that is

Operating at the Metastable Point toward one of

the Stable operating point.

( 随机噪声会驱动工作于亚稳态点的电路转移到一个稳态的工作点上去 )

Q

Q_L

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 15: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

15

所有的时序电路对亚稳态都是敏感的

Metastable Behavior(亚稳态特性 )

稳态 稳态

亚稳态

Apply a definite Pulse Width from a Stable

state to the Other.

( 从一个“稳态”转换到另一个“稳态”需加一定宽度的脉冲(足够的驱动) )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 16: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

16

7.2 Latches and Flip-Flops(锁存器与触发器 )

—— The Basic Building Blocks of most

Sequential Circuits.

(大多数时序电路的基本构件 )

Latches(锁存器)根据输入,直接改变其输出(无使能端)

有使能端时,在使能信号的有效电平之内都可根据输入直接改变其输出状态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 17: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

17

7.2 Latches and Flip-Flops(锁存器与触发器 )

—— The Basic Building Blocks of most

Sequential Circuits.

(大多数时序电路的基本构件 )

Flip-Flops ( F/F,触发器)只在时钟信号的有效边沿改变其输出状态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 18: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

18

S-R Latch (S-R锁存器 ) S-R Latch with Enable

(具有使能端的 S-R锁存器 ) D Latch (D锁存器 ) Edge-Triggered D Flip-Flops

(边沿触发式 D触发器 ) Edge-Triggered D Flip-Flops with Enable

(具有使能端的边沿触发式 D触发器 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

7.2 Latches and Flip-Flops(锁存器与触发器 )

Page 19: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

19

Scan Flip-Flops

(扫描触发器 ) Master/Slave Flip-Flops (S-R、 J-K) (主从式触发器 ) Edge-Triggered J-K Flip-Flops

(边沿触发式 J-K触发器 ) T Flip-Flop

(T触发器 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

7.2 Latches and Flip-Flops(锁存器与触发器 )

Page 20: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

20

S-R Latches (S-R锁存器 )

Q

QL

R

S

( 1) S = R = 0

电路维持原态

工作原理:0

0

Q

QL

或非门 非门

Qn+1 = Qn

QLn+1 = QLn

新态

原态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 21: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

21

Q

QL

R

S

工作原理:

1

0

( 2) S = 0, R = 1

a. 原态: Qn=0,QLn=1

0

1

新态: Qn+1=0,QLn+1=1

b. 原态: Qn=1,QLn=0

新态: Qn+1=0,QLn+1=1

锁存器清 0:Qn+1=0 QLn+1=1

即使 S,R 无效( =0 )锁存器仍能锁定 0 态

Reset1

0

(a)

Q

QL

R

S

1

0

0

1(b)

0

010

1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

S-R Latches (S-R锁存器 )

Page 22: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

22

Q

QL

R

S

工作原理:

0

1

( 3) S = 1, R = 0

a. 原态: Qn=1,QLn=0

1

0

新态: Qn+1=1,QLn+1=0

b. 原态: Qn=0,QLn=1

新态: Qn+1=1,QLn+1=0

锁存器置 1:Qn+1=1 QLn+1=0

即使 S,R 无效( =0 )锁存器仍能锁定 1 态

Set0

1

(a)

Q

QL

R

S

0

1

1

0(b)

0

0

1

1

0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

S-R Latches (S-R锁存器 )

Page 23: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

23

Q

QL

R

S

工作原理:( 3) S = R = 1

0

0

Qn+1 = QLn+1 = 0

当 S,R 无效( =0 )时,

1

1

Q

QN

0

0

亚稳态,对噪声敏感状态不确定

“ 禁止”

Digital Logic Design and Application ( 数字逻辑设计及应用 )

S-R Latches (S-R锁存器 )

Page 24: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

24

S Q

R QL

( 逻辑符号 )

S Q

R Q

( 逻辑符号 )

Q

QL

R

S

Reset

Set

( 清 0)

( 置 1)0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

S R

010011

0*0*

Qn Qn+1

状态转移真值表

0 00 11 01 1

S R

维持原态0 11 0

0* 0*

Q QL

( 功 能 表 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

S-R Latches (S-R锁存器 )

Logic SymbolFunction Table

Page 25: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

25

状态图

0

0

0 1

1 1

0

1

00 01 11 10Qn

SRQn+1

Qn+1 = S + R’·Qn

S·R = 0特征方程 约束条件

0 1

S=1,R=0

S=0,R=1

S=XR=0

S=0R=X

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

S R

010011

0*0*

Qn Qn+1

状态转移真值表

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 26: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

26

tpw(min)

0 00 11 01 1

S R

维持原态0 11 0

0* 0*

Q QL

S

R

Q

tpLH(SQ) tpHL(RQ)

S

R

Q

QL

传播延迟

最小脉冲宽度

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Figure 7-8

Page 27: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

27

S-R锁存器的动作特点

输入信号在全部有效电平内,都能直接改变锁存器的状态(直接置位-复位触发器)

输入端需遵守约束条件抗干扰能力最低

当 S=R=1,然后同时取消时S和 R端输入信号脉冲宽度过小S和 R端输入信号同时取反

锁存器进入亚稳态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 28: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

28

第 7章作业 7.4(7.2) 7.5(7.3) 7.7(7.5) 7.12(7.9) 7.13(7.10) 7.16(7.13) 7.17(7.14) 7.18(7.15) 7.19(7.16)

7.20(7.19) 7.21(7.20)(c)

7.41(7.27) 7.43(7.28) 7.46(7.34) 7.51(7.47) 7.52(7.49) 7.77(7.68)

Page 29: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

29

Draw the Output Waveform of the S-R Latch

Digital Logic Design and Application ( 数字逻辑设计及应用 )

A Class Problem ( 每课一题 )

S

R

Q

Page 30: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

30

Chapter 7 Sequential Logic Design Principles( 时序逻辑设计原理 )

Latches and Flip-Flops

( 锁存器和触发器 ) Clocked Synchronous State-Machine Analysis

(同步时序分析 ) Clocked Synchronous State-Machine Design

(同步时序设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 31: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

31

Review of Last Class (内容回顾 )

时序逻辑电路输出取决于输入和过去状态电路特点:有反馈回路、有记忆元件

双稳态元件

Q

Q_L

0 态 和 1 态 稳态 稳态

亚稳态注意:亚稳态特性

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 32: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

32

时序逻辑电路输出取决于输入和过去状态电路特点:有反馈回路、有记忆元件

双稳态元件Q

Q_L

0 态 和 1 态

如何加入控制信号??

Q

QL

R

S

Review of Last Class (内容回顾 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 33: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

33

S - R latch(锁存器)

S_L = R_L = 1

1 11 00 10 0

S_L R_L

维持原态0 11 0

1* 1*

Q QL

S-R 锁存器功能表

电路维持原态S_L = 1, R_L = 0 Q = 0, QL = 1

S_L = 0, R_L = 1 Q = 1, QL = 0

S_L = R_L = 0 Q=QL=1 ,不定状态

Q

QL

S_L

R_L

S

R清 0置 1不定

S Q

R Q

逻辑符号

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 34: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

34

S-R Latch with Enable(具有使能端的 S-R锁存器 )

S

R

C

Q

QL

S_L

R_L

0 X X1 0 01 0 11 1 01 1 1

C S R

维持原态维持原态

0 11 0

1* 1*

Q QL

功能表

(1). C = 0 时: 维持原态(2). C = 1 时:与 S-R 锁存器相

似注意:当 S=R=1 时,若 C 由 10 , 则下一状态不可预测。

逻 辑 符 号

SCR

Q

Q

—— 又称“时钟 S-R 锁存器”

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 35: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

35

0 X X1 0 01 0 11 1 01 1 1

C S R

维持原态维持原态

0 11 0

1* 1*

Q QL时钟 S-R 锁存器时序图

Q

S

R

C

动作特点:输入信号在时钟(使能端)有效期间,都能直接改变触发器的状态。

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 36: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

36

D Latch (D锁存器 )

When D = 1,Q = 1

C = 0 ,

Q

QL

S

R

D

C

数据输入端

控制端ENABLE

CLK

输出状态保持不变输出随输入状态而改变C = 1 ,

When D = 0,Q = 0Q = D

Transparent Latch( 透明锁存器 )

C D Q QL

1 0 0 11 1 1 0

0 X 保 持

D 锁存器功能表

D Q

C Q

逻辑符号

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 37: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

37

Level-Sensitive D Latch

SR latch requires careful design to ensure SR=11 never occurs

D latch relieves designer of that burden Inserted inverter

ensures R always opposite of S

D Q

QC

D latch symbol

R1

S1D

C

D latch

Q

S

R

Page 38: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

38

Level-Sensitive D Latch

R1

S1D

C

D latch

Q

S

R

1

0D

C

S1

R1

Q

1

0

1

0

1

0

1

0

Page 39: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

39

特征方程: Qn+1 = D( C=1)

0 1

D=1

D=0

D=1D=0

01

D

01

Qn+1

状态转移真值表

Function Description of a D Latch

(D锁存器的功能描述 )

状态图

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 40: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

40

tpw(min)

0 00 11 01 1

S R

维持原态0 11 0

0* 0*

Q QL

S

R

Q

tpLH(SQ) tpHL(RQ)

S

R

Q

QL

传播延迟

最小脉冲宽度

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Figure 7-8

Page 41: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

41

Q

D

C

tpLH(CQ)

tpHL(DQ)

tpLH(DQ) tpHL(CQ)

在 C 的下降沿附近有一个时间窗这段时间内 D 输入一定不能变化

tsetup

Setup Time( 建立时间 )

thold

Hold Time( 保持时间 )

Timing Parameters for a D Latch(D 锁存器的时序图 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 42: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

42

D Latch with CMOS Transmission Gate

(利用 CMOS传输门的D锁存器 )

QL

Q

TG

TG

D

C

EN

EN_L

A B

CMOS 传输门

TG

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 43: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

43

QL

Q

TG1

TG2

D

CC = 0

TG1 断开

TG2 连通

保持原态

Q_L

Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )D Latch with CMOS Transmission

Gate(利用 CMOS传输门的D锁存器 )

Page 44: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

44

QL

Q

TG1

TG2

D

CC = 1

TG1 连通

TG2 断开 QL = D’

Q = D

C D Q QL

1 0 0 11 1 1 0

0 X 保 持

功能表

Digital Logic Design and Application ( 数字逻辑设计及应用 )D Latch with CMOS Transmission Gate

(利用 CMOS传输门的D锁存器 )

Page 45: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

45

D QC Q

D QC Q

D QC Q

D QC Q

DIN[3:0] WR DOUT[3:0]RD

Applicationsof Latches(锁存器的应用 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 46: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

46

Q D

Q C

XYCI

Si

Ci+1

Xi

Yi

Ci

SCO

CLK

暂存

X YCI CO

SCi+1

Si

Xi Yi

Ci

时钟控制

串行输入、串行输出注意:时钟同步

再谈串行输入加法器的实现

Applicationsof Latches(锁存器的应用 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 47: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

47

Storing One Bit Example Requiring Bit Storage

Flight attendant call buttonPress call: light turns

onStays on after button

released

a

3.2

BitStorage

Blue lightCallbutton

Cancelbutton

1. Call button pressed – light turns on

BitStorage

Blue lightCallbutton

Cancelbutton

2. Call button released – light stays on

1

1

Page 48: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

4848

Storing One Bit – Flip-FlopsExample Requiring Bit Storage

Press cancel: light turns off

Stays off after button released

Logic gate circuit to implement this?

QCallCancel

Doesn’t work. Q=1 when Call=1, but doesn’t stay 1 when Call returns to 0

Need some form of “feedback” in the circuit

3.2

BitStorage

Blue lightCallbuttonCancelbutton

3. Cancel button pressed – light turns off

0

Page 49: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

4949

First attempt at Bit Storage

Need some sort of feedbackDoes circuit below do what we want?

QS

t

Page 50: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

50

First attempt at Bit StorageNo: Once Q becomes 1 (when S=1), Q

stays 1 forever – no value of S can bring Q back to 0

10

10

10

Q

t

S

0t

1 QS

00t

1Q

S

1 1t

1Q

S

1 1t

0Q

S

10t

0 QS

0

Page 51: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

51

Bit Storage Using an SR Latch

Q

S (set) SR latch

R (reset)

Does the circuit to the right, with cross-coupled NOR gates, do what we want?

Yes! How did someone

come up with that circuit?

Maybe just trial and error, a bit of insight...

Page 52: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

52

Bit Storage Using an SR Latch

0

0

1

R=1

S=0 t

Q

1010

R

S

10

t

10

Q

1

0 0

10

1

t

Q

S=0

R=0

t

Q

S=1

R=0

0

1

1 t

Q

R=0

S=0

1

01

0

00 1

1X 0

Recall NOR…

Page 53: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

5353

Example Using SR Latch for Bit Storage

SR latch can serve as bit storage in previous example of flight-attendant call buttonCall=1 : sets Q to 1

Q stays 1 even after Call=0

Cancel=1 : resets Q to 0

BitStorage

Blue lightCallbutton

Cancelbutton

Page 54: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

5454

Example Using SR Latch for Bit Storage

But, there’s a problem...

R

S

Q

Callbutton

Blue light

Cancelbutton 1

01

Page 55: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

5555

Problem with SR LatchProblem

If S=1 and R=1 simultaneously, we don’t know what value Q will take

R=1

S=1

0

0

0

0

t

Q

R=0

S=0

0

0

1

1

t

Q

R=0

S=0

1

1

0

0

t

Q

0

1

0

1

0

1

0

1

S

R

Q

t

Page 56: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

5656

Problem with SR LatchProblem

If S=1 and R=1 simultaneously, we don’t know what value Q will take

1t

0

1Q

0

Q may oscillate. Then, because one path will be slightly longer than the other, Q will eventually settle to 1 or 0 – but we don’t know which. Known as a race condition.

Page 57: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

57

Problem with SR Latch

Designer might try to avoid problem using external circuitCircuit should prevent SR from ever being 11But 11 can occur due to different path delays

RCncl

Call S SR latch

Q

Callbutton

Cancelbutton

External circuit

Page 58: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

58

Problem with SR LatchAssume 1 ns delay per

gate. The longer path from Call to R than from Call to S causes SR=11 for short time – could be long enough to cause oscillation

1

0

1

01

0

1

0

Call

Cncl

S

R

SR = 11

2 ns

Page 59: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

59

Problem with SR Latch

Glitch can also cause undesired set or reset

RCncl

Call S SR latch

Q

Callbutton

Cancelbutton

External circuit

Suppose this wire has 4 ns delay

Page 60: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

60

Problem with SR Latch

1

0

1

0

1

0

1

0

Call

Cncl

S

R

SR = 01(undesired

glitch)

4 ns

Page 61: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

61

Solution: Level-Sensitive SR Latch

Add enable input “C” Only let S and R change

when C=0Ensure circuit in front of

SR never sets SR=11, except briefly due to path delays

Set C=1 after time for S and R to be stable

When C becomes 1, the stable S and R value passes through the two AND gates to the SR latch’s S1 R1 inputs.

R1

S1S

C

R

Level-sensitive SR latch

Q

SC

Q

QR

Level-sensitive SR latch symbol

Page 62: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

62

Solution: Level-Sensitive SR Latch

R1

S1SCall

Cncl

CClk

R

Level-sensitive SR latch

Q

Glitch on R (or S) doesn’t affect R1 (or (S1)

01

01

S1

R1

CorrectValues when

enabled

10101010

Call

Cncl

S

R

10

C

Page 63: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

63

Flip-Flops (触发器 )Change its outputs only at the Rising or Falling

Edge of a controlling CLK signal.

(只在时钟信号的边沿改变其输出状态 )

CLK

Positive-EdgeRising-Edge

( 正边沿上升沿 )

Negative-EdgeFalling-Edge

( 负边沿下降沿 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 64: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

64

Flip-Flops (触发器 )

从功能上分D触发器、 S-R触发器、 J-K触发器、 T 触发器

从结构上分主从结构触发器、边沿触发器

其他类型触发器带使能端的触发器、扫描触发器施密特触发器、单稳态触发器

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 65: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

65

D Flip-Flop

Flip-flop: Bit storage that stores on clock edge

One design – master-servantClk = 0 – master enabled, loads D, appears

at Qm. Servant disabled.Clk = 1 – Master disabled, Qm stays same.

Servant latch enabled, loads Qm, appears at Qs.

Thus, value at D (and hence at Qm) when Clk changes from 0 to 1 gets stored into servant

Page 66: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

66

D Flip-Flop

Clk

rising edges

Note: Hundreds of different flip-flop designs exist

D latch

master

D latch

servant

DDm Ds

Cs

Qm Qs

QsQ

Q

Cm

Clk

D flip-flop

Clk

D/Dm

Qm/DsCm

CsQs

Can we design bit storage that only stores a value on the rising edge of a clock signal?

Page 67: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

67

D Flip-Flop Solves problem of not knowing through how

many latches a signal travels when C=1

In figure below, signal travels through exactly one flip-flop, for Clk_A or Clk_B

Why? Because on rising edge of Clk, all four flip-

flops are loaded simultaneously – then all four no longer pay attention to their input, until the next rising edge. Doesn’t matter how long Clk is 1.

Page 68: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

6868

D Flip-Flop

Two latches inside each flip-flop

D1 Q1 D2Q2 D3Q3 D4Q4Y

Clk

Clk_A Clk_B

1 1

Page 69: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

69

D Flip-Flops (D触发器 )

D QC Q

D Q

C Q

Q

QL

D

CLK

CLK=0 时,

CLK=1 时,

主锁存器工作,接收输入信号 Qm = D

从锁存器不工作,输出 Q 保持不变

主锁存器不工作, Qm 保持不变从锁存器工作,将 Qm 传送到输出端

Master(主 ) Slave (从 )Qm

—— 主从结构

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 70: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

70

D

CLK

Q

Qm

D QC Q

D Q

C Q

Q

QL

D

CLK

Qm

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 71: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

71

D

CLK

Q

D CLK Q QL

0 0 11 1 0

X 0 保 持X 1 保 持

功能表

D Q

CLK Q

逻辑符号

表示边沿触发特性

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 72: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

72

D

CLK

Q

D

CLK

Q

D 锁存器

D 触发器 —— 边沿有效

—— 电平有效Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 73: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

73

利用触发器作为移位寄存器(图 1 )

思考:能否将触发器改为锁存器 ( 图2)D

CLK

Q1

Q

D QC Q

D Q

C Q

QD

CLK

latch latch

(图 2 )

Q1

D Q

CLK Q

D Q

CLK Q

QD

CLK

F / F F / F

(图 1 )

Q1

Applications of Flip-Flops (触发器的应用 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 74: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

7474

Problem with Level-Sensitive D Latch

D latch still has problem (as does SR latch)When C=1, through how many latches will

a signal travel?Depends on how long C=1

Page 75: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

75

Problem with Level-Sensitive D Latch

Clk_A – signal may travel through multiple latches

Clk_B – signal may travel through fewer latches

1 1? 1?1?D1 Q1 D2 Q2 D3 Q3 D4

C4C3C2C1

Q4Y

Clk

Clk_A Clk_B

Page 76: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

76

Problem with Level-Sensitive D Latch

R2

S2D2

C2

D latch

Q2

D4

C4

Q4

R1

S1D1

C1

Clk

D latch

Q1

0–>1 0–>1

0–>1

1–>0

0–>1

1–>00–>1

(a)

D3

C3

Q3

0–>1

Page 77: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

77

Problem with Level-Sensitive D Latch

( c )

ClkD1

Q1/D2S2R2Q2

Short clock

Q1 doesn't change

(b)

ClkD1

Q1/D2S2R2Q2 2nd latch set

Long clock

Page 78: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

78

Flight-Attendant Call Button Using D Flip-Flop

D flip-flop will store bit Inputs are Call, Cancel, and present value of D flip-flop, Q Truth table shown below

D Q

QClk

Callbutton

Cancelbutton

Bluelight

Comb.Circuit

Call

Cncl

Q

D

L

Page 79: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

79

Flight-Attendant Call Button Using D Flip-Flop

Preserve value: if Q=0, make D=0; if Q=1, make D=1Cancel -- make D=0

Call -- make D=1

Let’s give priority to Call -- make D=1

Circuit derived from truth table, using

combinational logic design process

DQ

QClk

Callbutton Blue

lightCall

Cancel

Q

Cancelbutton

Page 80: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

80

Timing Parameters for a D Flip-Flops

(D触发器的定时参数 ) Propagation Delay (传播延迟( CLKQ) )

tpLH(CQ)

tpHL(CQ)

tsetup

( 建立时间 )

thold

( 保持时间 )

建立时间(输入信号先于时钟到达的时间) 保持时间(有效时钟沿后输入信号保持的时间)

D

CLK

Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 81: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

81

利用 CMOS 传输门实现 —— 主从结构Slave ( 从触发器 )Master ( 主触发器 )

回顾:利用 COMS 传输门的 D 锁存器

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 82: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

82

Clock Signal

Flip-flop Clk inputs typically connect to one clock signal

Coming from an oscillator component

Osc.Clk

Page 83: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

8383

Clock Signal Generates periodic pulsing signal

Below: "Period" = 20 ns, "Frequency" = 1/20 ns = 50 MHz

"Cycle" is duration of 1 period (20 ns); below shows 3.5 cycles

0 nsTime:

Clk

10 ns 20 ns 30 ns 40 ns

000

0

1

0111

50 ns 60 ns

Period/Freq shortcut: Remember 1 ns 1 GHz

100 GHz10 GHz1 GHz

100 MHz10 MHz

0.01 ns0.1 ns

1 ns10 ns

100 ns

PeriodFreq.

Page 84: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

84

第 7章作业 7.4(7.2) 7.5(7.3) 7.7(7.5) 7.12(7.9) 7.13(7.10) 7.16(7.13) 7.17(7.14) 7.18(7.15) 7.19(7.16)

7.20(7.19) 7.21(7.20)(c)

7.41(7.27) 7.43(7.28) 7.46(7.34) 7.51(7.47) 7.52(7.49) 7.77(7.68)

Page 85: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

85

Draw the Output Waveform of the D Flip-Flop

Digital Logic Design and Application ( 数字逻辑设计及应用 )

A Class Problem ( 每课一题 )

D

CLK

Q

Page 86: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

86

Chapter 7 Sequential Logic Design Principles( 时序逻辑设计原理 )

Latches and Flip-Flops

( 锁存器和触发器 ) Clocked Synchronous State-Machine Analysis

(同步时序分析 ) Clocked Synchronous State-Machine Design

(同步时序设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 88: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

88

锁存器与触发器Q

QL

R

S

Q

QL

S_L

R_L

S

R

C

D

C

具有使能端的 S-R 锁存器S-R 锁存器

D 锁存器

S-R 锁存器

有约束条件

Review of Last Class (内容回顾 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 89: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

89

CLK

Q

QL

D

利用与非门传输门实现 —— 主从结构Positive-Edge-Triggered D Flip-

Flop(具有预置和清零端的正边沿 D触发器 )

PR_L

CLR_L PRD Q CLK Q

CLR

PR( preset)、 CLR( clear)相当于: S( set ) 、

R( reset)通常用于初始化电路状态、测试等

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 90: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

90

具有预置和清零端的正边沿 D 触发器时序图

CLK

PR_L

CLR_L

QL

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 91: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

91

维持阻塞结构D触发器Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 92: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

92

Negative-Edge-Triggered D Flip-Flop

(负边沿触发的D触发器 )

D QC Q

D Q

C Q

Q

QN

D

CLK

D Q

CLK Q

D QC Q

D Q

C Q

Q

QL

D

CLK

正边沿触发

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 93: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

93

2-Input Multiplexer

(2 选 1 多路复用器 )

D Flip-Flop with Enable(具有使能端的D触发器 )

D Q

CLK Q

D

EN

CLK

Q

QL

EN 有效( =1 ) 选择外部 D 输入EN 无效( =0 ) 选择触发器当前的输出

D QEN

CLK Q

Logic Symbol( 逻辑符号 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 94: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

94

Scan Flip-Flop (扫描触发器 )

Function Table ( 功能表 ) : Figure 7-22(b)

D Q

CLK Q

D

TE

CLK

Q

QLTI

TE = 0 正常操作 Q=D TE = 1 进入测试模式

测试使能端

测试输入端

D TETI

CLK

Q

Q

Logic Symbol( 逻辑符号 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 95: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

95

TE = 0 正常操作 TE = 1 进行测试

每个触发器的输出端 Q 都与后一个触发器的 TI 端连接 TIN 端扫入一组测试向量(需若干个时钟触发沿) 再经过若干个时钟的正常操作( TE=0) 可以在 TO 端观察(扫出)电路的新状态

TIN

CLKTE

TO

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 96: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

96

利用触发器作为移位寄存器(图 1 )

思考:能否将触发器改为锁存器 ( 图2)D

CLK

Q1

Q

D QC Q

D Q

C Q

QD

CLK

latch latch

(图 2 )

Q1

D Q

CLK Q

D Q

CLK Q

QD

CLK

F / F F / F

(图 1 )

Q1

Applications of Flip-Flops (触发器的应用 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 97: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

97

Master/Slave S-R Flip-Flop(主从式 S-R触发器 )

S QCR Q

S QCR Q

C

S

R

Q

QN

SCR

Q

Q

回顾:有使能端的 S-R 锁存器 C 的有效电平期间,输入直接改变触发器的状态 输入信号需要遵守约束条件

希望输出在一个时钟周期内只变化一次—— 采用主从结构

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 98: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

98

亚 稳 态主锁存器输出

主从式 S-R触发器的内部时序

暂时忽略延迟时间等动态特性

C

亚 稳 态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 99: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

99

亚 稳 态

是不是边沿触发??C

亚 稳 态

虽然输出在一个时钟周期只可能变化一次但不能算是边沿触发

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 100: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

100

SCR

Q

Q

D QC Q

D Q

C Q

Q

QN

D

CLK

D Q

CLK Q

思考:同样是主从结构, 为什么由 D 锁存器构成的可以称为边沿 D 触发器, 而由 S-R 锁存器构成的不能称为边沿 S-R 触发器?

S QCR Q

C

S

R

Q

QL

S QCR Q 延迟输出

C 无效时输出变化

动态输入指示边沿触发

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 101: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

101

Master/Slave J-K Flip-Flop(主从式 J-K触发器 )

消除主从 S-R 触发器存在的约束条件利用反馈消除主从 S-R 触发器存在的约束条件

Qn+1 = S + R’·Q

S·R = 0 (约束条件)

主从 S-R 触发器特征方程

S QCR Q

C

S

R

Q

QL

S QCR Q

S = J·Q’

R = K·Q

总满足 S·R=0

J

K

C

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 102: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

102

消除主从 S-R 触发器存在的约束条件利用反馈消除主从 S-R 触发器存在的约束条件

Qn+1 = S + R’·Q

S·R = 0 (约束条件)

主从 S-R 触发器特征方程

S = J·Q’

R = K·Q

总满足 S·R=0

Qn+1 = S + R’·Q

= J·Q’ + (K·Q)’·Q

= J·Q’ + (K’+Q’)·Q = J·Q’ + K’·Q

主从 J-K 触发器特征方程

Q —— 当前状态(原态、现态)Q* —— 下一状态(新态、次态)

Q* = J·Q’ + K’·Q

Q* = S + R’·Q

Master/Slave J-K Flip-Flop(主从式 J-K触发器 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 103: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

103

J K Q

0 0 0 11 01 1

保持清 0置 1翻转

功能表

JCK

Q

Q

Logic Symbol( 逻辑符号 )

C

J

Qm

Q

K

01

C=1期间,J的变化只引起Qm 改变一次

1 箝位

S QCR Q

Q

QL

S QCR Q

J

K

C

主 从Qm

Function Table

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 104: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

104

J K Q

0 0 0 11 01 1

保持清 0置 1翻转

功能表

JCK

Q

Q

逻辑符号

C

K

Qm

Q

J 1

0

C=1期间J,K 的变化可能引起Qm

的变化,但只能改变一次

0 箝位

S QCR Q

Q

QL

S QCR Q

J

K

C

主 从Qm

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 105: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

105

J和 K 输入在 C=1期间保持不变

每个 C 周期的高电平阶段关心输入端 J、 K 的变化;每个 C 周期的低电平阶段关心触发器状态 Q 的变化。

0

1

0

1

0

0

0

1

1

1 1 0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 106: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

106

具有多输入端的 J-K触发器

S QCR Q

Q

QL

S QCR Q

J2K1

C

主 从QmJ1

K2

J = J1J2

K = K1K2

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 107: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

107

Edge-Triggered J-K Flip-Flop(边沿 J-K触发器 )

Q* = D = J·Q’ + K’·Q

时钟上升沿(正边沿)有效不会出现“箝位”现象

J

K

CLK

Q

QL

D Q

CLK

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 108: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

108

利用门电路传输延迟时间的边沿 J-K触发器

两个与或非门组成基本 RS 触发器

门G3G4 的传输延迟时间大于基本 RS 触发器的翻转时间

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 109: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

109

S QCR Q

Q

QL

S QCR Q

J2K1

C

主 从QmJ1

K2

S QCR Q

Q

QL

S QCR Q

J

K

C

主 从Qm

Master/Slave J-K Flip-Flop(主从 J-K 触发器)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 110: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

110

Edge-Triggered J-K Flip-Flop(边沿 J-K触发器 )

Q* = D = J·Q’ + K’·Q

时钟上升沿(正边沿)有效不会出现“箝位”现象

J

K

CLK

Q

QL

D Q

CLK

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 111: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

111

T Flip-Flop (T触发器 )在每个时钟脉冲有效沿都会改变状态(翻转)

Q

QT

T( toggle)

触发器EN Q

T Q

具有使能端的T触发器

T

Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 112: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

112

Use a D/J-k Flip-Flop to Design a T Flip-Flop (利用D、 J-K触发器实现 T触发

器 )

利用D触发器实现

D:Q* = D

T:Q* = Q’

D = Q’

利用 J-K触发器实现

JK:Q* = J·Q’ + K’·Q

T:Q* = Q’

J = K = 1

T

Q

QND Q

CLK QT

Q

QN

J QCLK

K Q

1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 113: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

113

Possible Circuits for a T Flip-Flop with Enable( 具有使能端的 T触发器的可能电路 )

T:Q* = EN·Q’ + EN’·Q

01

EN

维持 Q翻转 Q’

Q*

功能表

JK:Q* = J·Q’ + K’·Q

D:Q* = D

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 114: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

114

Other Structure Flip-Flops(其他结构的触发器 )

维持阻塞结构利用门电路传输延迟时间的边沿 J-K 触发器

J

CLK

K QL

QPRL

CLRL

CLK

D

Q

QL

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 115: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

115

锁存器与触发器小结锁存器和触发器

—— 电平有效和边沿有效的区别按照逻辑功能的不同特点,通常可分为

S-R触发器(锁存器)

D触发器(锁存器)

J-K触发器

T触发器

每种触发器的功能表特征方程状态图

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 116: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

116

S-R Flip-Flops (Latches)

SCR

Q

Q

时钟 S-R 锁存器

0 00 11 01 1

S R

维持清 0置 1

0*

Q

功 能 表

0 00 11 01 1

S R

维持清 0置 1

1*

Q

功 能 表

主从 S-R 触发器

SCR

Q

Q

1 11 00 10 0

SL RL

维持清 0置 1

1*

Q 0 1*0

基本 S-R 锁存器

S Q

R Q

(或非门)

S Q

R Q

(与非门)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 117: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

117

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

S_L R_L

1*1*110001

Qn Qn+1

低电平有效 S-R 锁存器状态转移真值表

1

1 0

0

0

1

0

1

00 01 11 10Qn

S_LR_LQn+1

Q* = S_L’ + R_L·Q

= S+ R’·Q

约束条件: S_L + R_L = 1

S’+R’=1 S·R=0

特征方程

Q* = S+ R’·QS·R=0 (约束条件)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 118: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

118

0 00 11 01 1

S R

维持01

1*

Q

功能表

状态图

0 1

S=1,R=0

S=0,R=1

S=XR=0

S=0R=X

特征方程

Q* = S+ R’·Q

S·R=0 (约束条件)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

S-R Flip-Flops (Latches)

Page 119: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

119

J-K Flip-Flop

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

J K

01001110

Qn Qn+1

状态转移真值表

维持

清 0

置 1

翻转

0

0

0 1

1 1

1

0

0

1

00 01 11 10Qn

JKQn+1

特征方程

Q* = J·Q’ + K’·Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 120: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

120

0 00 11 01 1

J K

维持清 0置 1翻转

Q*

功能表

特征方程

Q* = J·Q’ + K’·Q

状态图

0 1

J=1,K=X

J=X,K=1

J=XK=0

J=0K=X

Digital Logic Design and Application ( 数字逻辑设计及应用 )

J-K Flip-Flop

Page 121: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

121

状态图

D Flip-Flops (Latches)

特征方程: Q* = D

0 1

D=1

D=0

D=1D=0

有使能端得 D 触发器: Q* = EN·D + EN’·Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 122: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

122

T Flip-Flop

特征方程: Q* = Q’

Q

QT

有使能端的 T触发器: Q* = EN·Q’ + EN’·Q

EN Q

T Q

说明: 传统中文教材中认为 T 触发器的特征方程为: Q* = T·Q’ + T’·Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 123: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

123

不同类型触发器间的相互转换

利用D触发器实现

S-R触发器

J-K触发器

T触发器

利用 J-K触发器实现

S-R触发器

D触发器

T触发器

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 124: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

124

关于电路结构和逻辑功能

同一逻辑功能的触发器可用不同电路结构实现 主从结构的 D触发器、维持阻塞结构的 D 触发器

用同一电路结构可做成不同逻辑功能的触发器 维持阻塞结构的: D触发器、 J-K触发器

电路构成的不同形式 下一状态 Q* 与现态 Q 及输入之间在稳态下的逻辑关系

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 125: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

125

动态参数—— 保证触发器在工作时能可靠翻转

锁存器的动态参数输入信号宽度: tW ≥ 2tpd

传输延迟时间: tPLH / tPHL

从输入信号到达,到触发器输出新态稳定建立

与非: tPLH = tpd 、 tPHL = 2tpd

或非: tPLH = 2tpd 、 tPHL = tpd

说明: tpd表示一个门的延迟时间

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 126: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

126

触发器的动态参数 建立时间 tset

输入信号应先于时钟信号到达的时间

保持时间 thold

时钟信号到达后,输入信号需要保持的时间

最高时钟频率 fmax

为保证触发器可靠翻转,时钟脉冲必须满足的参数

传输延迟时间 tpHL/tpLH

从时钟脉冲触发边沿算起,到触发器建立起新状态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 127: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

127

第 7章作业 7.4(7.2) 7.5(7.3) 7.7(7.5) 7.12(7.9) 7.13(7.10) 7.16(7.13) 7.17(7.14) 7.18(7.15) 7.19(7.16)

7.20(7.19) 7.21(7.20)(c)

7.41(7.27) 7.43(7.28) 7.46(7.34) 7.51(7.47) 7.52(7.49) 7.77(7.68)

Page 128: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

128

Draw the Output Waveform of the D Flip-Flop

Digital Logic Design and Application ( 数字逻辑设计及应用 )

A Class Problem ( 每课一题 )

Q

CLK

PR_L

CLR_L

Page 129: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

129

Chapter 7 Sequential Logic Design Principles( 时序逻辑设计原理 )

Latches and Flip-Flops

( 锁存器和触发器 ) Clocked Synchronous State-Machine Analysis

(同步时序分析 ) Clocked Synchronous State-Machine Design

(同步时序设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 130: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

130

兰州石化职业技术学院—国家重点建设示范性高职高专

青春啊,永远是美好的。可是真正的青春,只属于那些永远力争上游的人,永远忘我劳动的人,永远谦虚的人

知识是从刻苦劳动中得来的,任何成就都是刻苦劳动的结果。

要想成就大事业,要在青春的时候着手。

厚积薄发,成一番事业。

Page 131: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

131

兰州石化职业技术学院—国家重点建设示范性高职高专

理想是美好的,但没有意志,理想不过是瞬间的彩虹。

一粥一饭,当思来之不易。半丝半缕,恒念物力维艰。

养成健康人格,发挥个性特长培养实践能力,适应社会需求

Page 132: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

132

兰州石化职业技术学院—国家重点建设示范性高职高专

真正的快乐,是对生活的乐观,对工作的愉快,对事业的兴奋。

----(美)爱因斯坦

一个人只有以他全部的力量和精力致力于某一事业时,才能成为真正的大师。因此,只有全力以赴,才能精通。

----(美)爱因斯坦

参观游历皆学习。

Page 133: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

133

SCR

Q

Q

D Q

CLK Q

Master/Slave S-R Flip-Flop(主从 S-R 触发器)

S QCR Q

C

S

R

Q

QL

S QCR Q

Postponed-Output

( 延迟输出C 无效时输出变化 )

Dynamic-Input Indicator

( 动态输入指示边沿触发 )D Q

C QD Q

C Q

Q

QN

D

CLK Master/Slave D Flip-Flop(主从 D 触发器)

Review of Last Class (内容回顾 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 134: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

134

同样是主从结构,由D锁存器构成的可以称为边沿D触发器由 S-R锁存器构成的不能称为边沿 S-R触发器主从结构的 J-K触发器也不是边沿触发!! ( 1 箝位 和 0箝位)

D 触发器的输出: Q* = D

S-R 触发器的输出: Q* = S + R’·Q

J-K 触发器的输出: Q* = J·Q’ + K’·Q

Review of Last Class (内容回顾 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 135: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

135

锁存器与触发器小结锁存器和触发器

—— 电平有效和边沿有效的区别按照逻辑功能的不同特点,通常可分为

S-R触发器(锁存器)

D触发器(锁存器)

J-K触发器

T触发器

每种触发器的功能表特征方程状态图

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 136: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

136

S-R Flip-Flops (Latches)

SCR

Q

Q

时钟 S-R 锁存器

0 00 11 01 1

S R

维持清 0置 1

0*

Q

功 能 表

0 00 11 01 1

S R

维持清 0置 1

1*

Q

功 能 表

主从 S-R 触发器

SCR

Q

Q

1 11 00 10 0

SL RL

维持清 0置 1

1*

Q 0 1*0

基本 S-R 锁存器

S Q

R Q

(或非门)

S Q

R Q

(与非门)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 137: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

137

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

S_L R_L

1*1*110001

Qn Qn+1

低电平有效 S-R 锁存器状态转移真值表

1

1 0

0

0

1

0

1

00 01 11 10Qn

S_LR_LQn+1

Q* = S_L’ + R_L·Q

= S+ R’·Q

约束条件: S_L + R_L = 1

S’+R’=1 S·R=0

特征方程

Q* = S+ R’·QS·R=0 (约束条件)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 138: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

138

0 00 11 01 1

S R

维持01

1*

Q

功能表

状态图

0 1

S=1,R=0

S=0,R=1

S=XR=0

S=0R=X

特征方程

Q* = S+ R’·Q

S·R=0 (约束条件)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

S-R Flip-Flops (Latches)

Page 139: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

139

J-K Flip-Flop

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

J K

01001110

Qn Qn+1

状态转移真值表

维持

清 0

置 1

翻转

0

0

0 1

1 1

1

0

0

1

00 01 11 10Qn

JKQn+1

特征方程

Q* = J·Q’ + K’·Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 140: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

140

0 00 11 01 1

J K

维持清 0置 1翻转

Q*

功能表

特征方程

Q* = J·Q’ + K’·Q

状态图

0 1

J=1,K=X

J=X,K=1

J=XK=0

J=0K=X

Digital Logic Design and Application ( 数字逻辑设计及应用 )

J-K Flip-Flop

Page 141: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

141

状态图

D Flip-Flops (Latches)

特征方程: Q* = D

0 1

D=1

D=0

D=1D=0

有使能端得 D 触发器: Q* = EN·D + EN’·Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 142: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

142

T Flip-Flop

特征方程: Q* = Q’

Q

QT

有使能端的 T触发器: Q* = EN·Q’ + EN’·Q

EN Q

T Q

说明: 传统中文教材中认为 T 触发器的特征方程为: Q* = T·Q’ + T’·Q

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 143: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

143

不同类型触发器间的相互转换

利用D触发器实现

S-R触发器

J-K触发器

T触发器

利用 J-K触发器实现

S-R触发器

D触发器

T触发器

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 144: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

144

关于电路结构和逻辑功能

同一逻辑功能的触发器可用不同电路结构实现 主从结构的 D触发器、维持阻塞结构的 D 触发器

用同一电路结构可做成不同逻辑功能的触发器 维持阻塞结构的: D触发器、 J-K触发器

电路构成的不同形式 下一状态 Q* 与现态 Q 及输入之间在稳态下的逻辑关系

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 145: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

145

动态参数—— 保证触发器在工作时能可靠翻转

锁存器的动态参数输入信号宽度: tW ≥ 2tpd

传输延迟时间: tPLH / tPHL

从输入信号到达,到触发器输出新态稳定建立

与非: tPLH = tpd 、 tPHL = 2tpd

或非: tPLH = 2tpd 、 tPHL = tpd

说明: tpd表示一个门的延迟时间

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 146: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

146

触发器的动态参数 建立时间 tset

输入信号应先于时钟信号到达的时间

保持时间 thold

时钟信号到达后,输入信号需要保持的时间

最高时钟频率 fmax

为保证触发器可靠翻转,时钟脉冲必须满足的参数

传输延迟时间 tpHL/tpLH

从时钟脉冲触发边沿算起,到触发器建立起新状态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 147: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

147

Sequential Logic Circuit Analysis and Design

(时序逻辑电路的分析和设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 148: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

148

Sequential Logic Circuit (时序逻辑电路 )

Feedback Sequential Circuit(反馈时序电路) “采用 门电路+反馈回路”实现记忆功能

State Machine(状态机)用触发器构造电路,用时钟控制状态转换

CLKtper

tH tL

周期: tper 频率: 1/tper

占空比: tH/tper 、 tL/tper

—— Finite-State Machine( FSM, 有限状态机)

概念:时钟周期、时钟频率、占空比、时钟触发沿

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 149: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

149

Sequential Logic CircuitStructure (时序逻辑电路结构 )

下一 状态 逻辑

F

状态 存储器

时钟

OutputLogic ( 输出

逻辑 ) G

Inputs( 输入 ) Outputs

输出

Clock Signal( 时钟信号 )

Exci-tation(激励 )

Current State( 当前状态 )

下一状态: F (当前状态,输入)输出: G (当前状态,输入)

组合电路

状态存储器:由激励信号得到下一状态

激励方程驱动方程

输出方程

转移方程

—— 状态机结构

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 150: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

150

同步时序电路

异步时序电路

—— 时钟同步状态机存储元件状态的变化是在同一时钟信号操作下同时发生的

存储元件状态的变化不是同时发生的

Mealy型

Moore型输出信号取决于存储电路状态和输入信号

输出信号仅取决于存储电路状态

Sequential Logic Circuit (时序逻辑电路 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 151: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

151

下一 状态 逻辑

F

状态 存储器

时钟

输出 逻辑

G

输入输出

时钟信号

激励 当前状态

下一 状态 逻辑

F

状态 存储器 时钟

输出 逻辑

G

输入 输出

时钟信号

激励 当前状态 输出流水线 存储器

时钟

Moore 机:输出只与状态有关

Mealy 机:输出取决于状态和输入

输出

Page 152: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

152

7.3 Clocked Synchronous State Machine Analysis (时钟同步状态机分

析 )

基本步骤:确定下一状态函数 F 和输出函数 G

将 F代入触发器的特征方程得到下一状态 Q*

利用 Q*、 G构造状态 /输出表画出状态图、波形图(可选)检查电路是否可以自启动描述电路功能

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 153: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

153

EN

EN’

Q0

Q0’

Q1

Q1’

EN

MAX

Q0

Q1

CLK

D0

D1

当前状态

激励

输出输入

时钟信号

下一状态逻辑 产生激励信号 状态存储器 输出逻辑

Example: Clocked Synchronous State Machine Analysis (D Flip-

Flop)

Page 154: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

154

EN

EN’

Q0

Q0’

Q1

Q1’

EN

MAX

Q0

Q1

CLK

D0

D1

1 、由电路得到激励方程 D0 = Q0·EN’ + Q0’·EN

D1 = Q1·EN’ + Q1’·Q0·EN + Q1·Q0’·EN

2 、由电路得到输出方程MAX = Q1·Q0·EN

3 、由激励方程和触发器特征方程 得到转移方程(状态方程) D 触发器特征方程: Q* = D

Q0* = Q0·EN’ + Q0’·EN

Q1* = Q1·EN’ + Q1’·Q0·EN

+ Q1·Q0’·EN

Page 155: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

155

4 、由转移方程和输出方程得到状态 /输出表

00110110

01011010

00000001

状态转换表EN Q1 Q0 Q1* Q0* MAX

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Q0* = Q0·EN’ + Q0’·EN

Q1* = Q1·EN’ + Q1’·Q0·EN + Q1·Q0’·EN

MAX = Q1·Q0·EN

S

0 00 11 01 1

EN0 1

00, 001, 010, 011, 0

01, 010, 011, 000, 1

Q1*Q0*, MAXQ1Q0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 156: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

156

5、 State Diagram (画状态图 )

00

EN=0MAX=0

01EN=1

MAX=0

EN=1MAX=1

EN=0MAX=0

EN=0MAX=0

EN=0MAX=0

11EN=1

MAX=010

EN=1MAX=0

逻辑功能描述:具有使能端 EN 的 2 位二进制加法计数器电路输出与输入有关 —— Mealy 机

S

0 00 11 01 1

EN0 1

00,001,010,011,0

01,010,011,000,1

Q1*Q0*, MAXQ1Q0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 157: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

157

6、 Timing Diagram (画时序图 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Q0* = Q0·EN’ + Q0’·EN

Q1* = Q1·EN’ + Q1’·Q0·EN + Q1·Q0’·EN

MAX = Q1·Q0·EN

Page 158: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

158

transitiontable

state table state/outputtable

Specification ( 说 明 )可以给每个状态命名

通常用 S表示当前状态, S*表示下一状态

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 159: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

159

EN

EN’

Q0

Q0’

Q1

Q1’

EN

MAX

Q0

Q1

CLK

D0

D1

Mealy 机 Moore 机MAXS

MAXS

=Q1·Q0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 160: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

160

对应的 Moore 机的状态表和状态图

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 161: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

161

Timing Diagram for a State Machine

( 状态机的定时图 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 162: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

162

具有使能端 EN 的 2 位二进制加法计数器

Moore 机 Mealy 机

S*/MAX 或 S*,MAX

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 163: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

163

Moore 机 Mealy 机

MAX

MAXS

Page 164: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

164

第 7章作业 7.4(7.2) 7.5(7.3) 7.7(7.5) 7.12(7.9) 7.13(7.10) 7.16(7.13) 7.17(7.14) 7.18(7.15) 7.19(7.16)

7.20(7.19) 7.21(7.20)(c)

7.41(7.27) 7.43(7.28) 7.46(7.34) 7.51(7.47) 7.52(7.49) 7.77(7.68)

Page 165: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

165

Draw the Output Waveform of the D Flip-Flop

Digital Logic Design and Application ( 数字逻辑设计及应用 )

A Class Problem ( 每课一题 )

Q

CLK

PR_L

CLR_L

Page 166: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

166

Chapter 7 Sequential Logic Design Principles( 时序逻辑设计原理 )

Latches and Flip-Flops

( 锁存器和触发器 ) Clocked Synchronous State-Machine Analysis

(同步时序分析 ) Clocked Synchronous State-Machine Design

(同步时序设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 167: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

167

同步时序电路

异步时序电路

—— 时钟同步状态机存储元件状态的变化是在同一时钟信号操作下同时发生的

存储元件状态的变化不是同时发生的

Mealy型

Moore型输出信号取决于存储电路状态和输入信号

输出信号仅取决于存储电路状态

Review of Last Class (内容回顾 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 168: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

168

Review of Last Class (内容回顾 )

时钟同步状态机分析的基本步骤:确定下一状态函数 F 和输出函数 G

将 F代入触发器的特征方程得到下一状态 Q*

利用 Q*、 G构造状态 /输出表画出状态图、波形图(可选)检查电路是否可以自启动描述电路功能

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 169: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

169 Y = X· Q2 · Q1

J1 = (X’· Q2’)’

K1 = (X· Q2’)’ J2 = X’· Q1

K2 = (X’· Q1’)’

1 、由电路得到激励方程

2 、由电路得到输出方程

CP

X YJ QCLK

K Q

&&

&&

J QCLK

K Q

&&

FF1FF2

= X+Q2

Example: Clocked Synchronous State Machine Analysis (J_K Flip-

Flop)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 170: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

170

3 、得到状态转换方程

J-K 触发器特征方程为: Q* = J·Q’ + K’·Q

Q1* = J1· Q1’ + K1’· Q1= (X+Q2)· Q1’ + X· Q2’· Q1

= Q2·Q1’ + X·Q1’ + X·Q2’·Q1

= X’· Q1· Q2’ + X’· Q1’· Q2 Q2* = J2· Q2’ + K2’· Q2

Y = X· Q2 · Q1

J1 = (X’· Q2’)’

K1 = (X· Q2’)’ J2 = X’· Q1

K2 = (X’· Q1’)’

1 、由电路得到激励方程

2 、由电路得到输出方程

= X+Q2

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 171: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

171

4 、由状态方程和输出方程列状态转换表

Q1* = Q2·Q1’ + X·Q1’ + X·Q2’·Q1

Q2* = X’· Q1· Q2’ + X’· Q1’· Q2

Y = X· Q2 · Q1

00101110

01100000

00000001

状态转换表 X Q2 Q1 Q2* Q1* Y

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

S

0 00 11 01 1

X0 1

00, 010, 011, 000, 0

01, 001, 001, 000, 1

Q2*Q1*, YQ2Q1

X’· Q2’· Q1 + X’· Q2· Q1’

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 172: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

172

00

1/00/0

5 、画状态图

S

0 00 11 01 1

X0 1

00, 010, 011, 000, 0

01, 001, 001, 000, 1

Q2*Q1*, YQ2Q1

01

1/0 1/0

10

0/0

11

0/0

0/0

1/1

X/Y

状态 00 :开始判断状态 01 :输入一个 1状态 10 :连续输入 10状态 11 :连续输入 100

逻辑功能: 1001 序列检测器输入端连续输入 1001 时,输出 1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

X: 0100100111001100100…Y: 0000100000001000100…

Page 173: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

173

练习:同步时钟状态机分析

1

1 、

2 、

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 174: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

174

1

Y = Q2 · Q3

练习 1

J1 = (Q2· Q3)’

K1 = 1 J2 = Q1

K2 = (Q1’· Q3’)’ J3 = Q1· Q2

K3 = Q2

1 、由电路得到激励方程

2 、由电路得到输出方程

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 175: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

175

Y = Q2 · Q3

J1 = (Q2· Q3)’

K1 = 1 J2 = Q1

K2 = (Q1’· Q3’)’ J3 = Q1· Q2

K3 = Q2

1 、由电路得到激励方程

2 、由电路得到输出方程

3 、得到状态转换方程

J-K 触发器特征方程为: Q* = J·Q’ + K’·Q

Q1* = J1· Q1’ + K1’· Q1

Q2* = J2· Q2’ + K2’· Q2

Q3* = J3· Q3’ + K3’· Q3

= (Q2· Q3)’· Q1’

= Q1· Q2’ + Q1’· Q3’· Q2

= Q1· Q2· Q3’ + Q2’· Q3

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 176: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

176

00011100

00000011

4 、列状态转换表Q1* = (Q2· Q3)’· Q1’

Q2* = Q1· Q2’ + Q1’· Q3’· Q2

Q3* = Q1· Q2· Q3’ + Q2’· Q3

Y = Q2 · Q3

Q1* = Q3’· Q1’ + Q2’· Q1’

Q2* = Q2’· Q1 + Q3’· Q2 · Q1’

Q3* = Q3’ · Q2· Q1 + Q3· Q2’

Y = Q3 · Q2

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Y*1

*2

*3 QQQ123 QQQ

01100100

10101000

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 177: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

177

00011100

00000011

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Y*1

*2

*3 QQQ123 QQQ

01101000

10101000

4 、列状态转换表5 、画状态转换图

000/0

Q3Q2Q1/Y010/0

011/0100/0

101/0

110/1 001/0

111/1

逻辑功能描述:能自启动的模 7 加法计数器,对时钟信号计数,输出为进位脉冲

自启动的

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 178: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

178

6 、画时序图(可选) 注意是主从 J-K 触发器

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 179: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

179

练习2

1 、列驱动方程、状态方程、输出方程

D1 = Q1’

D2 = AQ1Q2

Q1* = D1 = Q1’

Q2* = D2 = AQ1Q2

Y = A’·Q2·Q1 + A·Q2’·Q1’

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 180: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

180

2 、列状态转换表

A Q2 Q1

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Q2* Q1* Y

0 1 01 0 01 1 00 0 11 1 10 0 00 1 01 0 0

Q1* = Q1’

Q2* = AQ1Q2

Y = A’·Q2·Q1 + A·Q2’·Q1’

S

0 00 11 01 1

A0 1

01, 010, 011, 000, 1

11, 100, 001, 010, 0

Q2*Q1*, YQ2Q1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 181: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

181

3 、画状态转换图

S

0 00 11 01 1

A0 1

01, 010, 011, 000, 1

11, 100, 001, 010, 0

Q2*Q1*, YQ2Q1

功能描述:可逆计数器A=0 加法, A=1减法

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 182: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

182

2 、列状态转换表

A Q2 Q1

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Q2* Q1* Y

0 1 01 0 01 1 00 0 11 1 10 0 00 1 01 0 0

0 01/0 10/0 00/1 11/01 11/1 00/0 10/0 01/0

A

Q2Q1

00 01 11 10

Q2*Q1* / Y

Q1* = Q1’

Q2* = AQ1Q2

Y = A’·Q2·Q1 + A·Q2’·Q1’

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 183: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

183

3 、画状态转换图

功能描述:可逆计数器,A=0 加法, A=1减法

0 01/0 10/0 00/1 11/01 11/1 00/0 10/0 01/0

A

Q2nQ1

n

00 01 11 10

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 184: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

184

Clocked Synchronous State-Machine Design

(时钟同步状态机设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 185: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

185

7.4 Clocked Synchronous State-Machine Design (时钟同步状态机设计 )

State/output table (根据命题构造状态 /输出表 ) State minimization(状态化简(状态最小化) ) State assignment (状态编码(选择状态变量) ) Transition/output table

(建立转移 /输出表,得到状态和输出方程 ) Chose a flip-flop type (选择触发器作为状态存储器 ) Excitation equations (构造激励表,得到激励方程 ) Draw a Logic Diagram (画逻辑电路图 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 186: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

186

设计入门:两个简单的例子设计一个 3 位二进制模 8 计数器 设计一个 110 序列检测器

状态表设计举例例一( 7.4.1);例二( 7.4.6);例三( 7.4.6)

状态图设计(雷鸟车尾灯 )

猜谜游戏

7.4 Clocked Synchronous State-Machine Design Example(时钟同步状态

机设计举例 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 187: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

187

1 、 State/Output Table ( 逻辑抽象 , 得到状态图(表) )

2、 State Assignment( 状态编码 )

取自然二进制数 000~111作为 S0 ~ S7 的编码

对时钟信号计数,可不用输入 —— Moore 机取进位信号为输出变量需要 8 个有效状态

Design a Modulo-8 3-bit Binary Counter

( 设计一个模 8 的 3 位二进制计数器 )

S0/0 S1/0

S3/0

S4/0

S2/0

S5/0

S7/1

S6/0

000

111

110

101

001

010

011

100

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 188: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

188

3、 Create a Transition/Output table to obtain the State transition and output equations ( 构造转移 /输出表,求取 状态转移方程和 输出方程 )

S0/0 S1/0

S3/0

S4/0

S2/0

S5/0

S7/1

S6/0

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Q2 Q1 Q0 Q2*Q1*Q0* C

S0

S1

S2

S3

S4

S5

S6

S7

0 0 10 1 00 1 11 0 01 0 11 1 01 1 10 0 0

00000001

000

111

110

101

001

010

011

100

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 189: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

189

0

1

Q1Q0

Q2

Q0*

00 01 11 10

1 0 0 1

1 0 0 1

Q0* = Q0’0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Q2 Q1 Q0 Q2*Q1*Q0* C

0 0 10 1 00 1 11 0 01 0 11 1 01 1 10 0 0

00000001

3、 Create a Transition/Output table to obtain the State transition and output equations ( 构造转移 /输出表,求取 状态转移方程和 输出方程 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 190: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

190

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

0 0 10 1 00 1 11 0 01 0 11 1 01 1 10 0 0

00000001

Q2 Q1 Q0 Q2*Q1*Q0* C

0

1

Q1Q0

Q2

Q1*

00 01 11 10

0 1 0 1

0 1 0 1

Q0* = Q0’

Q1* = Q1’·Q0 + Q1·Q0’

3、 Create a Transition/Output table to obtain the State transition and output equations ( 构造转移 /输出表,求取 状态转移方程和 输出方程 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 191: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

191

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

0 0 10 1 00 1 11 0 01 0 11 1 01 1 10 0 0

00000001

Q2 Q1 Q0 Q2*Q1*Q0* C Q0* = Q0’

输出方程: C = Q2· Q1· Q0

Q1* = Q1’·Q0 + Q1·Q0’

0

1

Q1Q0

Q2

Q2*

00 01 11 10

0 0 1 0

1 1 0 1

Q2* = Q2’·Q1·Q0 +

Q2·Q1’ + Q2·Q0’

3、 Create a Transition/Output table to obtain the State transition and output equations ( 构造转移 /输出表,求取 状态转移方程和 输出方程 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 192: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

192

Q0* = Q0’

Q1* = Q1’·Q0 + Q1·Q0’

Q2* = Q2’·Q1·Q0 + Q2·Q1’ + Q2·Q0’

4、 Choose a Flip-Flop Type, Obtain the Excitation Equations( 触发器选型,得到激励方程 )翻转 Q* = Q’( T触发器)

Q* = EN·Q’ + EN’·Q

Q1* = Q1’·Q0 + Q1·Q0’

= Q2’·Q1·Q0 + Q2· (Q1’+Q0’)

= Q2’·Q1·Q0 + Q2· (Q1·Q0)’

EN1 = Q0

EN2 = Q1·Q0

EN0 = 1选择有使能端的 T触发器

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 193: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

193

5、Draw a Logic Diagram (画逻辑电路图 )

EN0 = 1

EN1 = Q0

EN2 = Q1·Q0

C = Q2· Q1· Q0

1CLK

Q0

Q1

Q2

C

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 194: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

194

1、 State/Output table ( 得到状态转换表 )

用 A 表示输入数据;用 Z 表示检测结果。

开始,等待第一个 1 STA STA/0 A1/0

A 上捕获一个 1 A1 STA/0 A11/0

A 上连续捕获 11 A11 OK/1 A11/0

A 上连续捕获 110 OK STA/0 A1/0

Design a Serial Data Detector of 110 (设计一个 110串行数据检测器 )

状态 SA

0 1

S*/Z

电路检测到输入连续出现 110 时,输出为 1

Mealy机

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 195: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

195

1 、得到状态转换表

STA STA/0 A1/0

A1 STA/0 A11/0

A11 OK/1 A11/0

OK STA/0 A1/0

状态 SA

0 1

S*/Z

2、 State Minimization( 状态化简(状态最小化) )

识别等效状态 ,如果两个状态 对于所有输入组合产生相同的输出 对于每种输入组合具有相同或等效的下一状态

S*/Z

STA/0STA A1/0

3、 State Assignment( 状态编码 )

000110

000111

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 196: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

196

000110

0

Q1Q000 01 11 10

0

1

A0 1

0 0 0

d

d

Z

00/0

Q1Q000 01 11 10

0

1

A00/0 00/1

01/0 10/0 10/0

dd/d

dd/d

4、 State Equations and Output Equations ( 得到状态方程和输出方程 )

STA STA/0 A1/0

A1 STA/0 A11/0

A11 STA/1 A11/0

状态 SA

0 1

S*/Z

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 197: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

197

00/0

Q1Q000 01 11 10

0

1

A00/0 00/1

01/0 10/0 10/0

dd/d

dd/d

0

Q1Q000 01 11 10

0

1

A0 1

0 0 0

d

d

Z

Z = A’·Q1

0

Q1Q000 01 11 10

0

1

A0 0

0 1 1

d

d

Q1*

Q1* = A·Q1 + A·Q0

0

Q1Q000 01 11 10

0

1

A0 0

1 0 0

d

d

Q0*

Q0* = A·Q1’·Q0’

4、 State Equations and Output Equations ( 得到状态方程和输出方程 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 198: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

198

选择 D 触发器

5、 Excitation Equations (得到激励方程 )

Q1* = A·Q1 + A·Q0

Q0* = A·Q1’·Q0’

D1 = A·Q1 + A·Q0

D0 = A·Q1’·Q0’

选择 J-K 触发器Q* = J·Q’ + K’·Q

= (A·Q1’)·Q0’ + 1’·Q0

= A·Q1 + A·Q0 ·(Q1+Q1’)

= A·Q1 + A·Q0 ·Q1 + A·Q0·Q1’

= A·Q1 + A·Q0·Q1’

J1 = A·Q0

K1 = A’

J0 = A·Q1’

K0 = 1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 199: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

199

6、 Check the Circuit Self-Startup( 检查电路的自启动性 )

当电路进入无效状态 11 后,

A=0 时,

该电路是自启动的

Z = A’·Q1

Q1* = A·Q1 + A·Q0

Q0* = A·Q1’·Q0’ 7、 Draw a Logic Diagram (画逻辑电路图 ) (略)

下一状态为 00A=1 时,下一状态为 10

1/011

0/1

000/0

01

1/0

0/0

10

1/0

1/0

0/1

全状态图

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 200: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

200

7.4.1 State Table Design Example 1

(状态表设计(例一) )

Design a clocked synchronous state machine

with two inputs, A and B, and a single output

Z that is 1 if:

(设计一个具有 2个输入( A、 B), 1个输出

( Z)的时钟同步状态机, Z为 1的条件是 :)

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 201: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

201

7.4.1 State Table Design Example 1

(状态表设计(例一) )

A had the same value at each of the two

previous clock ticks

( 在前 2个脉冲触发沿上, A 的值相同 )

B has been 1 since the last time that the first

condition was true.

( 从上一次第 1个条件为真起, B的值一直为 1 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 202: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

202

SAB

00 01 11 10

S*

Z

状态含义

初始状态 INIT 0A0 A0 A1 A1

A0A 上捕获一个 0 A 上捕获一个 1 A1

0OK0 OK0

A 上连续两个 0 OK0

A1 A1

0A0 A0 OK1

A 上连续两个 1 OK1

OK1

1OK0 OK0 OK1B A1

因 B 而OK, A 为 1 OK1B

1A0 OK0B OK1 OK1

因 B 而OK, A 为 0 OK0B

1A0 OK0B OK1 OK1

1OK0 OK0 OK1B A1

1、 State/outputTable( 构造状态转换表 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 203: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

203

SAB

00 01 11 10

S*

Z

状态含义

1 、构造状态转换表

初始状态 INIT 0A0 A0 A1 A1

A0A 上捕获一个 0 A 上捕获一个 1 A1

0OK0 OK0

A 上连续两个 0 OK0

A1 A1

0A0 A0 OK1

A 上连续两个 1 OK1

OK1

1OK0 OK0 OK1B A1

因 B 而OK, A 为 1 OK1B

1A0 OK0B OK1 OK1

因 B 而OK, A 为 0 OK0B

1A0 OK0B OK1 OK1

1OK0 OK0 OK1B A1

2 、状态最小化

OK1

OK1

OK0

OK0

OK, A 值为 0

OK, A 值为 0

OK, A 值为 1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 204: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

204

初始状态 INIT

A0A 上捕获一个 0 A 上捕获一个 1 A1

OK, A 值为 0 OK0

OK, A 值为 1 OK1

SAB

00 01 11 10

S*

Z

0A0 A0 A1 A1

0OK0 OK0 A1 A1

0A0 A0 OK1 OK1

1OK0 OK0 A1

1A0 OK1 OK1OK0

OK1

1 、构造状态转换表2 、状态最小化

真的需要一一尝试吗?合理的状态赋值( 7.4.3)

3 、状态编码

最简单的 分解的 单热点的 准单热点的

从 23中选 5种一共有 种8!5!×3!

5种编码 5 个状态,又有 5! 种

000100101110111

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 205: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

205

7.4.3 合理的状态赋值选择复位时容易进入的状态作为初始状态 使每次转移时要发生改变的状态变量数最小化 使一组相关状态中不变化的状态变量数最大化 发现和利用问题描述中的对称性

将状态变量组分解为有明确含义的位或字段,相对于状态机的输入效果或者输出特性

可以使用多余最小值的状态变量数(便于分解)未用状态的考虑

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 206: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

206

4 、根据状态表和状态编码构造转移 /输出表

INIT

A0

A1

OK0

OK1

SAB

00 01 11 10

S*

Z

0A0 A0 A1 A1

0OK0 OK0 A1 A1

0A0 A0 OK1 OK1

1OK0 OK0 A1

1A0 OK1 OK1OK0

OK1

000100

100 100

100 100

100

101110

101 101101 101

101

110 110

110 110110111

111 111

111 111111

Q1Q2Q3

Q1*Q2*Q3*

5 个输入变量:

A,B,Q1,Q2,Q3

4 个输出变量:

Z,D1,D2,D3

D1 D2 D3

转移 / 激励表5 、触发器选型,得到激励方程和输出方程

使用 D 触发器

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 207: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

207

AB

00 01 11 10Z

0

0

0

1

1

000

100

101

110

111

Q1Q2Q3

100 100

100 100

100

101 101

101 101110 110

110 110 101

110

111 111

111 111

111

Q1*Q2*Q3*D1 D2 D3

Q2Q3AB

00 01 11 10

00

01

11

10Q1=0

D2

Q2Q3AB

00 01 11 10

00

01

11

10Q1=1

0 0 0 0

1 1 0 0

0 0 1 1

0 1 1 1

1 1 1 0

0 0 0 0

0 0 0 0

0 0 0 0

最小冒险,未用状态初始状态

输出方程: Z = Q1·Q2

Page 208: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

208

Q2Q3AB

00 01 11 10

00

01

11

10Q1=0

D2

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

最小冒险,未用状态初始状态

Q2Q3AB

00 01 11 10

00

01

11

10Q1=1

1 1 0 0

0 0 1 1

0 1 1 1

1 1 1 0

D2 = Q1·Q3’·A’ + Q1·Q3·A

+ Q1·Q2·B

Q2Q3AB

00 01 11 10

00

01

11

10Q1=0

D2

0 0 0 0

d d d d

d d d d

d d d d

最小成本,未用状态作为无关项

D2 = Q1·Q3’·A’ + Q3·A+ Q2·B

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 209: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

209

D1

D2 = Q1·Q3’·A’ + Q1·Q3·A + Q1·Q2·B

D1 = Q2’·Q3’ + Q1

思考:最小成本法 D1=?

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 210: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

210

D3

D3 = Q2’·Q3’·A + Q1·A

D2 = Q1·Q3’·A’ + Q1·Q3·A + Q1·Q2·B

D1 = Q2’·Q3’ + Q1

激励方程D3 = Q2’·Q3’·A + Q1·A

思考:最小成本法 D3=?

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 211: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

211

6 、画逻辑电路图(略)

D3 = Q2’·Q3’·A + Q1·A

D2 = Q1·Q3’·A’ + Q1·Q3·A + Q1·Q2·B

D1 = Q2’·Q3’ + Q1

激励方程D3 = Q2’·Q3’·A + Q1·A

输出方程: Z = Q1·Q2

说明: 最小冒险法 所有未用状态 “安全”状态(图 7-50 ) 最小成本法 所有未用状态的下一状态作为无关项 电路的激励方程简单,不够安全

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 212: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

212

7.4.5 Design with J-K Flip-Flops(用 J-K触发器设计 )

方法一利用状态方程和触发器特征方程得到激励方程

方法二利用状态转移表和激励表得到激励方程

激励表

Q Q*

0 00 11 01 1

J K

0 d1 dd 1d 0

J K Q

0 0 0 11 01 1

保持清 0置 1翻转

功能表

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 213: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

213

J-K 触发器特征方程: Q* = J·Q’ + K’·Q

Design with State Equations and Characteristic Equations(利用状态方程和特征方程设计 )

Q1* = Q2’·Q3’ + Q1

= Q2’·Q3’·(Q1’+Q1) + Q1

= Q2’·Q3’·Q1’+ Q2’·Q3’·Q1 + Q1

= Q2’·Q3’·Q1’ + Q1

Q3* = Q2’·Q3’·A + Q1·A

Q2* = Q1·Q3’·A’ + Q1·Q3·A + Q1·Q2·B

Q1* = Q2’·Q3’ + Q1

状态方程

J1 = Q2’·Q3’

K1 = 0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 214: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

214

J-K 触发器特征方程: Q* = J·Q’ + K’·Q

Q3* = Q2’·Q3’·A + Q1·A

Q2* = Q1·Q3’·A’ + Q1·Q3·A + Q1·Q2·B

Q1* = Q2’·Q3’ + Q1

状态方程

Q3* = Q2’·Q3’·A + Q1·A

= Q2’·Q3’·A + Q1·A·(Q3’+Q3)

= (Q2’·A + Q1·A)·Q3’+ Q1·A·Q3J3 = Q2’·A + Q1·A

K3 = Q1’ + A’

J1 = Q2’·Q3’

K1 = 0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Design with State Equations and Characteristic Equations(利用状态方程和特征方程设计 )

Page 215: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

215

Q2* = Q1·Q3’·A’ + Q1·Q3·A + Q1·Q2·B

= (Q1·Q3’·A’ + Q1·Q3·A)·(Q2’+Q2) + Q1·Q2·B

= (Q1·Q3’·A’ + Q1·Q3·A)·Q2’

+ (Q1·Q3’·A’ + Q1·Q3·A + Q1·B)·Q2

K2 = (Q1·Q3’·A’ + Q1·Q3·A + Q1·B)’

= (Q1’+Q3+A)·(Q1’+Q3’+A’)·(Q1’+B’)

= Q1’ + Q3’·A·B’ + Q3·A’·B’

J2 = Q1·Q3’·A’ + Q1·Q3·A

K2 = Q1’ + Q3’·A·B’ + Q3·A’·B’

J1 = Q2’·Q3’

K1 = 0

J3 = Q2’·A + Q1·A

K3 = Q1·A

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 216: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

216

AB 00 01 11 10

Z

0

0

0

1

1

000

100

100 100

100 100

100

101

110

101 101

101 101

101

110 110

110 110

110111

111 111

111 111

111

Q1Q2Q3

Q1*Q2*Q3*J1K1 , J2K2 , J3K3

1d,0d,0d 1d,0d,0d 1d,0d,1d 1d,0d,1d

d0,1d,0d d0,1d,0d d0,0d,1d d0,0d,1d

d0,0d,d1 d0,0d,d1 d0,1d,d0 d0,1d,d0

d0,d0,0d d0,d0,0d d0,d0,1d d0,d1,1d

d0,d1,d1 d0,d0,d1 d0,d0,d0 d0,d0,d0

Design with the Excitation table ( 利用激励表进行 J-K触发器设计 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 217: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

217

AB 00 01 11 10

Z

0

0

0

1

1

000

100

100 100

100 100

100

101

110

101 101

101 101

101

110 110

110 110

110111

111 111

111 111

111

Q1Q2Q3

Q1*Q2*Q3*J1K1 , J2K2 , J3K3

1d,0d,0d 1d,0d,0d 1d,0d,1d 1d,0d,1d

d0,1d,0d d0,1d,0d d0,0d,1d d0,0d,1d

d0,0d,d1 d0,0d,d1 d0,1d,d0 d0,1d,d0

d0,d0,0d d0,d0,0d d0,d0,1d d0,d1,1d

d0,d1,d1 d0,d0,d1 d0,d0,d0 d0,d0,d0

利用卡诺图化简

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 218: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

218

7.4.6 Example 2: 1s-Counting Machine

( “例二: 1”计数器 )对两个输入 X 和 Y 同时计数,当 X 和 Y 输入 1 的个数和为 4 的整数倍时输出为 1

1起始状态 S0 S0

XY 00 01 11 10

Z含义 S

S*

S1

收到一个 1 S1

S2

收到两个 1 S2

S1

0S1 S2 S3

收到三个 1 S3

S2

0S2 S3 S0 S3

S3 S0 S1 S0 0

00011110

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 219: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

219

7.4.6 Example 3: Combination Lock

(例三:组合锁 )

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 220: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

220

7.5 Control the Tail Lights of Ford Thunderbird

(福特雷鸟车尾灯控制 )

LALBLC RA RB RC

输入:左转 L 、右转 R 、应急闪烁H( hazard)、时钟输出:控制 6 个灯亮或灭 —— 可以完全由状态控制

Page 221: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

221

IDLE :全灭L1 :左边 1 个灯亮L2 :左边 2 个灯亮L3 :左边 3 个灯亮R1 :右边 1 个灯亮R2 :右边 2 个灯亮R3 :右边 3 个灯亮LR3 :全亮

状态

输 出直接利用状态控制输出

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 222: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

222

1 、构造状态图

IDLE :全灭L1 :左边 1 个灯亮L2 :左边 2 个灯亮L3 :左边 3 个灯亮R1 :右边 1 个灯亮R2 :右边 2 个灯亮R3 :右边 3 个灯亮LR3 :全亮

IDLE

L1

L

L2

1

L3

1

1

R1

R

R2

1

R3

1

1

LR3H

1

H’·L’·R’H+L·R

L·H’·R’

R·H’·L’

无二义性的

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 223: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

223

IDLE

L1

L

L2

1

L3

1

1

R1

R

R2

1

R3

1

1

LR3H

1

H’·L’·R’H+L·R

L·H’·R’

R·H’·L’

1 、构造状态图

All Inclusion( 完备性 ) 离开某一状态的弧线上的所有转移表达式的逻辑和为 1 。

无二义性的 H’·R’

H+R

H+RH’·R’

H’·L’ H’·L’

H+L

H+L

改进

Mutual Exclusion( 互斥性 ) 离开某一状态的弧线上的任意一对转移表达式的逻辑积为 0

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 224: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

224

2 、状态编码Q2Q1Q0

0 0 00 0 10 1 10 1 01 0 11 1 11 1 01 0 0

1 、构造状态图

IDLEL1L2L3R1R2R3

LR3

合理的状态赋值

3 、得到转移列表 7-14

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 225: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

225

2 、状态编码1 、构造状态图

3 、得到转移列表 7-14

H’·L’·R’

L·H’·R’

R·H’·L’

0 0 00 0 00 0 00 0 0 H+L·R

0 0 00 0 11 0 11 0 0

IDLE

Q2Q1Q0 S 转移表达式 S* Q2*Q1*Q0*

IDLE

L1

R1

LR3

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 226: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

226

Q2Q1Q0 S 转移表达式 S* Q2*Q1*Q0*

H’·L’·R’L·H’·R’R·H’·L’H+L·R

0 0 00 0 00 0 00 0 0

0 0 00 0 11 0 11 0 0

IDLE

IDLEL1R1LR3

L10 0 10 0 1

L2LR3

0 1 11 0 0

H’·R’H+R

L20 1 10 1 1

L3LR3

0 1 01 0 0

H’·R’H+R

L30 1 0 IDLE 0 0 01

R11 0 11 0 1

R2LR3

1 1 11 0 0

H’·L’H+L

R21 1 11 1 1

R3LR3

1 1 01 0 0

H’·L’H+L

R31 1 0 IDLE 0 0 01

LR31 0 0 IDLE 0 0 01

11

1

1

Q0* =

Q2’·Q1’·Q0’·(L·H’·R’)

+ Q2’·Q1’·Q0’·(R·H’·L’)

+ Q2’·Q1’·Q0·(H’·R’)

+ Q2·Q1’·Q0·(H’·L’)

= Q2’·Q1’·Q0’· H’·(LR)

+ Q2’·Q1’·Q0·(H’·R’)

+ Q2·Q1’·Q0·(H’·L’)

用转移表综合状态机

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 227: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

227

7.7 Guessing Game Machine(猜谜游戏机 )

4个灯(G1~G4)由时钟控制轮流亮起

如果按下的按钮( L1~ L4)与亮的灯对应,则猜对

否则, ERR灯亮,表示猜错

输入:G1、G2、G3、G4( 4个按钮)

输出: L1、 L2、 L3、 L4、 ERR( 5个灯)

状态: 6个, S1~ S4对应 L1~ L4

Serr对应 ERR; SOK表示猜对

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 228: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

228

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

4 个灯( G1~G4)由时钟控制轮流亮起

(没有按钮按下)

S1L1=1

S4L4=1

S2L2=1

S3L3=1

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 229: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

229

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

S1L1=1

S4L4=1

S2L2=1

S3L3=1

如果按下的按钮与亮的灯对应,

则猜对( SOK)

SOK

G1·G2’·G3’·G4’

G1’·G2·G3’·G4’

G1’·G2’·G3·G4’

G1’·G2’·G3’·G4

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 230: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

230

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

S1L1=1

S4L4=1

S2L2=1

S3L3=1

SOK

G1·G2’·G3’·G4’

G1’·G2·G3’·G4’

G1’·G2’·G3·G4’

G1’·G2’·G3’·G4

否则猜错( Serr)

SerrERR=1

G2+G3+G4

G1+G3+G4

G1+G2+G4

G1+G2+G3

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 231: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

231

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

G1’·G2’·G3’·G4’

S1L1=1

S4L4=1

S2L2=1

S3L3=1

SOK

G1·G2’·G3’·G4’

G1’·G2·G3’·G4’

G1’·G2’·G3·G4’

G1’·G2’·G3’·G4

SerrERR=1

G2+G3+G4

G1+G3+G4

G1+G2+G4

G1+G2+G3

G1+G2+G3+G4

G1’·G2’·G3’·G4’G1’·G2’·G3’·G4’

G1+G2+G3+G4

状态转换图

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 232: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

232

1 、状态转换图2 、状态编码

3 、转移列表

状态S

编码Q2Q1Q0

S1S2S3S4

SOKSERR

0 0 00 0 10 1 10 1 01 0 01 0 1

1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1

1 X X X X 0 1 X X X 0 0 1 X X 0 0 0 1 X 0 0 0 0 0 0 0 0 0 1

用输出作为状态编码L1 L2 L3 L4 ERR

无关项的使用L1 L2 L3 L4 ERR

表 7-15 表 7-16 表 7-18

Digital Logic Design and Application ( 数字逻辑设计及应用 )

Page 233: Chapter 7 Sequential Logic Design Principles (  时序逻辑设计原理  )

233

第 7章作业 7.4(7.2) 7.5(7.3) 7.7(7.5) 7.12(7.9) 7.13(7.10) 7.16(7.13) 7.17(7.14) 7.18(7.15) 7.19(7.16)

7.20(7.19) 7.21(7.20)(c)

7.41(7.27) 7.43(7.28) 7.46(7.34) 7.51(7.47) 7.52(7.49) 7.77(7.68)