基于BASYS2的抢答器

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

moduleqiangda(clk,butten_1,butten_2,butten_3,butten_en,LD0,LD1,LD2,shuma,shuma_en);inputclk;inputbutten_1;inputbutten_2;inputbutten_3;inputbutten_en;outputLD0;outputLD1;outputLD2;outputshuma_en;outputshuma;regflat_en;regLD0;regLD1;regLD2;reg[0:6]shuma;//regshuma_en=1'b0;reg[24:0]cnt;regclk_1hz;regreg1;assignshuma_en=1'b0;/**********************分频环节、默认时钟为50MHZ************************************/always@(posedgeclk)beginif(cnt=25'd25000000)begincnt=25'd0;clk_1hz=~clk_1hz;endelsecnt=cnt+1'd1;end/**********************锁存、抢答环节***********************************/always@(posedgeclk)beginif(butten_en==1'b1)beginflat_en=1'b1;LD0=1'b0;LD1=1'b0;LD2=1'b0;reg1=1'b0;endelsebeginif(butten_1==1'b1)beginif(flat_en==1'b1)beginLD0=1'b1;flat_en=1'b0;reg1=1'b1;endendelseif(butten_2==1'b1)beginif(flat_en==1'b1)beginLD1=1'b1;flat_en=1'b0;reg1=1'b1;endendelseif(butten_3==1'b1)beginif(flat_en==1'b1)beginLD2=1'b1;flat_en=1'b0;reg1=1'b1;endendendend/*******************************数码管显示*********************************/always@(posedgeclk_1hz)beginif(reg1==1'b1)//注意此处为电平触发case(shuma)7'b0011000:shuma=7'b0000000;7'b0000000:shuma=7'b1111000;7'b1111000:shuma=7'b0000010;7'b0000010:shuma=7'b0010010;7'b0010010:shuma=7'b0011001;7'b0011001:shuma=7'b0110000;7'b0110000:shuma=7'b0100100;7'b0100100:shuma=7'b1111001;7'b1111001:shuma=7'b1000000;default:shuma=7'b1000000;endcaseelseshuma=7'b0011000;endendmodule/*********************************ucf***************************************/NETbutten_enLOC=G12|IOSTANDARD=LVCMOS33;NETbutten_1LOC=C11|IOSTANDARD=LVCMOS33;NETbutten_2LOC=M4|IOSTANDARD=LVCMOS33;NETbutten_3LOC=A7|IOSTANDARD=LVCMOS33;NETclkLOC=B8|IOSTANDARD=LVCMOS33;NETLD0LOC=M5|IOSTANDARD=LVCMOS33;NETLD1LOC=M11|IOSTANDARD=LVCMOS33;NETLD2LOC=p7|IOSTANDARD=LVCMOS33;NETshuma[6]LOC=L14|IOSTANDARD=LVCMOS33;NETshuma[5]LOC=H12|IOSTANDARD=LVCMOS33;NETshuma[4]LOC=N14|IOSTANDARD=LVCMOS33;NETshuma[3]LOC=N11|IOSTANDARD=LVCMOS33;NETshuma[2]LOC=P12|IOSTANDARD=LVCMOS33;NETshuma[1]LOC=L13|IOSTANDARD=LVCMOS33;NETshuma[0]LOC=M12|IOSTANDARD=LVCMOS33;NETshuma_enLOC=K14|IOSTANDARD=LVCMOS33;

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功