⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clockdivider.vhd

📁 此为VHDL实现的路口红绿灯控制例子
💻 VHD
字号:
--------------------------------------------------------------------------------
-- Company:			Steepest Ascent
-- Engineer:		James A Bowman
--
-- Create Date:   
-- Design Name:   picoblaze_traffic_light 
-- Module Name:   clockdivider - 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 clockdivider is
    Port ( clk        : in std_logic;
	 		  reset		 : in std_logic;
           clk_divide : out std_logic);
end clockdivider;


architecture Behavioral of clockdivider is

signal count_val  : std_logic_vector(26 downto 0):= (others => '0');
signal temp_output: std_logic:= '0';

begin

	process(clk, reset)
		begin
			if (reset = '0') then		-- If Reset
				temp_output <= '0';
			elsif rising_edge(clk) then
				
				-- Value set to 49999999 (1/2 of 100 MHz minus 1)
				if (count_val = "10111110101111000001111111") then 	-- Implementation			  
				
				-- Value set to 7 (8 Clock Cycles minus 1)
				--if (count_val = "0000000000000000000000111") then	-- Simulation
				
					count_val <= (others => '0');
					temp_output <= not(temp_output);
				else
					count_val <= count_val + 1;
				end if;
			end if;

			-- Update Output Value
			clk_divide <= temp_output;

	end process;

end Behavioral;

⌨️ 快捷键说明

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