bsp3: erster versuch
[dide_16.git] / bsp3 / Angabe / 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
42
43   DRAW_SQUARE_syn: process(clk, reset)
44   begin
45     if (reset = RES_ACT) then   -- draw black screen upon reset
46       r <= COLR_OFF;
47       g <= COLR_OFF;
48       b <= COLR_OFF;
49     elsif (clk'event and clk = '1') then     -- synchronous capture
50       r <= r_next;
51       g <= g_next;
52       b <= b_next;
53     end if;
54   end process;
55
56
57   DRAW_SQUARE_next: process (column_counter, v_enable, h_enable)
58   begin
59     if v_enable = ENABLE and h_enable = ENABLE then        
60       if (column_counter >= X_MIN and column_counter < X2_MIN)    -- if pixel within the rectangle borders
61         r_next <= COLR_OFF;
62         g_next <= COLR_OFF;
63         b_next <= COLR_ON;
64       elsif (column_counter >= X2_MIN and column_counter < X3_MIN)    -- if pixel within the rectangle borders
65         r_next <= COLR_OFF;
66         g_next <= COLR_ON;
67         b_next <= COLR_ON;
68           elsif (column_counter >= X3_MIN and column_counter < X_MAX)    -- if pixel within the rectangle borders
69         r_next <= COLR_ON;
70         g_next <= COLR_OFF;
71         b_next <= COLR_ON;
72       else                                                           -- if somewhere else on screen...
73         r_next <= COLR_OFF;
74         g_next <= COLR_OFF;                                          -- ... draw background color
75         b_next <= COLR_OFF;
76       end if;
77     else                                                             -- if out of screen...
78       r_next <= COLR_OFF;
79       g_next <= COLR_OFF;                                            -- ... do not activate any color
80       b_next <= COLR_OFF;                                            --     (black screen)
81     end if;
82   end process;
83
84 end behav;
85
86 -------------------------------------------------------------------------------
87 -- END ARCHITECTURE
88 -------------------------------------------------------------------------------