Facebook
From Edgy Frog, 3 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 131
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    10:37:46 03/12/2018
  6. -- Design Name:
  7. -- Module Name:    VGA_1 - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. use IEEE.STD_LOGIC_ARITH.ALL;
  23. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  24. -- Uncomment the following library declaration if using
  25. -- arithmetic functions with Signed or Unsigned values
  26. --use IEEE.NUMERIC_STD.ALL;
  27.  
  28. -- Uncomment the following library declaration if instantiating
  29. -- any Xilinx primitives in this code.
  30. --library UNISIM;
  31. --use UNISIM.VComponents.all;
  32.  
  33. entity VGA_1 is
  34.     Port ( Clk_50MHz : in  STD_LOGIC;
  35.            red_out : out  STD_LOGIC;
  36.            green_out : out  STD_LOGIC;
  37.            blue_out : out  STD_LOGIC;
  38.            VGA_HS : out  STD_LOGIC;
  39.                    test : in  STD_LOGIC;
  40.            VGA_VS : out  STD_LOGIC);
  41. end VGA_1;
  42.  
  43. architecture Behavioral of VGA_1 is
  44. signal licznik : std_logic_vector (31 downto 0);
  45. signal horizontal_counter : std_logic_vector (10 downto 0);
  46. signal vertical_counter : std_logic_vector (10 downto 0);
  47. begin
  48. process (Clk_50MHz) begin
  49. if Clk_50MHz'event and Clk_50MHz = '1' then
  50.                         horizontal_counter <= horizontal_counter+"00000000001";
  51.         if (horizontal_counter="10000010000") then
  52.                 vertical_counter <= vertical_counter+"00000000001";
  53.                 horizontal_counter <= "00000000000";
  54.         end if;
  55.         if (vertical_counter="01010011010") then
  56.                 vertical_counter <= "00000000000";
  57.         end if;
  58. end if;
  59. if (horizontal_counter > "00000000000" ) and (horizontal_counter < "00001111001" ) then
  60.         VGA_HS <= '0';
  61. else
  62.         VGA_HS <= '1';
  63. end if;
  64. if (vertical_counter > "00000000000" )and (vertical_counter < "00000000111" )then
  65.         VGA_VS <= '0';
  66. else
  67.         VGA_VS <= '1';
  68. end if;
  69. if(horizontal_counter < "00101101101" ) or(horizontal_counter > "01001100111" or (vertical_counter > "00111110100" ) ) then
  70. red_out <= '0';
  71. green_out <= '0';
  72. blue_out <= '0';
  73. else
  74.         red_out <= '1';
  75.         green_out <= '1';
  76.         blue_out <= '1';
  77. end if;
  78. end process;
  79. end Behavioral;
  80.  
  81.