数字设计课件 第七章 时序逻辑设计原理.ppt

上传人:rrsccc 文档编号:10940454 上传时间:2021-06-13 格式:PPT 页数:103 大小:3.63MB
返回 下载 相关 举报
数字设计课件 第七章 时序逻辑设计原理.ppt_第1页
第1页 / 共103页
数字设计课件 第七章 时序逻辑设计原理.ppt_第2页
第2页 / 共103页
数字设计课件 第七章 时序逻辑设计原理.ppt_第3页
第3页 / 共103页
数字设计课件 第七章 时序逻辑设计原理.ppt_第4页
第4页 / 共103页
数字设计课件 第七章 时序逻辑设计原理.ppt_第5页
第5页 / 共103页
点击查看更多>>
资源描述

《数字设计课件 第七章 时序逻辑设计原理.ppt》由会员分享,可在线阅读,更多相关《数字设计课件 第七章 时序逻辑设计原理.ppt(103页珍藏版)》请在三一文库上搜索。

1、Chapter 7sequential logic design principles,state, state variable latches, flip-flops analysis synthesis,sequential circuit,the outputs depend not only on its current inputs, but also on the past sequence of time, possibly arbitrarily far back in time.,Some important concepts,state and state variabl

2、e state : collection of state variable, contain all the information about the past necessary to account for the circuits future behavior. state variable: the symbol representation of state. finite-state machine the states of a sequential circuit is always finite.,n state variables,2n possible states

3、,Some important concepts,clock a clock signal is a signal used to coordinate the actions of two or more sequential units. clocked synchronous state machine all memory of the sequential circuit changes only on a clock edge or signal level.,H,L,7.1 Bistable Element,Output variable:Q,Q_L,且Q_L=Q Two sta

4、ble state: Q=0、Q_L=1 Q=1、Q_L=0,feedback,1,2,Q is the state variable,analysis with transfer characteristic,VOUT=T(VIN),VIN,VOUT,7.2 Latches and Flip_Flops,basic building block be classified as S-R、D、T、J-K types definition: latch:watches the circuits inputs continuously and can changes the outputs at

5、any time. flip-flops:samples the circuits inputs and changes the output only when a clocking signal is changing.,1、SR Latches,S-R latch built with NOR gates,Q=QN=Q_L,hold,reset,set,forbidden,1,2,the stored bit is present on the output Q.,S and R : active high signal,Function table,进入亚稳态,(2) symbol a

6、nd characteristic equation,S=R=1, restricted combination,characteristic equation for S-R latch: Q*=S+RQ (SR=0),current state,next state,(3) minimum pulse width,the time of active level of S or R must be keeping longer than minimum pulse width, or else the latch may be go into metastable.,propagation

7、 delay is exist when a transition on S or R input produce a transition on an output signal.,S,2、S-R latch,built with NAND gates,S_L 、R_L: active low signals,hold,reset,set,forbidden,3、S-R latch with enable,metastable still exist,forbidden,4、D latch,保持,R,S,characteristic equation Q*=D (C=1) transfer

8、data transparently,when C=0,the data is latched on Q .,timing diagram,data transfered,data latched,5、Edge-Triggered D Flip-Flops,Edge-Triggered :output of flip-flop changes on the clock signals rising edge or falling edge.,positive edge(rising edge),negative edge(falling edge),CLOCK,positive-edge-tr

9、iggered D flip-flop,master-slave structure CLK=0,QM=D,US hold last Q; At the clocks rising edge, US enable, UM hold last QM,Q=QM; CLK=1, UM hold last QM,so Q hold last Q。,UM,US,Only at the rising edge of clock signal, D input could be transferred to Q output.,Others,PR_L: preset CLR: clear,Negative-

10、edge-triggered D flip-flop,edge-triggered D flip-flop with asynchronous inputs,6、edge-triggered D flop-flop with enable,characteristic equation :Q*=END+ENQ,frequency divider with D f-fs,divide-by-2 divider,7、scan flip-flop,TE=1,test operation mode,f-fs take TI data. TE=0,normal D f-f-s,take D data.,

11、Normal input,Test enable,Test input,8、master/slave S-R触发器,Q*=S+RQ (SR=0) C=1, master latch follows the S-R input; C goes to 0, Q output the final latched value of master latch. It is not edge-triggered f-fs, but pulse-triggered.,C,S,R,QM,QM_L,Q,Q_L,Timing diagram of S-R f-fs,9. master/slave J-K flip

12、-flop,stucture,J,K,C,Q,Q_L,feedback,C=1,master latch follow the input; C goes to 0, Q output (slave latch) the final latch value.,Master,Slave,JK flip-flop timing diagram,J,K,C,Q,Q_L,features,reset,set,toggle,hold,Pulse-triggered f-f-s,Characteristic equations : Q*=JQ+KQ,Eliminate the possible metas

13、table which exist in the S-R f-fs (restricted input, S=R=1). But, 1s catching and 0s catching are exist.,hold,1s catching,C=1,当上次Q=0,当前JK=0时,若J有1的出现,触发器会捕捉到这一变化,置Q=1。以后,J有1到0的变化,电路不会响应。,0s catching,当上次Q=1,当前JK=0时,若K有1的出现,触发器会捕捉到这一变化,置Q=0。以后,K有1到0的变化,电路不会响应。,10、Edge-triggered J-K Flip-Flop,sample the

14、 inputs and change the output state at the edge of clock。 characteristic equations: Q*=JQ+KQ eliminate the “1s catching” and “0s catching”.,11、T Flip-Flop,T: toggle functional table,symbol,characteristic equation:Q*=TQ+TQ,Implementation,Contribute by D or J-K f-fs.,T Flip-Flop with enable,EN=1,norma

15、l T flip-flop; EN=0,hold the last value,summary : latches and flip-flops,label by structure: latches:S-R、D latches flip-flops:S-R、D、J-K、T flip-flops label by triggering form:pulse-triggered、edge-triggered one latch or flip-flop is a storage elements, which can store one bit (0 or 1). it also act as

16、a state variable, and more storage elements can be combined to store more bits which used to memory states in sequential circuit.,summary : characteristic equation,S-R latch D latch D flip-flop D flip-flop with enable M/S S-R flip-flop M/S J-K flip-flop edge-triggered J-K flip-flop T flip-flop,Q*=S+

17、RQ (SR=0) Q*=D Q*=D Q*=END+ENQ Q*=S+RQ (SR=0) Q*=JQ+KQ Q*=JQ+KQ Q*=TQ+TQ,7.3 clocked synchronous state-machine analysis,emphases: Basic structureMealy machine and Moore machine. understand action of each module and their equations, tables. analysis with D f-fs,1、stucture,(1)Mealy machine,Next-state

18、logicF,state memoryclock,Output logicG,inputs,excitation,Current state,outputs,Clock signal,construct by analog circuit, the output signal is the excitation input of storage element. next state=F(current state,input),construct by flip-flops, can store 2n state at most,construct by analog circuit, ou

19、tput=G(current state, input),返回,(2)Moore machine,Next-state logic F,state memory clock,Output logicG,PS: output=G (current state),inputs,Clock signal,excitation,Current state,outputs,2.analysis example,state variable:Q0、Q1,excitation:D0、D1,output:MAX,D0=F(EN,Q1,Q0) =(ENQ0)+(ENQ0) =ENQ0+ENQO D1=F(EN,

20、Q1,Q0) =ENQ1+ENQ1Q0 +ENQ1Q0,excitation equation,Characteristic equation of D f-fs:Q*=D,Transition equation: Q1*=D1 = ENQ1+ENQ1Q0+ENQ1Q0 Q0*=D0 = ENQ0+ENQO,transition equation,Transition table and state table,Transition equation : Q1*= ENQ1+ENQ1Q0+ENQ1Q0 Q0*= ENQ0+ENQO,Transition table,State table,As

21、sign state name to each state: Q1Q0 S 00 A 01 B 10 C 11 D,Current state,input,Next state,MAX=ENQ1Q0,Output equation,EN,MAX,Transition/output table,state/output table,Transition/output table, state/output table,A,D,C,B,State diagram,Q1Q0,State variable combination can be write in the circle directly.

22、,注意:有限状态机的时序分析必须以时钟周期为单位依序进行。,Timing diagram,Analysis of Moore maching,excitation equation and transition equation are changeless,MAXS=Q1Q0,transition table,state table,AMAXS=0,DMAXS=1,C MAXS=0,BMAXS=0,EN=0,EN=1,EN=0,EN=1,EN=0,EN=1,EN=0,EN=1,show output value inside the circle,state diagram,例1、2的时序对

23、比分析,state transition feature,transition expression on arcs leaving a particular state must be mutually exclusive and all inclusive. No two transition expressions can equal 1 for the same input combination; For every possible input combination, some transition expression must equal 1.,S1,I1,Si,S1,Sn,

24、Ii,In,transition expression,3、analysis with J-K flip-flops,(1) excitation equation: J0=K0=1 J1=K1=XQ0,(2) transition equation: Q0*=J0Q0+K0Q0=Q0 Q1*=J1Q1+K1Q1 =XQ0Q1,(3) output equation:Z=Q0Q1,(4) transition/output table and state/output table,assign state name: Q1Q0 S 00 A 01 B 10 C 11 D,AZ=0,DZ=1,C

25、 Z=0,BZ=0,X=1,X=0,X,X,X,X,X,X,state diagram,CP,timing diagram,X,Q1,Q0,Z,Exp3:analyze the following circuit,X,CLK,Z,(1) excitation equation: T1=X T2=XQ1,T1,T2,Q1,Q2,(2) transition equation: Q1*=T1Q1+T1Q1= XQ1+XQ1 Q2*= T2Q2+T2Q2= XQ1Q1+(XQ1)Q1,(3) output equation:Z=XQ1Q2,7.4 同步时序状态机的设计,提取输入/输出变量、状态,构造

26、状态/输出表,最小化状态的个数(可选),状态赋值,建立转移/输出表,选择一种触发器,构造激励表,由激励表导出激励方程,由转移/输出表推导出输出方程,画出逻辑电路图,Exp1: sequence-detector design,Design a “110” sequence-detector. when serial input binary number include continuous “110” sequence, the circuit output 1. synthsis by D flip-flops. that is input P: output C: solution 1:

27、Moore machine (1)input and output variable input:P(每次给电路送一个二进制数码) output:C(表明检测的结果,1位) state:,first input,Exp1: sequence-detector design,定义状态: S0收到的是0 S1收到的是1 S2收到连续的11 S3收到连续的110,P:,C:,目标:检测110,state/output table,(2)最小化状态的个数 (3)状态的分配(状态的赋值) n个状态变量 2n个状态。 S个状态需(?)个状态变量(触发器)来表达 需要触发器:m=2,令为Q0、Q1 分配状态

28、变量组合给已命名的状态: S:S0 S1 S2 S3 Q1Q0:00 01 10 11,(4)建立转移/输出表 用已赋值的状态变量代替状态/输出表中的状态名,S0,S1,S2,S3,(5)选择触发器并构建激励表(用于建立次态逻辑电路) 此处选择D触发器,功能表,应用表,激励表,应用方程:D=Q*,代入转移/输出表,(6)导出激励方程:由激励表,以Di的值作为输出,Q1、Q0、P的值作为输入,建立卡诺图,推导激励方程。,D1=Q1Q0+Q1Q0P D0=Q1Q0P+Q1Q0P+Q1Q0P,(7)导出输出方程 从转移/输出表得 C=Q1Q0,思考:若状态赋值时,采用gray码顺序给各状态赋值,则电

29、路是怎样的?,解(二):建立Mealy型的同步时序状态机 (1)定义状态 S0收到的是0,C=0S1收到的是1,C=0 S2收到连续的11 ,C=0 S3收到连续的110,C=1 (2)建立状态/输出表,(3)最小化状态个数 S0和S3是等价状态,消去S3,得简化的状态/输出表,S0,(4)状态的赋值所需触发器个数: 命名Q1、Q0Q1Q0=00,01,10,11 S=S0,S1,S2任选其中3个分配给已知状态。如,S0 00,S1 01,S2 11Q1Q0=10,是未用状态,建立转移/输出表,对未用状态的处理,最小风险法,最小成本法,(5)选触发器并导出激励表 按最小成本法处理,触发器选用J

30、-K触发器,,J-K触发器的应用表,激励表,(6)导出激励方程 J1=PQ0 K1=P J0=P K0=P (7)导出输出方程 C=Q1P,课堂练习,试写出如下电路的激励方程和转移方程。,D1=XQ0Q1 D0=XQ0+Q1 Q1*=D1 Q0*=D0 Y=X+Q1Q0,时钟同步状态机设计状态表设计,设计问题: 设计一个具有2个输入(A和B)1个输出(Z)的时钟同步状态机,Z为1的条件是: 在前2个脉冲触发沿上,A的值相同;或者 从上一次第1个条件为真起,B的值一直为1。 否则,输出为0。 (原文: Design a machine inputs A and B with output Z t

31、hat is 1 if: A had the same value at the two previous ticks B has been 1 since the last time the above was true ),1、确定电路可能有的状态 电路开始工作,设置INIT状态,Z=0 状态A0,A收到一个0,Z=0 状态A1,A收到一个1,Z=0 状态OK0,A收到连续的两个0,Z=1 状态OK1,A收到连续的两个1,Z=1 状态A001,A收到连续的两个0后,收到1,同时B=1,Z=1 状态A110,A收到连续的两个1后,收到0,同时B=1,Z=1 状态AE10,A已经收到过连续的0

32、0或11,收到连续的10,同时B=1,Z=1 状态AE01,A已经收到过连续的00或11,收到连续的01,同时B=1,Z=1,电路开始工作,设置INIT状态,Z=0 状态A0,A收到第一个0,Z=0 状态A1,A收到第一个1,Z=0 状态OK0,A收到连续的两个0,Z=1 状态OK1,A收到连续的两个1,Z=1 状态A001,A收到连续的两个0后,收到1,同时B=1,Z=1 状态A110,A收到连续的两个1后,收到0,同时B=1,Z=1 状态AE10,A已经收到过连续的00或11,收到连续的10,同时B=1,Z=1 状态AE01,A已经收到过连续的00或11,收到连续的01,同时B=1,Z=1

33、,等价状态,消去AE10,等价状态,消去AE01,等价状态,消去A001,等价状态,消去A110,最小化状态个数的状态表,状态赋值:将一个特定的二进制组合赋给一个已定义的状态。 需要的触发器个数(状态变量): 得 m=3,可提供8个二进制组合(状态编码) 从8种编码中选择5个,有 种方法, 将5个编码赋给5个状态有5!种方式,一共6720种。 依赖经验和实践指南完成状态的赋值。,建立转移/输出表、激励表,选定D触发器,导出激励方程、输出方程,建立转移/输出表、激励表,导出激励方程、输出方程,对未用状态的处理:(p.414) 最小风险法:给未用状态的次态定义一个明确的已用状态。 最小成本法:假设

34、电路正常工作,不会进入未用状态,忽略未用状态的次态,视为“无关项”。,?,D1,最小风险,D1=Q1+Q2Q3,D1,最小成本,D1=1,注: 采用最小风险法,除了未用状态的次态被赋予已定义的状态,对应于未用状态的输出函数值也应该置为0。 采用最小成本法,未用状态的次态和输出函数值都是无关项。 上例的输出函数: 最小风险法:Z=Q1Q2 最小成本法:Z=Q2,最小成本法的逻辑电路,最小风险法的逻辑电路,选用J-K触发器进行综合(自学),例2、1计数器,要求:设计一个有2个输入(X和Y)以及1个输出Z的同步时序状态机,复位后,当X和Y输入1的个数为4的整数倍时,输出为1,否则输出为0。 (des

35、ign a clocked synchronous state-machine with two inputs X and Y, and one output Z, the output should be 1 if the number of 1 inputs on X and Y since reset is a multiple of 4, and 0 otherwise.),定义状态: 每个状态要同时记录X和Y输入1的个数,定义: S0 复位后,X和Y输入的1的个数是0 S1 复位后,X和Y输入的1的个数是1 S2 复位后,X和Y输入的1的个数是2 S3 复位后,X和Y输入的1的个数是

36、3 S4 复位后,X和Y输入的1的个数是4 只要记录X和Y输入的1的个数N模4的结果即可。 N MOD 4 =0, Z=1 S0 N MOD 4 =1, Z=0 S1 N MOD 4 =2, Z=0 S2 N MOD 4 =3, Z=0 S3,1、状态/输出表:,2、化简状态的个数: 无等价状态,3、状态赋值及建立转移/输出表: S0 00、S1 01、S2 11、S3 10,4、由转移/输出表得激励表:,5、建立激励方程和输出方程:,6、画出逻辑电路(状态图,可选),例3、“组合锁”(a combination lock),要求:设计一个具有1个输入X和2个输出(UNLK和HINT)的时钟同

37、步状态机。当且仅当X为0并且前面7个脉冲触发沿到来时X接收到的输入序列为0110111时,输出UNLK为1,当且仅当X的当前值是上述序列中的1个正确值以使状态机逐步接近于“解锁”状态(即UNLK=1)时,输出HINT为1。 本质上是序列检测,7.5 用状态图设计状态机,状态表设计与状态图设计的不同: 状态表是穷举列表的方法 状态图表达状态的转移用一条带转移表达式的弧线,其中可能包含多个输入。经常不能一次达到状态转移的完备性。,例1、设计一个序列检测电路,当串行输入的二进制数码中有连续的字段1101时,则在收到最后一个1时,输出Z为1,其余为0。(设不允许交叠检测,选用D触发器综合) 分析:,S

38、0,S1,S11,S110,收到1个1,收到连续的11,收到连续的110,S1101,未收到连续的11时收到0,收到连续的1101,状态图中的等价状态的判断: 观察是否有两个状态的离开弧线有相同的转移表达式并值相同一个状态,如果是,则两个状态是等价状态。 本例中S0和S1101是等价状态。 状态赋值并建立转移/输出表及激励表:,S0,S1,S11,S110,激励方程: D1=Q1Q0+Q0X D2=Q1X+Q0X 输出方程: Z=Q1Q0X,例2、雷鸟车尾灯的状态机,输入:L(LEFT)、R(RIGHT)、H(HAZ) 输出:LA、LB、LC、RA、RB、RC 电路的工作: 输入L LA、LB

39、、LC依次点亮,且先亮的灯保持; 输入R RA、RB、RC依次点亮,且先亮的灯保持; 输入H 六个灯同时亮 无输入时,六个灯不亮 定义状态:,LA,LB,LC,RA,RB,RC,建立状态图,IDLE,LR3,L1,L3,L2,R1,R3,R2,该状态图存在不完备性。考虑如下:,IDLE,LR3,L1,L3,L2,R1,R3,R2,H+LR,正确的状态图,1,HLR,IDLE,LR3,L1,L3,L2,R1,R3,R2,H+LR,H,H,H,H,改进的状态图,1,HLR,H,H,H,H,状态赋值,共8个状态,需触发器3个,定义状态变量Q0、Q1、Q2。 赋值:S IDLE L1 L2 L3 R1 R2 R3 LR3 Q2Q1Q0 000 001 011 010 101 111 110 100 根据状态图中的转移表达式建立转移列表(p.427 表7-17) 推导转移方程:转移列表视为真值表,其中,当前态Q2、Q1、Q0和转移表达式作为输入,次态Q2*、Q1*、Q0*作为输出。,课堂练习,已知某同步时序电路的转移方程、输出方程如下,请写出其转移/输出表,并画出状态图,试说明其功能。状态变量赋值按Q1Q0=00、01、10、11。 Q1*=XQ0Q1+XQ1 Q0*=XQ0+XQ1Q0 Y=Q0Q1,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1