4er slot (3. bsp fertig)
[dide_16.git] / bsp3 / Designflow / src / vga_control_arc.vhd
1 -------------------------------------------------------------------------------
2 -- Title      : vga_control architecture
3 -- Project    : LU Digital Design
4 -------------------------------------------------------------------------------
5 -- File       : vga_control.vhd
6 -- Author     : Thomas Handl
7 -- Company    : TU Wien
8 -- Created    : 2004-12-15
9 -- Last update: 2006-02-24
10 -------------------------------------------------------------------------------
11 -- Description: generation of colors (RGB)
12 -------------------------------------------------------------------------------
13 -- Copyright (c) 2004 TU Wien
14 -------------------------------------------------------------------------------
15 -- Revisions  :
16 -- Date        Version  Author  Description
17 -- 2004-12-15  1.0      handl   Created
18 -- 2006-02-24  2.0      ST      revised
19 -------------------------------------------------------------------------------
20
21 -------------------------------------------------------------------------------
22 -- LIBRARIES
23 -------------------------------------------------------------------------------
24
25 library IEEE;
26 use IEEE.std_logic_1164.all;
27 use IEEE.std_logic_unsigned.all;
28 use IEEE.std_logic_arith.all;
29
30 use work.vga_pak.all;
31
32 -------------------------------------------------------------------------------
33 -- ARCHITECTURE
34 -------------------------------------------------------------------------------
35
36 architecture behav of vga_control is
37
38
39   attribute syn_preserve          : boolean;
40   attribute syn_preserve of behav : architecture is true;
41   signal   r_next, g_next, b_next  : std_logic;
42
43 begin
44   DRAW_SQUARE_syn: process(clk, reset)
45   begin
46     if (reset = RES_ACT) then   -- draw black screen upon reset
47       r <= COLR_OFF;
48       g <= COLR_OFF;
49       b <= COLR_OFF;
50     elsif (clk'event and clk = '1') then     -- synchronous capture
51       r <= r_next;
52       g <= g_next;
53       b <= b_next;
54     end if;
55   end process;
56
57
58   DRAW_SQUARE_next: process (column_counter, v_enable, h_enable)
59   begin
60           if v_enable = ENABLE and h_enable = ENABLE then        
61                   if (column_counter >= X_MIN and column_counter < X2_MIN) then   -- if pixel within the rectangle borders
62                           r_next <= COLR_OFF;
63                           g_next <= COLR_OFF;
64                           b_next <= COLR_ON;
65                   elsif (column_counter >= X2_MIN and column_counter < X3_MIN) then   -- if pixel within the rectangle borders
66                           r_next <= COLR_OFF;
67                           g_next <= COLR_ON;
68                           b_next <= COLR_ON;
69                   elsif (column_counter >= X3_MIN and column_counter < X_MAX) then   -- if pixel within the rectangle borders
70                           r_next <= COLR_ON;
71                           g_next <= COLR_OFF;
72                           b_next <= COLR_ON;
73                   else                                                           -- if somewhere else on screen...
74                           r_next <= COLR_OFF;
75                           g_next <= COLR_OFF;                                          -- ... draw background color
76                           b_next <= COLR_OFF;
77                   end if;
78           else                                                             -- if out of screen...
79                   r_next <= COLR_OFF;
80                   g_next <= COLR_OFF;                                            -- ... do not activate any color
81                   b_next <= COLR_OFF;                                            --     (black screen)
82           end if;
83   end process;
84
85 end behav;
86
87 -------------------------------------------------------------------------------
88 -- END ARCHITECTURE
89 -------------------------------------------------------------------------------