ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:16.10KB ,
资源ID:11982525      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/11982525.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(VerilogHDL电梯程序文件.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

VerilogHDL电梯程序文件.docx

1、VerilogHDL电梯程序文件这个程序不需要你再添加任何的程序,你只需要添加楼层数就可以成功控制6层以上电梯,另外你必须得读懂每一块程序的作用,才能对这个程序有更好的应用module dtsj(clk,reset,up1,up2,up3,up4,up5,dn2,dn3,dn4,dn5,dn6,d1,d2,d3,d4,d5,d6,overw,pro,led,hex,Buzzer1,lig);input clk,reset; /reset键使用keyinput overw,pro,up1,up2,up3,up4,up5,dn2,dn3,dn4,dn5,dn6,d1,d2,d3,d4,d5,d6;

2、 /故障警报键output6:0 hex,lig; /light和led用数码管output5:0 led;output Buzzer1;reg Buzzer1,door;reg6:0 hex,lig;reg2:0state,next_state,count;reg5:0 d,up,dn,now_f,curr,led; /d是内部按键,up外部上升按键,dn是外部下降按键, /now_f是当前楼层,curr是当前楼层的另外一个变量reg1:0 ud_f; /上升下降标志位reg light;/reg29:0 counter;/reg clkout;parameter idle_state=3b

3、001,open_state=3b010,close_state=3b011, up_state=3b100,down_state=3b101,sleep_state=3b110, alarm_state=3b111,f1=6b000001,f2=6b000010,f3=6b000100,f4=6b001000 ,f5=6b010000,f6=6b100000,up_f=2b01,dn_f=2b10,idle=2b00; /jiu zhong zhuang tai he shang sheng zhuang tai shang sheng zhuang tai he xia jia zhuan

4、g tai initial begin state=idle_state; endalways (posedge clk or posedge reset) if(reset) state=idle_state; else state=next_state;always (state or up or dn or d or now_f or count or ud_f) case(state) open_state: begin if(count0) begin if(d&now_f)0) next_state=open_state; else if(dnow_f) next_state=up

5、_state; else next_state=down_state; end else if(up&now_f)|(dn&now_f) next_state=open_state; else if(upnow_f)|(dnnow_f) next_state=up_state; else if(up|dn) next_state=down_state; else next_state=idle_state; end up_state: begin if(up|dn|d|ud_f)=0) next_state=sleep_state; if(!overw|pro=1) next_state=al

6、arm_state; else if(d&now_f)|(up&now_f) next_state=open_state; else if(dnow_f)|(upnow_f) next_state=up_state; else if(dnow_f)|(up0) begin if(dnnow_f) next_state=up_state; else if(dn&now_f)|(now_ff6) next_state=open_state; else if(dn&now_f)&(now_f=f6) next_state=open_state; else next_state=down_state;

7、 end else next_state=idle_state; end down_state: begin if(up|dn|d|ud_f)=0) next_state=sleep_state; else if(!overw|pro=1) next_state=alarm_state; else if(d&now_f)|(dn&now_f) next_state=open_state; else if(dnow_f)&(d!=6b000001)|(dnnow_f)|(dnnow_f) next_state=up_state; else if(up0) begin if (upf1) next

8、_state=down_state; else if(up&now_f)&(now_f=f1) next_state=open_state; else next_state=up_state; end else next_state=idle_state; end close_state: begin if(up|dn|d|ud_f)=0) next_state=sleep_state; else if(!overw|pro=1) next_state=alarm_state; else if(ud_f=up_f) begin if(d&now_f)|(up&now_f) next_state

9、=open_state; else if(dnow_f)|(upnow_f) next_state=up_state; else if(d|up) next_state=down_state; else if(dn0) begin if(dnnow_f) next_state=up_state; else if(dn&now_f)0) next_state=open_state; else next_state=down_state; end else next_state=idle_state; end else if(ud_f=dn_f) begin if(d&now_f)|(dn&now

10、_f) next_state=open_state; else if(dnow_f)&(d!=6b000000)|(dn0) begin if(up0) next_state=open_state; else next_state=up_state; end else next_state=idle_state; end else begin if(d0) begin if(d&now_f)0) next_state=open_state; else if(dnow_f) next_state=up_state; else next_state=down_state; end else if(

11、up&now_f)&(dn&now_f) next_state=open_state; else if(upnow_f)&(dnnow_f) next_state=up_state; else if(up|dn) next_state=down_state; else next_state=idle_state; end end alarm_state: begin if(!overw|pro=1) begin /Buzzer1=1b1; next_state=open_state; end else begin /Buzzer10) begin if(d&now_f)0) next_stat

12、e=open_state; else if(dnow_f) next_statenow_f)|(dnnow_f) next_state=up_state; else if(up|dn) next_state=down_state; else next_state=idle_state; end end default: next_state=idle_state; endcase always (up1 or up2 or up3 or up4 or up5) up =1b0,up5,up4,up3,up2,up1; always (dn2 or dn3 or dn4 or dn5 or dn

13、6) dn =dn6,dn5,dn4,dn3,dn2,1b0; always (d1 or d2 or d3 or d4 or d5 or d6) d =d6,d5,d4,d3,d2,d1; always (posedge clk or posedge reset) begin if(reset) count=0; else if(next_state=open_state)&(count5) count=count+1; else count=0; endalways (posedge clk or posedge reset ) /always (reset or next_state)

14、if(reset) begin now_f=f1; ud_f=idle; led=6b000001; light=1b0; end else begin now_f=now_f; curr=now_f; case(next_state) idle_state: begin now_f=now_f; ud_f=idle; led=led; curr=now_f; Buzzer1=1b0; end up_state: begin now_f=now_f1; ud_f=up_f; led=led+1; curr=now_f; end down_state: begin now_f1; ud_f=dn

15、_f; led=led+1; curr=now_f; end open_state: begin now_f=now_f; ud_f=ud_f; led=led; door=1b1; light=door; curr=now_f; end close_state: begin now_f=now_f; ud_f=ud_f; led=led; curr=now_f; door=1b0; light=door; end alarm_state: begin now_f=now_f; ud_f=ud_f; led=led; Buzzer1=1b1; curr=now_f; door=1b1; lig

16、ht=door; end sleep_state: begin now_f=now_f; ud_f=ud_f; led=6b000000; curr=now_f; end default: begin now_f=f1; ud_f=idle; led=led; end endcase end always (curr)begin case(curr) 6b000001: hex=7b1111001; /数码管共阴共阳 6b000010: hex=7b1000100; 6b000100: hex=7b0110000; 6b001000: hex=7b0011001; 6b010000: hex=

17、7b1101101; 6b100000: hex=7b1111101; default: hex=7b0000000; endcase endalways (light) begin case(light) 1b0: lig=7b1000000; /1b1: lig=7b1000000; 1b1: lig=7b1111001; default: light=7b0000000; endcase end/分频程序/*always (posedge clk) begin if( counter29:0 = 24999999) begin /每计到4个(03)上升沿,输出信号翻转一次 counter = 0; clkout = clkout; end else counter29:0 = counter29:0 + 1b1; end*/ endmodule

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1