------------------------------------------------------------------------ -- BtnDemo.vhd -- Demonstrate D2E On-Board Button and LED ------------------------------------------------------------------------ -- Author: Gene Apperson -- Copyright 2002 Digilent, Inc. ------------------------------------------------------------------------ -- This module is an example to demonstrate the use of the on-board -- button and LED on the D2E board. -- -- Inputs: -- btn - button on the D2E board -- -- Outputs: -- led - discrete LED on the D2E board -- ------------------------------------------------------------------------ -- Revision History: -- 03/31/2002(GeneA): created ------------------------------------------------------------------------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity BtnDemo is Port ( btn : in std_logic; led : out std_logic ); end BtnDemo; architecture Behavioral of BtnDemo is ------------------------------------------------------------------------ -- Component Declarations ------------------------------------------------------------------------ -- System Library Components component IBUFG port ( I : in STD_LOGIC; O : out std_logic ); end component; ------------------------------------------------------------------------ -- Signal Declarations ------------------------------------------------------------------------ signal bnbuf: std_logic; ------------------------------------------------------------------------ -- Module Implementation ------------------------------------------------------------------------ begin -- Instantiate an IBUFG for the button. The button on the D2E board is -- connected to a global clock input. The Xilinx ISE tools will -- automatically insert input and output buffers to connect the signal -- defined in the VHDL modules port. However, for non-clock signals, the -- tool will automatically try to insert an IBUF. This will generate an -- errror, as it isn't possible to instantiate an IBUF on a global clock -- line. To prevent this error, it is necessary to manually instantiate -- a clock input buffer for this line. The output of this buffer can then -- be used as a normal logic signal. U1: IBUFG port map (I => btn, O => bnbuf); -- Connect the D2E button to the D2E LED. The button on the D2E -- is wired to generate a logic 1 when it is pressed. The LED on the -- D2E will illuminate when it is driven with a logic 1. led <= bnbuf; ------------------------------------------------------------------------ end Behavioral;