----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 09:08:40 11/30/2011
-- Design Name:
-- Module Name: bounce - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.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 bounce is
Port ( clkin : in STD_LOGIC;
syncVInt : inout STD_LOGIC;
syncHInt : inout STD_LOGIC;
rgbout : out STD_LOGIC_VECTOR (7 downto 0));
end bounce;
architecture Behavioral of bounce is
signal cTickLine: STD_LOGIC_VECTOR (9 DOWNTO 0) := "0000000000";
signal cTickPixel: STD_LOGIC_VECTOR (9 DOWNTO 0) := "0000000000";
signal clkdiv: STD_LOGIC :='0';
signal clkdiv_2: STD_LOGIC :='0';
--signal syncVInt: STD_LOGIC :='0';
--signal syncHInt: STD_LOGIC :='0';
constant cTickLineChk: STD_LOGIC_VECTOR (9 DOWNTO 0) :="1000001001";
constant cTickPixelChk: STD_LOGIC_VECTOR (9 DOWNTO 0) :="1100100000";
constant cTickVsyncPulseChk: STD_LOGIC_VECTOR (1 DOWNTO 0) :="10";
constant cTickHsyncPulseChk: STD_LOGIC_VECTOR (6 DOWNTO 0) :="1100000";
signal cTickPorchleft: STD_LOGIC_VECTOR(9 DOWNTO 0) := "0000000000";
signal cTickPorchTop: STD_LOGIC_VECTOR(9 DOWNTO 0) := "0000000000";
signal dBoxTopLeftX: STD_LOGIC_VECTOR(9 DOWNTO 0) := "00" + cTickPorchleft;
signal dBoxTopLeftY: STD_LOGIC_VECTOR(9 DOWNTO 0) := "00000" + cTickPorchTop;
constant dBoxHeight: STD_LOGIC_VECTOR(6 DOWNTO 0) :="1001011";
constant dBoxWidth: STD_LOGIC_VECTOR(6 DOWNTO 0) :="1001011";
signal fmovingleft: STD_LOGIC :='0';
signal fmovingup: STD_LOGIC :='0';
signal rgbcolor: STD_LOGIC_VECTOR(7 DOWNTO 0) := "11111111";
signal alter: STD_LOGIC := '0';
begin
process(clkin)
begin
if(clkin'event and clkin = '1') then
clkdiv <= not clkdiv;
end if;
end process;
process(clkdiv)
begin
if(clkdiv'event and clkdiv = '1') then
clkdiv_2 <= not clkdiv_2;
end if;
end process;
process(clkdiv_2)
begin
if(clkdiv_2'event and clkdiv_2 = '1') then
if(cTickLine = cTickLineChk - 1) then
syncVInt <= '1';
cTickLine <="0000000000";
end if;
if(cTickPixel = cTickPixelChk - 1) then
syncHInt <= '1';
cTickPixel <="0000000000";
cTickLine <= cTickLine + 1;
else cTickPixel <= cTickPixel + 1;
end if;
if(syncVInt = '1') then
if(cTickLine = cTickVsyncPulseChk) then
syncVInt <= '0';
end if;
end if;
if(syncHInt = '1') then
if(cTickPixel + 1 = cTickHsyncPulseChk) then
syncHInt <= '0';
end if;
end if;
if((cTickPixel >= dBoxTopLeftX) and (cTickPixel < dBoxTopLeftX+dBoxWidth)
and (cTickLine >= dBoxTopLeftY) and (cTickLine < dBoxTopLeftY+dBoxHeight)) then
rgbout <= "11111111";
else rgbout <= "00000000";
end if;
end if;
end process;
--if(cTickPixel = "0000000001" and cTickLine = "0000000001") then
end Behavioral;