VHDL的数字钟分频器和七段码显示代码.doc
上传人:yy****24 上传时间:2024-09-10 格式:DOC 页数:5 大小:37KB 金币:16 举报 版权申诉
预览加载中,请您耐心等待几秒...

VHDL的数字钟分频器和七段码显示代码.doc

VHDL的数字钟分频器和七段码显示代码.doc

预览

在线预览结束,喜欢就下载吧,查找使用更方便

16 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

数字钟中几个重要部分设计,分频器和七段码显示代码6分频器用于数字钟的分钟十位和秒数的十位计数------------6分频器------------libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entityfp6isport(ckin,reset:instd_logic;clkout:outstd_logic;q:outstd_logic_vector(2downto0));endfp6;architectureBehavioraloffp6issignalclk_tmp:std_logic:='0';signalcount:std_logic_vector(2downto0):="100";beginprocess(reset,ckin)beginif(reset='0')thenif(ckin'eventandckin='1')thenif(count="101")thencount<="000";clk_tmp<=notclk_tmp;elsif(count="100")thenclk_tmp<=notclk_tmp;count<=count+1;elsecount<=count+1;endif;endif;endif;endprocess;clkout<=clk_tmp;q<=count;endBehavioral;10分频器用于数字钟的分钟个位和秒数个位计数-----------10分频器------------libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entityfp10isport(ckin,reset:instd_logic;clkout:outstd_logic;q:outstd_logic_vector(3downto0));endfp10;architectureBehavioraloffp10issignalclk_tmp:std_logic:='0';signalcount:std_logic_vector(3downto0):="0111";beginprocess(reset,ckin)beginif(reset='0')thenif(ckin'eventandckin='1')thenif(count="1001")thencount<="0000";clk_tmp<=notclk_tmp;elsif(count="1000")thenclk_tmp<=notclk_tmp;count<=count+1;elsecount<=count+1;endif;endif;endif;endprocess;clkout<=clk_tmp;q<=count;endBehavioral;24分频器用于数字钟的小时计数(两个代码)代码一:------------24分频器-------------libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entityfp24isport(ckin:instd_logic;clkout:outstd_logic;counts:outstd_logic_vector(1downto0);countg:outstd_logic_vector(3downto0));endfp24;architectureBehavioraloffp24issignalclk_tmp:std_logic:='0';signalcount10:std_logic_vector(1downto0):="01";signalcount1:std_logic_vector(3downto0):="1000";beginprocess(ckin)beginif(ckin'eventandckin='1')thenif(count10="10"andcount1="0011")thencount10<="00";count1<="0000";clk_tmp<=notclk_tmp;elsif(count10="10"