1 -------------------------------------------------------------------------------
\r
2 -- Title : vga package
\r
3 -- Project : LU Digital Design
\r
4 -------------------------------------------------------------------------------
\r
5 -- File : vga_pak.vhd
\r
6 -- Author : Thomas Handl
\r
8 -- Created : 2004-08-19
\r
9 -- Last update: 2006-02-24
\r
10 -------------------------------------------------------------------------------
\r
11 -- Description: definitions of global constants and enumerated types
\r
12 -------------------------------------------------------------------------------
\r
13 -- Copyright (c) 2004 TU Wien
\r
14 -------------------------------------------------------------------------------
\r
16 -- Date Version Author Description
\r
17 -- 2004-08-19 1.0 handl Created
\r
18 -- 2006-02-24 2.0 ST revised
\r
19 -------------------------------------------------------------------------------
\r
21 -------------------------------------------------------------------------------
\r
23 -------------------------------------------------------------------------------
\r
26 use IEEE.std_logic_1164.all;
\r
27 use IEEE.std_logic_unsigned.all;
\r
28 use IEEE.std_logic_arith.all;
\r
31 -------------------------------------------------------------------------------
\r
33 -------------------------------------------------------------------------------
\r
37 constant RES_ACT : std_logic := '0'; -- define reset active LO
\r
38 constant ENABLE : std_logic := '1'; -- define diverse enable HI
\r
39 constant COLR_ON : std_logic := '1'; -- define VGA color on as HI
\r
40 constant COLR_OFF : std_logic := '0'; -- define VGA color off as LO
\r
41 constant SEG_WIDTH : integer := 7; -- display has 7 segments
\r
42 constant BCD_WIDTH : integer := 4; -- BCD number has 4 bit
\r
43 constant TOG_CNT_WIDTH : integer := 25; -- bitwidth of counter that controls blinking
\r
45 constant COL_CNT_WIDTH : integer := 10; -- width of the column counter
\r
46 constant LINE_CNT_WIDTH : integer := 9; -- width of the line counter
\r
47 constant HSYN_CNT_WIDTH : integer := 10; -- width of the h-sync counter
\r
48 constant VSYN_CNT_WIDTH : integer := 10; -- width of the v-sync counter
\r
50 constant RIGHT_BORDER: std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "1001111111"; -- 640 columns (0...639)
\r
51 constant BOTTOM_BORDER: std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "111011111"; -- 480 lines (0...479)
\r
53 -- define coordinates of rectangle
\r
54 constant X_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0001100100"; -- 100
\r
55 constant X_MAX : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0011001000"; -- 200
\r
56 constant Y_MIN : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "001100100";
\r
57 constant Y_MAX : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "011001000";
\r
59 -- define emumerated types for state machines
\r
60 type hsync_state_type is (RESET_STATE, B_STATE, C_STATE, D_STATE, E_STATE,
\r
61 pre_D_STATE, pre_B_STATE);
\r
62 type vsync_state_type is (RESET_STATE, P_STATE, Q_STATE, R_STATE, S_STATE,
\r
63 pre_R_STATE, pre_P_STATE);
\r
65 -- Definitions for 7-segment display gfedcba
\r
66 constant DIGIT_ZERO : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000000";
\r
67 constant DIGIT_ONE : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111001";
\r
68 constant DIGIT_TWO : std_logic_vector(SEG_WIDTH-1 downto 0) := "0100100";
\r
69 constant DIGIT_THREE : std_logic_vector(SEG_WIDTH-1 downto 0) := "0110000";
\r
70 constant DIGIT_FOUR : std_logic_vector(SEG_WIDTH-1 downto 0) := "0011001";
\r
71 constant DIGIT_FIVE : std_logic_vector(SEG_WIDTH-1 downto 0) := "0010010";
\r
72 constant DIGIT_SIX : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000010";
\r
73 constant DIGIT_SEVEN : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111000";
\r
74 constant DIGIT_EIGHT : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000000";
\r
75 constant DIGIT_NINE : std_logic_vector(SEG_WIDTH-1 downto 0) := "0011000";
\r
76 constant DIGIT_MINUS : std_logic_vector(SEG_WIDTH-1 downto 0) := "0111111";
\r
77 constant DIGIT_A : std_logic_vector(SEG_WIDTH-1 downto 0) := "0001000";
\r
78 constant DIGIT_B : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000011";
\r
79 constant DIGIT_C : std_logic_vector(SEG_WIDTH-1 downto 0) := "0110001";
\r
80 constant DIGIT_D : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000010";
\r
81 constant DIGIT_E : std_logic_vector(SEG_WIDTH-1 downto 0) := "1001111";
\r
82 constant DIGIT_F : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000111";
\r
83 constant DIGIT_OFF : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111111";
\r