




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
桂林电子科技大学信息科技学院EDA技术与应用实训报告指导教师:江国强 窦文淼 2013年5 月9日一个4路智能抢答器的设计 1.系统设计:设计一个四路智能抢答器1.1 设计要求主持人开始是否有人提前按下?是否显示抢答停输出结果组输出加分减分重来1.1.1 设计任务要求使用cyclone EP1器件制作一个简单的智能抢答器1.1.2 技术要求抢答器能实现初始计分,主持人控制抢答开始,抢答结果清零,记录每组分数的功能,在答对或打错的情况下对每组进行加分或减分,在提前和超时抢答时实现扣分加分的功能。1.2 方案比较与以往的硬件连接和单片机的方案作比较,用试验箱的cyclone芯片有反应快,编程简单,功能可靠性好的优点。与同样使用cyclone芯片的作品比较此抢答器增加灯闪烁三秒,超时抢答和提前抢答的惩罚功能,加分范围更宽。1.3 方案论证1.3.1 总体思路先使用Quartus9.0软件模块化设计,再在原理图中将模块连线即可完成功能!1.3.2 设计方案1.通过:倒计时,加减计数(jiajianjishu),数码管控制模块(mux1),抢答器(qdq),闪三秒(ZHSM)模块,实现功能,其中mux1模块是对数码管进行控制的,四位(16脚)从这里输出,还有两位8个脚从daojishi模块输出;加减计数模块是将每一组的分数保存下来,再通过mux1输出,抢答时通过一个拨动开关,一个防抖动按键控制加分减分;或门 让当输出有一个为1时,mux1可以打开,超时和提前抢答结果可以进去,输出到数码管;倒计时模块是输出一个秒脉冲的从30减到0的信号的,ZHSM模块是控制数码管闪3秒的。2各个模块程序的设计倒计时(daojishi)里面的:1:分频器module cnt60(clk,cout,i,j,m);input clk,i,j,m;reg 24:0q;output reg cout;always (posedge clk&(i)&(j)&(m) begin if(q20000000-1) q=q+1; else q=0; if(q=20000000-1) cout=1; else cout=0; end endmodule2. 30秒倒计时:module cntdj(clrn,clk,q,count);input clk,clrn;output reg 7:0 q;output reg count; always (posedge clk or negedge clrn) if(clrn) begin q=h30;count=h0; end else begin if(q=0) q=h30; else q=q-1; if(q3:0=hf)begin q3:0=9;end if(q=h0) count=1; else count=0; endendmodule3.抢答器组数输出模块:module qdq(clk,qd,qd1,qd2,qd3,qd4,Sig,Sig1,Sig2,d,k,g,cnn1,cnn2,cnn3,cnn4);input clk,qd,qd1,qd2,qd3,qd4,k,g,cnn1,cnn2,cnn3,cnn4;output Sig,Sig1,Sig2;output 3:0d; reg Sig=h0,Sig1=h0,Sig2=h0;reg 3:0d;reg zd=1b0;always (posedge clk)beginif(qd=1b0)begin zd=1; Sig=h0;Sig1=h0;Sig2=h0;d=h0;endif(k)beginif(zd=1b1)begin if(g)begin/if(qd1=1b0)&(cnn1)if(qd1=1b0)beginzd=1b0;Sig2=h1;d=1;end else if(qd2=1b0)&(cnn2)beginzd=1b0;Sig2=h1;d=2;end else if(qd3=1b0)&(cnn3)beginzd=1b0;Sig2=h1;d=3;end else if(qd4=1b0)&(cnn4)beginzd=1b0;Sig2=h1;d=4;end endelse if(qd1=1b0)&(cnn1)beginzd=1b0;Sig=h1;d=1;end else if(qd2=1b0)&(cnn2)beginzd=1b0;Sig=h1;d=2;end else if(qd3=1b0)&(cnn3)beginzd=1b0;Sig=h1;d=3;end else if(qd4=1b0)&(cnn4)beginzd=1b0;Sig=h1;d=4;endendendelse if(k)beginif(zd=1b1)beginif(qd1=1b0)&(cnn1)beginzd=1b0;Sig1=h1;d=1; end else if(qd2=1b0)&(cnn2)beginzd=1b0;Sig1=h1;d=2;end else if(qd3=1b0)&(cnn3)beginzd=1b0;Sig1=h1;d=3;end else if(qd4=1b0)&(cnn4)beginzd=1b0;Sig1=h1;d=4;endendendendendmodule4. 3秒闪灯模块: 里面3个倒计时:每个SM模块里面:程序:gen:module gen(clk,cout);input clk;reg23:0 q;output reg cout;always (posedge clk) begin if(q=20000000-1) q=0; else q=q+1; if(q0) q=q-1; else q=0; if (q=0) out=0; else out=1;end end endmodule5.加减计数(jiajianjishu):module jiajianjishu(t1,t2,t3,t4,s1,d,count,cnn1,cnn2,cnn3,cnn4,p);input s1,p;input 3:0d;output reg count,cnn1,cnn2,cnn3,cnn4;output reg11:0t1,t2,t3,t4;initial begin t1=h100;t2=h100;t3=h100;t4=h100; endalways (posedge s1 )beginif(p)beginif(d=h1) begin t1=t1+h10;if(t17:4=ha)begin t17:4=0;t111:8=t111:8+1;endelse if(t1=h1000) count=1;else count=0;endelse if(d=h2) begin t2=t2+h10;if(t27:4=ha)begint27:4=0;t211:8=t211:8+1;end else if(t2=h1000) count=1;else count=0;endelse if(d=h3) begin t3=t3+h10;if(t37:4=ha)begin t37:4=0;t311:8=t311:8+1;endelse if(t3=h1000) count=1;else count=0;endelse if(d=h4) begin t4=t4+h10;if(t47:4=ha)begin t47:4=0;t411:8=t411:8+1;end else if(t4=h1000) count=1;else count=0;endelse begin t1=h100;t2=h100;t3=h100;t4=h100; endendelse if(p) begin if(d=h1) begin t1=t1-h10;if(t17:4=hf)begin t17:4=9;t111:8=t111:8-1;if(t111:8=hf)begin t111:8=0;end endelse if(t111:4=h0) begin cnn1=1;t111:0=h0; endelse cnn1=0;end else if(d=h2) begin t2=t2-h10;if(t27:4=hf)begin t27:4=9;t211:8=t211:8-1;if(t211:8=hf)begin t211:8=0;end end else if(t211:4=h0)begin cnn2=1;t211:0=h0; end else cnn2=0;end else if(d=h3) begin t3=t3-h10; if(t37:4=hf)begin t37:4=9;t311:8=t311:8-1; if(t311:8=hf)begin t311:8=0;end endelse if(t311:4=h0)begin cnn3=1;t311:0=h0;endelse cnn3=0;end else if(d=h4) begin t4=t4-h10;if(t47:4=hf)begin t47:4=9;t411:8=t411:8-1;if(t411:8=hf)begin t411:8=0;end end else if(t411:4=h0) begin cnn4=1;t411:0=h0 ;end else cnn4=0;end else begin t1=100;t2=100;t3=100;t4=100; end end end endmodule6.输出mux1模块module mux_1(d,t1,t2,t3,t4,w,qs);input w;input 3:0 d;input 11:0 t1,t2,t3,t4;output reg15:0 qs;alwaysbegin if(w)begin qs15:12=d; if(d=1)begin qs11:0=t1;endelse if(d=2)begin qs11:0=t2;endelse if(d=3)begin qs11:0=t3;endelse if(d=4)begin qs11:0=t4;endelse qs11:0=0; end else qs15:0=0; endendmodule3制作与调试过程调试过程中,三秒计时亮灯是难点,要求要实现亮三秒后自动熄灭,同时,亮灯不能一直保持,所以想到两种方法,一种是从4开始,这样结构简单,但是第一秒不会亮,另一种方法是再加入一个脉冲输出模块,这个方法比较难,所以我们没有选用。还有加入一个3输入或门控制数码管选择器开关!4结论此设备可以正常实现功能,但是细节地方存在少量bug,在3秒亮灯的地方存在清零问题。总体较为成功,用到的学过的模块有加减计数器,选通器,锁存器,分频器,倒过来使用的3-8译码器。方法有原理图,verilog hdl硬件语言。
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 付费会员特色活动方案
- 仙桃拍照活动方案
- 代发薪单位活动方案
- 代表先行活动方案
- 代账公司转介绍活动方案
- 以往节日促销活动方案
- 企业中秋晚会活动方案
- 企业下沉活动方案
- 企业公司团建策划方案
- 企业减重达人活动方案
- 中国农大学生电磁场仿真实验报告
- 公司投标书密封条模板
- 1999年高考语文试题及答案(全国卷)
- 云南坤天新能源有限公司20万吨锂电池负极材料生产项目(一期4万吨)环评报告
- 疟疾防治知识培训疟疾防治知识培训
- 六年级下册《道德与法治》教学工作总结
- 气管切开非机械通气患者气道护理课件
- 农产品电商营销与运营PPT完整全套教学课件
- 实验室人员准入制度(二篇)
- 2023年浙江省省级公立医院医疗服务价格汇总表(临床诊疗类)
- 数据要素市场化配置探索:理论与实践
评论
0/150
提交评论