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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

vhdl考试时钟.docx

1、vhdl考试时钟实验报告应用技术一班朱晓园,汪仙仙,张明星,胡亚洲一:分频模块定义clk为时钟输入引脚。输入20MHZ的频率。定义一个clk1hz分频和ckl100HZ分频。LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std_logic_arith.all;USE ieee.std_logic_unsigned.all;ENTITY FENPIN IS PORT ( clk : IN STD_LOGIC; oclk : OUT STD_LOGIC; oclk100hz : OUT STD_LOGIC ); END FENPIN;ARCHI

2、TECTURE FENPIN _architecture OF FENPIN ISBEGINprocess(clk)variable cnt :integer range 0 to 20000000;beginif rising_edge(clk) then cnt:=cnt+1; if cnt=10000000 then oclk=1; else if cnt=20000000 then cnt:=0; oclk=0; end if; end if;end if; end process;process(clk)variable cnt1 :integer range 0 to 200000

3、00; beginif rising_edge(clk) then if cnt1=200000 then cnt1:=0; oclk100hz=1; else cnt1:=cnt1+1; oclk100hz=0; end if; end if;end process;END FENPIN _architecture;二:按键消抖因为机械键盘存在抖动现象,所以需要用延时,软件去抖。这里用100HZ的频率,一旦出现低电平,就计数10次,一共100MS,然后再次检测,如果仍为低,就输出0信号。LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std

4、_logic_arith.all;USE ieee.std_logic_unsigned.all;ENTITY XIAODOU ISPORT ( clk : IN STD_LOGIC; rst_key : IN STD_LOGIC; set_key : IN STD_LOGIC; position : IN STD_LOGIC; addup : IN STD_LOGIC; position_s : IN STD_LOGIC; addup_time : IN STD_LOGIC; rst_time : OUT STD_LOGIC; set_time : OUT STD_LOGIC ); END

5、XIAODOU;ARCHITECTURE XIAODOU_architecture OF XIAODOU ISsignal cnt:std_logic_vector(3 downto 0); BEGINprocess(clk)beginif rising_edge(clk) thenif rst_key=1thencnt=0000;rst_time=1;elseif cnt=1001 thenrst_time=0;cnt=cnt;elsecnt=cnt+1;rst_time=1;end if;end if;end if;end process;END XIAODOU_architecture;

6、三:按键处理信号set键用来检测设置按键,第一次按下,为设置,第二次按下,为取消按键。position为位置选择,按下一次选择第一个,按下二次为第二次,以此类推。其余按键正常输出。LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std_logic_arith.all;USE ieee.std_logic_unsigned.all;ENTITY ANJIANCHULI IS PORT ( clk : IN STD_LOGIC; rst : IN STD_LOGIC; set : IN STD_LOGIC; add : IN STD_LOGIC;

7、 position : IN STD_LOGIC; set_out : OUT STD_LOGIC; rst_out : OUT STD_LOGIC; add_out : OUT STD_LOGIC; position1 : OUT STD_LOGIC; position2 : OUT STD_LOGIC; position3 : OUT STD_LOGIC; position4 : OUT STD_LOGIC );END ANJIANCHULI;ARCHITECTURE ANJIANCHULI_architecture OF ANJIANCHULI ISsignal cnt: std_log

8、ic_vector(1 downto 0); signal cnt1: std_logic_vector(1 downto 0); beginprocess(set)beginif setevent and set=0thencnt=cnt+1;end if;end process;set_out=0when cnt (0)=0 else1when cnt (0)=0 else0;process(position)beginif positionevent and position =0thencnt1position1=0;position2=1;position3=1;position4p

9、osition1=1;position2=0;position3=1;position4position1=1;position2=1;position3=0;position4position1=1;position2=1;position3=1;position4null;end case;end process;process(clk)beginif rising_edge(clk)thenrst_out=rst;add_out=add;end if;end process; END ANJIANCHULI_architecture;四:计数十十进制计数为时钟个位计数,自动计数满10,C

10、Y进1给六进制模块。手动设置时,不进位LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std_logic_arith.all;USE ieee.std_logic_unsigned.all;ENTITY JISHUSHI ISPORT ( clk : IN STD_LOGIC; rst : IN STD_LOGIC; set : IN STD_LOGIC; add : IN STD_LOGIC; position : IN STD_LOGIC; dataout : OUT STD_LOGIC_VECTOR(3 downto 0); os :

11、OUT STD_LOGIC ); END JISHUSHI_vhd;ARCHITECTURE JISHUSHI_vhd_architecture OF JISHUSHI_vhd ISsignal buffer_os:std_logic;signal adder_buffer:std_logic_vector(3 downto 0);signal add_cnt:std_logic_vector(3 downto 0);BEGINbuffer_os=0 when set=0 else clk;process(set,position,buffer_os)begin if rst=0 then a

12、dder_buffer=0000; elsif set=0 and position=0 then adder_buffer=add_cnt; elsif rising_edge(buffer_os) then if adder_buffer=1001 then adder_buffer=0000; os=1; else adder_buffer=adder_buffer+1; os=0; end if;end if;end process;dataout=adder_buffer;process(add)begin if addevent and add=0 then if add_cnt=

13、1001 then add_cnt=0000;else add_cnt=add_cnt+1; end if;end if;end process;END JISHUSHI_vhd_architecture;五:计数六六进制计数为时钟个位计数,自动计数满5,CY进1给十进制模块。手动设置时,不进位LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std_logic_arith.all;USE ieee.std_logic_unsigned.all;ENTITY JISHULIU_vhd ISPORT ( clk : IN STD_LOGIC; s

14、et : IN STD_LOGIC; add : IN STD_LOGIC; position : IN STD_LOGIC; rst : IN STD_LOGIC; dataout : OUT STD_LOGIC_VECTOR(3 downto 0); os : OUT STD_LOGIC ); END JISHULIU_vhd;ARCHITECTURE JISHULIU_vhd_architecture OF JISHULIU_vhd ISsignal buffer_os :std_logic;signal adder_buffer :std_logic_vector(3 downto 0

15、);signal add_cnt: std_logic_vector(3 downto 0);BEGINbuffer_os=0 when set=0 else clk;process(buffer_os,rst,set,position)begin if rst=0 then adder_buffer=0000; elsif set=0 and position=0 then adder_buffer=add_cnt; elsif rising_edge(buffer_os) then if adder_buffer=0101 then adder_buffer=0000; os=1; els

16、e adder_buffer=adder_buffer+1; os=0;end if;end if;end process;dataout=adder_buffer;process(add)beginif add event and add=0 then if add_cnt=0101 then add_cnt=0000; else add_cntdataoutdataoutdataoutdataoutdataoutdataoutdataoutdataoutdataoutdataoutnull;end case;end process;END code_module_architecture;

17、七:闪烁当position为0时,让此数码管闪烁,当set和position都为1时,正常显示。LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std_logic_arith.all;USE ieee.std_logic_unsigned.all;ENTITY FLASH_vhd ISPORT ( clk : IN STD_LOGIC; clk_syn : IN STD_LOGIC; set : IN STD_LOGIC; position : IN STD_LOGIC; datain : IN STD_LOGIC_VECTOR(6 down

18、to 0); dataout : OUT STD_LOGIC_VECTOR(6 downto 0) ); END FLASH_vhd;ARCHITECTURE FLASH_vhd _architecture OF FLASH_vhd ISbeginprocess(set,position,clk)beginif rising_edge(clk_syn) then if set=0 and position=0 then if clk=1 then dataout=datain; else dataout=1111111; end if; else dataout = datain; end if;end if;end process; END FLASH_vhd_architecture;

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

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