countdelay.vhd

来自「此为VHDL实现的路口红绿灯控制例子」· VHDL 代码 · 共 55 行

VHD
55
字号
--------------------------------------------------------------------------------
-- Company:			Steepest Ascent
-- Engineer:		James A Bowman
--
-- Create Date:   
-- Design Name:   picoblaze_traffic_light  
-- Module Name:   countdelay - Behavioral
-- Project Name:  XUP- PicoBlaze Traffic Light Example 
-- Target Device: XILINX Virtex II Pro XC2VP30
-- Tool versions:  
-- Description:
--
-- Dependencies:
-- 
-- Revision:		Version 1.0
-- Additional 
-- Comments:		None
-- 
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


entity countdelay is
    Port ( delay_count   : in std_logic_vector(6 downto 0);
           delay_enable  : in std_logic;
			  clk           : in std_logic;
           delay_elapsed : out std_logic);
end countdelay;


architecture Behavioral of countdelay is

signal qTEMP: unsigned(6 downto 0);
	 
begin

	process (clk, delay_enable)
		begin 
			if (delay_enable = '0') then			-- If Device not Enabled
				qTEMP <= unsigned(delay_count);
				delay_elapsed <= '1';
			elsif rising_edge(clk) then			-- If Enabled
				if (qTEMP = 0000000) then		   -- If Delay Elapsed
					delay_elapsed <= '0';			--- Active Low
				elsif delay_enable = '1' then
					qTEMP <= qTEMP - 1;
					delay_elapsed <= '1';
				end if;
			end if;
	end process;

end Behavioral;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?