Here is what I have been using. There is an error with the if statement and I have no idea what it is
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity DE2_top is
Port(
--//////////////////////// Clock Input ////////////////////////
CLOCK_27 :in std_logic; -- 27 MHz
CLOCK_50 :in std_logic; -- 50 MHz
EXT_CLOCK :in std_logic; -- External Clock
-- //////////////////////// Push Button ////////////////////////
KEY :in std_logic_vector( 3 downto 0); --Pushbutton
--//////////////////////// DPDT Switch ////////////////////////
SW :in std_logic_vector( 17 downto 0 ); --Toggle Switch
--//////////////////////// 7-SEG Dispaly ////////////////////////
HEX0 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 0
HEX1 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 1
HEX2 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 2
HEX3 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 3
HEX4 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 4
HEX5 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 5
HEX6 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 6
HEX7 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 7
--//////////////////////////// LED ////////////////////////////
LEDG :out std_logic_vector( 8 downto 0); --LED Green
LEDR :out std_logic_vector( 17 downto 0); --LED Red
--//////////////////////////// LED ////////////////////////////
GPIO_0 :inout std_logic_vector(35 downto 0);
GPIO_1 :inout std_logic_vector(35 downto 0)
);
end DE2_top;
architecture struct of DE2_top is
begin
-- GPIO (expansion headers)
if sw(1) /= '0'then
gpio_0 <= (others => 'Z');
gpio_1(0) <= '1';
gpio_1(1) <= '1';
gpio_1(2) <= '1';
gpio_1(3) <= '1';
else
gpio_1(0) <= '0';
gpio_1(1) <= '0';
gpio_1(2) <= '0';
gpio_1(3) <= '0';
end if;
end;