首页 可变模计数器

可变模计数器

举报
开通vip

可变模计数器可变模计数器                    实验名称:可变模数计数器一、实验目的:设计一个可变模计数器,计数器由3个触发器构成,在外部控制信号S2S1的控制下分别实现模3、模5、模7和模8的计数,即(1)、S2S1=00时,实现模3计数,触发器状态依次为0→1→2→0;(2)、S2S1=01时,实现模5计数,触发器状态依次为0→1→2→3→4→0;(3)、S2S1=10时,实现模7计数,触发器状态依次为0→1→2→3→4→5→6→0;(4)、S2S1=11时,实现模8计数,触发器状态依次为0→1→2→3→4...

可变模计数器
可变模计数器                    实验名称:可变模数计数器一、实验目的:设计一个可变模计数器,计数器由3个触发器构成,在外部控制信号S2S1的控制下分别实现模3、模5、模7和模8的计数,即(1)、S2S1=00时,实现模3计数,触发器状态依次为0→1→2→0;(2)、S2S1=01时,实现模5计数,触发器状态依次为0→1→2→3→4→0;(3)、S2S1=10时,实现模7计数,触发器状态依次为0→1→2→3→4→5→6→0;(4)、S2S1=11时,实现模8计数,触发器状态依次为0→1→2→3→4→5→6→7→0;二、实验 内容 财务内部控制制度的内容财务内部控制制度的内容人员招聘与配置的内容项目成本控制的内容消防安全演练内容 :(1)、顶层原理图:(2)、各个模块程序:1、模3:(库略)entitycnt3isport(s2,s1,en,rd:instd_logic;clk:instd_logic;q:outstd_logic_vector(3downto0));endcnt3;architecturecntofcnt3issignalqn:std_logic_vector(3downto0);beginprocess(clk,s1,s2)beginif(rd='0')thenqn<=X"0";elsif(en='0')thenqn<=X"0";elsif(clk'eventandclk='1'ands1='0'ands2='0')thenifqn(3downto0)=X"2" thenqn(3downto0)<="0000";elseqn<=qn+1;endif;endif;endprocess;q<=qn;endcnt;2、模5:(库略)    entitycnt5isport(s2,s1,en,rd:instd_logic;clk:instd_logic;q:outstd_logic_vector(3downto0));endcnt5;architecturecntofcnt5issignalqn:std_logic_vector(3downto0);beginprocess(clk,s1,s2)beginif(rd='0')thenqn<=X"0";elsif(en='0')thenqn<=X"0";elsif(clk'eventandclk='1'ands1='1'ands2='0')thenifqn(3downto0)=X"4" thenqn(3downto0)<="0000";elseqn<=qn+1;endif;--else--qn<=X"0";endif;endprocess;q<=qn;endcnt;3、模7:(库略)entitycnt7isport(s2,s1,en,rd:instd_logic;clk:instd_logic;q:outstd_logic_vector(3downto0));endcnt7;architecturecntofcnt7issignalqn:std_logic_vector(3downto0);beginprocess(clk,s1,s2)beginif(rd='0')thenqn<=X"0";elsif(en='0')thenqn<=X"0";elsif(clk'eventandclk='1'ands1='0'ands2='1')thenifqn(3downto0)=X"6" thenqn(3downto0)<="0000";elseqn<=qn+1;endif;--else--qn<=X"0";endif;endprocess;q<=qn;endcnt;4、模8:(库略)entitycnt8isport(s2,s1,en,rd:instd_logic;clk:instd_logic;q:outstd_logic_vector(3downto0));endcnt8;architecturecntofcnt8issignalqn:std_logic_vector(3downto0);beginprocess(clk,s1,s2)beginif(rd='0')thenqn<=X"0";elsif(en='0')thenqn<=X"0";elsif(clk'eventandclk='1'ands1='1'ands2='1')thenifqn(3downto0)=X"7" thenqn(3downto0)<="0000";elseqn<=qn+1;endif;--else--qn<=X"0";endif;endprocess;q<=qn;endcnt;5、decoder显示:(库略)entitydecoderisport(s1,s2:instd_logic;seg:outstd_logic_vector(6downto0);done,dtwo,dthree,dfour:in  std_logic_vector(3downto0)  );enddecoder;architecturedecofdecoderissignald:std_logic_vector(3downto0);beginprocess(s1,s2)beginif(s1='0'ands2='0')thend<=done;elsif(s1='1'ands2='0') thend<=dtwo;elsif(s1='0'ands2='1') thend<=dthree;elsed<=dfour;endif;endprocess;withdselectseg<="0111111" when"0000","0000110"when"0001","1011011"when"0010","1001111"when"0011","1100110"when"0100","1101101"when"0101","1111101"when"0110","0000111"when"0111","1111111"when"1000","1101111"when"1001","0000000"whenothers;enddec;三、实验总结:通过本次实验,掌握了从顶层文件原理图开始,自上而下的设计电路的方法,感受到此方法的在各个模块程序调试时的方便,有更好的逻辑思路。除此之外,还对VHDL语言的编写、调试,更好的掌握VHDL语言的编写的一些技巧。
本文档为【可变模计数器】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_721103
暂无简介~
格式:doc
大小:414KB
软件:Word
页数:0
分类:
上传时间:2021-08-10
浏览量:55