---------------------------------------------------------------------------------- -- Company: Cal Poly SLO -- Engineer: Neal Nguyen & Bryan Bellin -- -- Create Date: 14:35:50 11/30/2014 -- Design Name: Game Decoder -- Module Name: game_dec - Behavioral -- Project Name: Bit Runner -- Target Devices: Nexys 3 -- -- Description: Determine whether the player is hit by the block and if the game -- is over. ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity game_dec is Port ( dodge : in STD_LOGIC; clk : in STD_LOGIC; div_factor : in STD_LOGIC_VECTOR(27 downto 0); obstacle : in STD_LOGIC; hit : out STD_LOGIC); end game_dec; architecture Behavioral of game_dec is component clk_div1 Port ( clk : in std_logic; div_factor : in std_logic_vector(27 downto 0); sclk : out std_logic); end component; signal new_clk : std_logic; begin my_clk_div1: clk_div1 port map (clk => clk, div_factor => div_factor, sclk => new_clk); process(new_clk, obstacle, dodge) begin if(rising_edge(new_clk)) then --if on the shifting of the lights, the player and the obstacle are --at the same spot, and the player isn't dodging --then tell the game that they've been hit if(obstacle = '1' and dodge = '0') then hit <= '1'; else hit <= '0'; end if; end if; end process; end Behavioral;