期末大作业 数字秒表设计
实验任务及要求
设计用于体育比赛用的数字秒表,要求:
及时精度大雨1/1000秒,计数器能显示1/1000秒时间,提供给计时器内部定时的始终频率为12MHz;计数器的最长计时时间为1小时,为此需要一个7位的显示器,。
2、设计有复位和起/停开关。
(1)、复位开关用来使计时器清零,并做好计时准备。
(2)、起/停开关的使用方法与传统的机械式计数器相同,即按一下起/停开关,启动计时器开始计时,再按一下起/停开关计时终止。
(3)、复位开关可以在任何情况下使用,即使在计时过程中,只要按一下复位开关,计时进程理科终止,并对计时器清零。
3、采用层次设计方法设计符合上述功能要求的数字秒表。
4、对电路进行功能仿真,通过波形确认电路设计是否正确。
5、完成电路传布设计后,通过实验箱下载验证设计的正确性。
二、数字秒表的电路逻辑图
实验内容
时序波形图如下:
顶层程序框图如下:
清零CLR
开关ENA
时钟CLK
十分之一秒
秒个位(10进制)
秒十位(6进制)
分个位(10进制)
分十位(6进制)
闹钟(预置时间)
各功能模块VHDL程序
十分之一秒
library ieee;
use ;
use ;
entity MINSECONDb is
port(clk,clrm,stop:in std_logic;
secm0:out std_logic_vector(3 downto 0);
co:out std_logic);
end MINSECONDb;
architecture SEC of MINSECONDb is
begin
process(clk,clrm)
variable cnt0:std_logic_vector(3 downto 0);
begin
if clrm='1' then
cnt0:="0000";
elsif clk'event and clk='1'then
if stop='0'then
if cnt0="1001" then
co<='1';
cnt0:="0000";
elsif cnt0<"1001" then
cnt0:=cnt0+1;
co<='0';
end if;
else cnt0:=cnt0;
end if;
end if;
secm0<=cnt0;
end process;
end SEC;
秒
library ieee;
use ;
use ;
entity SECOND is
port(clk,clr:in std_logic;
sec1,sec0:out std_logic_vector(3 downto 0);
co:out std_logic);
end SECOND;
architecture SEC of SECOND is
begin
process(clk,clr)
variable cnt1,cnt0:std_logic_vector(3 downto 0);
begin
if clr='1' then
cnt1:="0000";
cnt0:="0000";
elsif clk'event and clk='1' then
if cnt1="0101" and cnt0="1000" then
co<='1';
cnt0:="1001";
elsif cnt0<"1001" then
cnt0:=cnt0+1;
co<='0';
else
cnt0:="0000";
if cnt1<"0101" then
cnt1:=cnt1+1;
else
cnt1:="0000";
co<='0';
end if;
end if;
end if;
sec1<=cnt1;
sec0<=cnt0;
end process;
end SEC;
分
library ieee;
use ;
use ;
entity MINUTE is
port(clk,en
EDA数字秒表设计 来自淘豆网m.daumloan.com转载请标明出处.