Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 11/25/2015 03:03:03 PM
  6. -- Design Name:
  7. -- Module Name: Screen_Write - 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.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx leaf cells in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity Screen_Write is
  35. Port ( CLK : in STD_LOGIC;
  36. X : in STD_LOGIC;
  37. Y : in STD_LOGIC;
  38. VISIBLE : in STD_LOGIC;
  39. DE : out STD_LOGIC; --Display Enable enkel hoog wanneer visible
  40. RED : out STD_LOGIC_VECTOR(7 downto 0);
  41. BLUE : out STD_LOGIC_VECTOR(5 downto 0);
  42. GREEN : out STD_LOGIC_VECTOR(7 downto 2));
  43. end Screen_Write;
  44.  
  45. architecture Behavioral of Screen_Write is
  46.  
  47. component H_SYNC is
  48. Port ();
  49. end component;
  50.  
  51. component V_SYNC is
  52. Port ();
  53. end component
  54.  
  55. begin
  56. h_sync_proc: H_SYNC port map (
  57. v_sync_proc: V_SYNC port map (
  58. draw_background: process(VISIBLE)
  59. begin
  60. if (VISIBLE = 0) then --Outside of the visible screen, draw black
  61. RED <= "00000000";
  62. BLUE <= "000000";
  63. GREEN <= "000000";
  64. end if;
  65. end process
  66.  
  67. draw_square: process(VISIBLE, X, Y)
  68. variable X1 : integer range 1 to 480 := 120;
  69. variable Y1 : integer range 1 to 272 := 68;
  70. variable X2 : integer range 1 to 480 := 360;
  71. variable Y2 : integer range 1 to 272 : 204;
  72. begin
  73. if(VISIBLE = 1)
  74. if ((X > (X1-1) and X < (X2+1))
  75. and (Y > (Y1-1) and Y < (Y2+1))) then
  76. RED <= "11111111";
  77. BLUE <= "000000";
  78. GREEN <= "000000";
  79.  
  80. else
  81. RED <= "11111111";
  82. BLUE <= "111111";
  83. GREEN <= "111111";
  84. end if;
  85. end if;
  86.  
  87.  
  88. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement