基于简易时钟的设计

上传人:飞*** 文档编号:4349151 上传时间:2017-08-18 格式:DOC 页数:7 大小:49KB
返回 下载 相关 举报
基于简易时钟的设计_第1页
第1页 / 共7页
基于简易时钟的设计_第2页
第2页 / 共7页
基于简易时钟的设计_第3页
第3页 / 共7页
基于简易时钟的设计_第4页
第4页 / 共7页
基于简易时钟的设计_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《基于简易时钟的设计》由会员分享,可在线阅读,更多相关《基于简易时钟的设计(7页珍藏版)》请在金锄头文库上搜索。

1、简易时钟的设计1. 分频电路的设计-实体名:fen100-功 能:对输入时钟进行 24000 分频,得到 100Hz 信号,- 作为数码显示管位扫描信号-接 口:clk -时钟输入- qout-100Hz 输出信号-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen100 isport(clk:in std_logic;rst:in std_logic;qout:out std_logic);end fen100;arch

2、itecture behave of fen100 isconstant counter_len:integer:=23999;beginprocess(clk,rst)variable cnt:integer range 0 to counter_len;beginif(rst=0)thencnt:=0;elsif clkevent and clk=1 thenif cnt=counter_len thencnt:=0;elsecnt:=cnt+1;end if;case cnt is when 0 to counter_len/2=qoutqoutqoutqout=1;end case;e

3、nd if;end process;end behave;2.60 进制-功 能:60 进制计数器-接 口:clk -时钟输入- qout1-个位 BCD 输出- qout2-十位 BCD 输出- carry-进位信号输出-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen60 is port(clk : in std_logic;rst : in std_logic;qout1 : out std_logic_vecto

4、r(3 downto 0);qout2 : out std_logic_vector(3 downto 0);carry : out std_logic);end fen60;architecture behave of fen60 issignal tem1:std_logic_vector(3 downto 0);signal tem2:std_logic_vector(3 downto 0);beginprocess(clk,rst)beginif(rst=0)thentem1=0000;tem2=0000;elsif clkevent and clk=1 then if tem1=10

5、01 thentem1=0000;if tem2=0101 thentem2=0000;carry=1;elsetem2=tem2+1;carry=0; end if;elsetem1=tem1+1;end if;end if;qout1=tem1;qout2=tem2;end process;end behave; 3.24 进制的设计library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen24 is port(clk : i

6、n std_logic;rst : in std_logic;qout1 : out std_logic_vector(3 downto 0);qout2 : out std_logic_vector(3 downto 0);carry : out std_logic);end fen24;architecture behave of fen24 issignal tem1:std_logic_vector(3 downto 0);signal tem2:std_logic_vector(3 downto 0);beginprocess(clk,rst)beginif(rst=0)thente

7、m1=0010;tem2=0001;elsif clkevent and clk=1 then if (tem2=0010 and tem1=0011) thentem1=0000;tem2=0000;carry=1;elsecarry=0;if tem1=1001 thentem1=0000;if tem2=1001 then tem2=0000;elsetem2=tem2+1;end if;elsetem1=tem1+1;end if;end if;end if;qout1=tem1;qout2=tem2;end process;end behave; 4.数码管显示library iee

8、e;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen24 is port(clk : in std_logic;rst : in std_logic;qout1 : out std_logic_vector(3 downto 0);qout2 : out std_logic_vector(3 downto 0);carry : out std_logic);end fen24;architecture behave of fen24 issign

9、al tem1:std_logic_vector(3 downto 0);signal tem2:std_logic_vector(3 downto 0);beginprocess(clk,rst)beginif(rst=0)thentem1=0010;tem2=0001;elsif clkevent and clk=1 then if (tem2=0010 and tem1=0011) thentem1=0000;tem2=0000;carry=1; elsecarry=0;if tem1=1001 thentem1=0000;if tem2=1001 thentem2=0000;elset

10、em2=tem2+1;end if;elsetem1=tem1+1;end if;end if;end if;qout1=tem1;qout2=tem2;end process;end behave; 5.数码管显示编码library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen24 is port(clk : in std_logic;rst : in std_logic;qout1 : out std_logic_vector(

11、3 downto 0);qout2 : out std_logic_vector(3 downto 0);carry : out std_logic);end fen24;architecture behave of fen24 issignal tem1:std_logic_vector(3 downto 0);signal tem2:std_logic_vector(3 downto 0);beginprocess(clk,rst)beginif(rst=0)thentem1=0010;tem2=0001; elsif clkevent and clk=1 then if (tem2=00

12、10 and tem1=0011) thentem1=0000;tem2=0000;carry=1;elsecarry=0;if tem1=1001 thentem1=0000;if tem2=1001 thentem2=0000;elsetem2=tem2+1;end if;elsetem1=tem1+1;end if;end if;end if;qout1=tem1;qout2=tem2;end process;end behave; 6.系统的整体设计VCCclk INPUTGNDrst INPUTsel5.0OUTPUTseg6.0OUTPUTclkrst qoutfen100inst2clkrst qoutfen1instclkrst qout13.0qout23.0carryfen60inst3clkrst qout13.0qout23.0carryfen60inst7clkrst qout13.0qout23.0carryfen24inst4clkrstqin13.0qin23.0qin33.0qin43.0qin53.0qin63.0qout3.0sel5.0selinst5qin3.0 qout6.0decode47inst67位位位位位位位位位位40MHz位位位位

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 活动策划

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号