--- /dev/null
+-------------------------------------------------------------------------------
+-- Title : vga_control architecture
+-- Project : LU Digital Design
+-------------------------------------------------------------------------------
+-- File : vga_control.vhd
+-- Author : Thomas Handl
+-- Company : TU Wien
+-- Created : 2004-12-15
+-- Last update: 2006-02-24
+-------------------------------------------------------------------------------
+-- Description: generation of colors (RGB)
+-------------------------------------------------------------------------------
+-- Copyright (c) 2004 TU Wien
+-------------------------------------------------------------------------------
+-- Revisions :
+-- Date Version Author Description
+-- 2004-12-15 1.0 handl Created
+-- 2006-02-24 2.0 ST revised
+-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+-- LIBRARIES
+-------------------------------------------------------------------------------
+
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.std_logic_unsigned.all;
+use IEEE.std_logic_arith.all;
+
+use work.vga_pak.all;
+
+-------------------------------------------------------------------------------
+-- ARCHITECTURE
+-------------------------------------------------------------------------------
+
+architecture behav of vga_control is
+
+
+ attribute syn_preserve : boolean;
+ attribute syn_preserve of behav : architecture is true;
+ signal r_next, g_next, b_next : std_logic;
+
+begin
+ DRAW_SQUARE_syn: process(clk, reset)
+ begin
+ if (reset = RES_ACT) then -- draw black screen upon reset
+ r <= COLR_OFF;
+ g <= COLR_OFF;
+ b <= COLR_OFF;
+ elsif (clk'event and clk = '1') then -- synchronous capture
+ r <= r_next;
+ g <= g_next;
+ b <= b_next;
+ end if;
+ end process;
+
+
+ DRAW_SQUARE_next: process (column_counter, v_enable, h_enable)
+ begin
+ if v_enable = ENABLE and h_enable = ENABLE then
+ if (column_counter >= X_MIN and column_counter < X2_MIN) then -- if pixel within the rectangle borders
+ r_next <= COLR_OFF;
+ g_next <= COLR_OFF;
+ b_next <= COLR_ON;
+ elsif (column_counter >= X2_MIN and column_counter < X3_MIN) then -- if pixel within the rectangle borders
+ r_next <= COLR_OFF;
+ g_next <= COLR_ON;
+ b_next <= COLR_ON;
+ elsif (column_counter >= X3_MIN and column_counter < X_MAX) then -- if pixel within the rectangle borders
+ r_next <= COLR_ON;
+ g_next <= COLR_OFF;
+ b_next <= COLR_ON;
+ else -- if somewhere else on screen...
+ r_next <= COLR_OFF;
+ g_next <= COLR_OFF; -- ... draw background color
+ b_next <= COLR_OFF;
+ end if;
+ else -- if out of screen...
+ r_next <= COLR_OFF;
+ g_next <= COLR_OFF; -- ... do not activate any color
+ b_next <= COLR_OFF; -- (black screen)
+ end if;
+ end process;
+
+end behav;
+
+-------------------------------------------------------------------------------
+-- END ARCHITECTURE
+-------------------------------------------------------------------------------