电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

Appendix-DVIP免费

Appendix-D_第1页
1/8
Appendix-D_第2页
2/8
Appendix-D_第3页
3/8
Appendix D: ImplementingState Machines using VerilogBehavioural ModeD.1INTRODUCTIONIn Chapters 1–5, state machines have been implemented using the equations obtained from thestate diagram. This approach ensures that the logic for the state machine is under completecontrol of the designer.However, if the state machine is implemented using behavioural mode, the Verilog compilerwill optimize the design.There is a very close relationship between the state diagram and the behavioural Verilogdescription that allows a direct translation from the state diagram to the Verilog code.D.2THE SINGLE-PULSE/MULTIPLE-PULSE GENERATOR WITH MEMORYFINITE-STATE MACHINE REVISITEDIn this system there are two inputs: s to start the system and x to choose either single-pulse ormultiple-pulsemode.Insingle-pulsemode,theLouputisusedtoindicatetotheuserthatasinglepulse has been generated. In multiple-pulse mode, L is suppressed. Figure D.1 illustrates thestate diagram for this system.Rather than derive the equations directly from the state diagram, a Verilog description can beobtained directly from the state diagram of Figure D.1. This is illustrated in Listing D.1.// Behavioural State Machine.module pulsar(s,clk,rst,P,L,ab);1input s,clk,rst;2output [1:0]ab,P,L;3reg [1:0]state, P, L;4parameter s0¼2’b00, s1¼2’b01, s2¼2’b11, s3¼2’b10;// now define state sequence for FSM (from state diagram).5always @ (posedge clk or negedge rst)6if (�rst)7state <¼ s0;FSM-based Digital Design using Verilog HDL Peter Minns and Ian Elliott# 2008 John Wiley & Sons, Ltd. ISBN: 978-0-470-06070-48else9case(state)10s0: if (s) state <¼s1; else state <¼ s0;11s1: state <¼ s2;12s2: if (�x) state <¼ s3; else state <¼ s1;13s3: if (�s) state <¼s0; else state <¼ s3;14endcase// now define...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

您可能关注的文档

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部