---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 28.06.2021 09:20:00 -- Design Name: -- Module Name: VGAControler - 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 work.ScreenProperties.all; entity VGAControler is Port ( VGA_RED : out STD_LOGIC_VECTOR (3 downto 0); VGA_BLUE : out STD_LOGIC_VECTOR (3 downto 0); VGA_GREEN : out STD_LOGIC_VECTOR (3 downto 0); VGA_HS : out STD_LOGIC; VGA_VS : out STD_LOGIC; X : out X_T; Y : out Y_T; PIXEL_ON : in STD_LOGIC; CLK : in STD_LOGIC; RST : in STD_LOGIC); end VGAControler; architecture Behavioral of VGAControler is component Compteur_X is Port ( CLK : in STD_LOGIC; RST : in STD_LOGIC; Value : out X_T; Carry : out STD_LOGIC); end component; component Compteur_Y is Port ( CLK : in STD_LOGIC; RST : in STD_LOGIC; Value : out Y_T); end component; signal X_pos : X_T := 0; signal Y_pos : Y_T := 0; signal Y_CLK : STD_LOGIC := '0'; signal active : BOOLEAN := false; begin X_Compteur : Compteur_X port map (CLK => CLK, RST => RST, Value => X_pos, Carry => Y_CLK); Y_Compteur : Compteur_Y port map (CLK => Y_CLK, RST => RST, Value => Y_pos); active <= ((X_pos < screen_width) and (Y_pos < screen_height)); VGA_RED <= "0000" when ((RST = '0') or (not active)) else "1000" when (PIXEL_ON = '0') else "1111"; VGA_BLUE <= "0000" when ((RST = '0') or (not active)) else "1000" when (PIXEL_ON = '0') else "1111"; VGA_GREEN <= "0000" when ((RST = '0') or (not active)) else "1000" when (PIXEL_ON = '0') else "1111"; VGA_HS <= '0' when ((RST = '0') or (X_pos < screen_width + X_FrontPorch) or (X_pos >= screen_width + X_FrontPorch + X_PulseWidth)) else '1'; VGA_VS <= '0' when ((RST = '0') or (Y_pos < screen_height + Y_FrontPorch) or (Y_pos >= screen_height + Y_FrontPorch + Y_PulseWidth)) else '1'; X <= X_pos; Y <= Y_pos; end Behavioral;