欢迎来到天天文库
浏览记录
ID:58584656
大小:821.06 KB
页数:13页
时间:2020-10-19
《基于VHDL语言的EDA实验报告(附源码).docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、EDA实验报告——多功能电子钟姓名:张红义班级:10级电科五班学号:指导老师:贾树恒电子钟包括:主控模块,计时模块,闹钟模块,辅控模块,显示模块,蜂鸣器模块,分频器模块。1.主控模块:主要功能:控制整个系统,输出现在的状态,以及按键信息。源代码:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;entitymcisport(functionswitch,k,set,lightkey:instd_logic;chose2
2、1,setout:outstd_logic;lightswitch:bufferstd_logic;modeout,kmodeout:outstd_logic_vector(1downto0);setcs,setcm,setch,setas,setam,setah:outstd_logic);endmc;architectureworkofmcissignalmode,kmode:std_logic_vector(1downto0);signallight,chose21buf:std_logic;signalsetcount:std_logic_vector(
3、5downto0);beginprocess(functionswitch,k,set,lightkey)beginiffunctionswitch'eventandfunctionswitch='1'thenmode<=mode+'1';endif;iflightkey'eventandlightkey='1'thenlightswitch<=notlightswitch;endif;ifmode="01"thenchose21buf<='0';elsechose21buf<='1';endif;ifk'eventandk='1'thenifmode="01"
4、ormode="11"thenkmode<=kmode+'1';endif;endif;ifset='1'thenifmode="01"thenifkmode="01"thensetcount<="";elsifkmode="10"thensetcount<="";elsifkmode="11"thensetcount<="";elsesetcount<="";endif;elsifmode="11"thenifkmode="01"thensetcount<="";elsifkmode="10"thensetcount<="";elsifkmode="11"th
5、ensetcount<="";elsesetcount<="";endif;endif;endif;ifset='0'thensetcount<="00000”;endif;setout<=set;modeout<=mode;kmodeout<=kmode;chose21<=chose21buf;setcs<=setcount(0);setcm<=setcount(1);setch<=setcount(2);setas<=setcount(3);setam<=setcount(4);setah<=setcount(5);endprocess;endwork;仿真
6、波形:2.计时模块主要功能:记录时间,正常计时。60进制libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;entitycount60isport(clk,clr:instd_logic;co:outstd_logic;outh:outstd_logic_vector(7downto4);outl:outstd_logic_vector(3downto0));endcount60;architectureworkofco
7、unt60issignalbufh:std_logic_vector(7downto4);signalbufl:std_logic_vector(3downto0);beginprocess(clk)beginifclr='0'thenbufh<="0000";bufl<="0000";elsif(clk'eventandclk='1')thenif(bufh="0101"andbufl="1001")thenco<='1';bufh<="0000";bufl<="0000";elsif(bufl="1001")thenbufl<="0000";bufh<=bu
8、fh+1;elsebuf
此文档下载收益归作者所有