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

📄 picoblaze_trafficlight.vhd

📁 此为VHDL实现的路口红绿灯控制例子
💻 VHD
字号:
--------------------------------------------------------------------------------
-- Company:			Steepest Ascent
-- Engineer:		James A Bowman
--
-- Create Date:   
-- Design Name:   picoblaze_traffic_light  
-- Module Name:   picoblaze_trafficlight - Connectivity
-- Project Name:  XUP- PicoBlaze Traffic Light Example 
-- Target Device: XILINX Virtex II Pro XC2VP30
-- Tool versions:  
-- Description:
--
-- Dependencies:
-- 
-- Revision:		Version 1.1
-- Additional 
-- Comments:		Adapted to compensate for adjustment to PicoBlazeInput
--				      i.e increase in input bus width to 8 bits
-- 
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity PicoBlaze_TrafficLight is
    Port ( btn1_in : in std_logic;
	 		  btn2_in : in std_logic;
           clk     : in std_logic;
           reset   : in std_logic;
           led_out : out std_logic_vector(7 downto 0));
end PicoBlaze_TrafficLight;


architecture Connectivity of PicoBlaze_TrafficLight is
--
-- declaration of PicoBlazeInput
--
	component PicoBlazeInput
		port ( input_0 	: in std_logic_vector(7 downto 0);
           	 input_1 	: in std_logic_vector(7 downto 0);
           	 input_2 	: in std_logic_vector(7 downto 0);
           	 input_3    : in std_logic_vector(7 downto 0);
			  	 clk	      : in std_logic;
           	 input_id   : in std_logic_vector(7 downto 0);
           	 input_data : out std_logic_vector(7 downto 0));
	end component;
--
-- declaration of embedded_kcpsm3
--
	component embedded_kcpsm3
		port ( in_port       : in std_logic_vector(7 downto 0);
             interrupt     : in std_logic;
				 reset         : in std_logic;
             clk           : in std_logic;
				 port_id       : out std_logic_vector(7 downto 0);
             write_strobe  : out std_logic;
             read_strobe   : out std_logic;
             out_port      : out std_logic_vector(7 downto 0);
             interrupt_ack : out std_logic);
	end component;
--
-- declaration of PicoBlazeOutput
--
	component PicoBlazeOutput
		port ( output_data : in std_logic_vector(7 downto 0);
           	 clk 		    : in std_logic;	 		  
           	 output_id   : in std_logic_vector(7 downto 0);
           	 output_we   : in std_logic;
				 output_0    : out std_logic_vector(7 downto 0);
			  	 output_1	 : out std_logic_vector(7 downto 0);
	 	 	  	 output_2    : out std_logic_vector(7 downto 0);
			  	 output_3    : out std_logic_vector(7 downto 0));
	end component;
--
-- declaration of seconddelay
--
	component seconddelay
		port ( delay_count   : in std_logic_vector(6 downto 0);
             delay_enable  : in std_logic;
			    clk           : in std_logic;
				 reset         : in std_logic;
             delay_elapsed : out std_logic);
	end component;

signal 	 data_id	      : std_logic_vector(7 downto 0);
signal    data_input    : std_logic_vector(7 downto 0);
signal    data_write	   : std_logic;
signal    data_output   : std_logic_vector(7 downto 0);
signal    reset_n       : std_logic;
signal	 delay_elapsed : std_logic;
signal	 delay_count   : std_logic_vector(7 downto 0);
signal	 resetsys		: std_logic_vector(7 downto 0);
signal    pedbutton     : std_logic_vector(7 downto 0);
signal	 delayelap		: std_logic_vector(7 downto 0);
signal	 ped_out       : std_logic_vector(7 downto 0);
signal	 light_out     : std_logic_vector(7 downto 0);

begin
	reset_n <= not(reset);
		
	 INPUT: PicoBlazeInput
	 port map(    input_0 => resetsys,
	              input_1 => pedbutton,
					  input_2 => delayelap,
				     input_3 => "00000000",
	                  clk => clk,
				    input_id => data_id,
				  input_data => data_input);

	 OUTPUT: PicoBlazeOutput
	 port map (		output_0 => ped_out,
	 					output_1 => light_out,
						output_2 => delay_count,
	 				output_data => data_output,
					  output_id => data_id,
						     clk => clk,
					  output_we => data_write);

	 SYSTEM: embedded_kcpsm3
	 port map (      port_id => data_id,
               write_strobe => data_write,
                   out_port => data_output,
                    in_port => data_input,
                        clk => clk,
			         interrupt => '0',
				          reset => reset_n);

	 DELAY: seconddelay
	 port map (   delay_count => delay_count(6 downto 0),
	 				 delay_enable => delay_count(7),
					          clk => clk,
					        reset => reset,
					delay_elapsed => delay_elapsed);

	--Input Devices Single Bit (Active Low)
	resetsys  <= "0000000"&(not(btn1_in));
	pedbutton <= "0000000"&(not(btn2_in));
	delayelap <= "0000000"&(not(delay_elapsed));	

	--Light Ouputs (Active Low)
   led_out(3) <= not(ped_out(0));
	led_out(2 downto 0) <= not(light_out(2 downto 0));
	led_out(7 downto 4) <= "0000";

end Connectivity;

⌨️ 快捷键说明

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