EDA秒表实验报告.doc
文本预览下载声明
《EDA课程设计——秒表》
题 目 数字秒表
学 院 信息学院
专 业 电子信息工程
班 级 11电子A
姓 名 朱彦杰
学 号 1115102061
指导教师 凌朝东
课题名称 秒表 完成时间 11.28 指导教师 凌朝东 学生姓名 朱彦杰 班 级 11电子A 总体设计要求和技术要点 设计要求:
5. 秒表,难度系数0.9
要求:计时范围为0~59 分59 秒,精度为百分之一秒;能同时显示分秒信息(LED 数码管)。
技术要点:
1.利用VHDL语言设计基于计算机电路中时钟脉冲原理的数字秒表。该秒表计时范围为0秒~59分59.99秒,显示的最长时间为59分59秒,计时精度为10毫秒以内,具有复位功能。
2.秒表有共有6个输出显示,分别为百分之一秒、十分之一秒、秒、十秒、分、十分,所以共有6个计数器与之相对应,6个计数器的输出全都为BCD码输出。
一、系统组成模块连接图和系统框图
二、模块器件及其程序
1、分频模块及其程序
本模块实现脉冲分频,本实验使用的EP2C5T144C8的频率计进行50MHz分频产生100HZ的脉冲。
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY fenpin IS
PORT ( CLK: IN STD_LOGIC; OUTCLK: out std_logic );
END fenpin;
ARCHITECTURE behav OF fenpin IS
BEGIN
PROCESS( CLK )
variable cnt:integer range 0 to 500000;
BEGIN
IF CLKEVENT AND CLK = 1 THEN
if cnt=500000 then
cnt:=0;
outclk=1;
else
cnt:=cnt+1;
outclk=0;
end if;
END IF;
END PROCESS;
END behav;
2、十进制程序
产生99毫秒、秒的低位、分的低位的功能。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt10 is
port (CLK,CLR,EN :in std_logic;
CQ :out std_logic_vector(3 downto 0);
COUT:out std_logic );
end cnt10;
architecture behav of cnt10 is
begin
process(CLK,CLR,EN)
variable cqi :std_logic_vector(3 downto 0);
begin
if CLR=1 then cqi :=(others =0); elsif CLKevent and CLK=0 then
if EN=1then
if cqi9 then cqi :=cqi+1;
else cqi := (others =0); end if;
end if;
end if;
if cqi =9 then COUT =1;
else COUT=0;end if;
CQ=cqi;
end process;
end behav;
3、六进制程序
产生秒的高位、分的高位
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt6 is
port (CLK,CLR,EN :in std_logic;
CQ :out std_logic_vector(2 downto 0);
COUT :out std_logic );
end cnt6;
architecture behav of cnt6 is
begin
process(CLK,CLR,EN)
variable cqi :std_logic_vector(2 downto 0);
begin
if CLR=1 then cqi :=(others =0); elsif CLKevent and C
显示全部