基于简易时钟的设计

上传人:仙*** 文档编号:27589255 上传时间:2021-08-19 格式:DOC 页数:7 大小:49KB
返回 下载 相关 举报
基于简易时钟的设计_第1页
第1页 / 共7页
基于简易时钟的设计_第2页
第2页 / 共7页
基于简易时钟的设计_第3页
第3页 / 共7页
点击查看更多>>
资源描述
简易时钟的设计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;architecture behave of fen100 isconstant counter_len:integer:=23999;begin process(clk,rst) variable cnt:integer range 0 to counter_len; begin if(rst=0)then cnt:=0; elsif clkevent and clk=1 then if cnt=counter_len then cnt:=0; else cnt:=cnt+1; end if; case cnt is when 0 to counter_len/2=qoutqoutqoutqout=1; end case; end 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_vector(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);begin process(clk,rst) begin if(rst=0)then tem1=0000; tem2=0000; elsif clkevent and clk=1 then if tem1=1001 then tem1=0000; if tem2=0101 then tem2=0000; carry=1; else tem2=tem2+1; carry=0; end if; else tem1=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 : 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 issignal tem1:std_logic_vector(3 downto 0);signal tem2:std_logic_vector(3 downto 0);begin process(clk,rst) begin if(rst=0)then tem1=0010; tem2=0001; elsif clkevent and clk=1 then if (tem2=0010 and tem1=0011) then tem1=0000; tem2=0000; carry=1; else carry=0; if tem1=1001 then tem1=0000; if tem2=1001 then tem2=0000; else tem2=tem2+1; end if; else tem1=tem1+1; end if; end if; end if; qout1=tem1; qout2=tem2; end process;end behave; 4.数码管显示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(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);begin process(clk,rst) begin if(rst=0)then tem1=0010; tem2=0001; elsif clkevent and clk=1 then if (tem2=0010 and tem1=0011) then tem1=0000; tem2=0000; carry=1; else carry=0; if tem1=1001 then tem1=0000; if tem2=1001 then tem2=0000; else tem2=tem2+1; end if; else tem1=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(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);begin process(clk,rst) begin if(rst=0)then tem1=0010; tem2=0001; elsif clkevent and clk=1 then if (tem2=0010 and tem1=0011) then tem1=0000; tem2=0000; carry=1; else carry=0; if tem1=1001 then tem1=0000; if tem2=1001 then tem2=0000; else tem2=tem2+1; end if; else tem1=tem1+1; end if; end if; end if; qout1=tem1; qout2=tem2; end process;end behave; 6.系统的整体设计
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 图纸下载 > CAD图纸下载


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!