vhdl秒表

来源:百度知道 编辑:UC知道 时间:2024/06/20 16:55:18
本人现在在做一个1/100S秒表,最长计时时间为1min,用4位显示器有复位,启动,停止3个开关, 复位开关用于使计时器清零,按一下启动开关计时器开始
计数,按一下停止开关计时器停止计数; 复位开关可以在仍何情况下使用,即使
在计时过程中,只要一按复位开关,计时进程应立即停止,并对计时器清零.本人对开关控制这一部分不怎么了解。请高人教我,万分感谢!!!!!

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating

---- any Xilinx primitives in this code.

--library UNISIM;

--use UNISIM.VComponents.all;

entity minutes is

Port ( rst3,selector2,ky_2j : in STD_LOGIC;

B10 : in std_logic;

C : out std_logic;

dat30 : out std_logic_vector(7 downto 0));

end minutes;

architecture Behavioral of minutes is

signal dat31,dat32 : std_logic_vector(7 downto 0):=(others =>'0');

begin

process(rst3,B10,ky_2j)

begin

case selector2 is

when '1' =>dat32<=dat31; if ky_2j'event and ky_2j='1' then

if dat31(7 downt