4er slot (3. bsp fertig)
[dide_16.git] / bsp3 / Designflow / src / vga_pak.vhd
1 -------------------------------------------------------------------------------
2 -- Title      : vga package
3 -- Project    : LU Digital Design
4 -------------------------------------------------------------------------------
5 -- File       : vga_pak.vhd
6 -- Author     : Thomas Handl
7 -- Company    : TU Wien
8 -- Created    : 2004-08-19
9 -- Last update: 2006-02-24
10 -------------------------------------------------------------------------------
11 -- Description: definitions of global constants and enumerated types
12 -------------------------------------------------------------------------------
13 -- Copyright (c) 2004 TU Wien
14 -------------------------------------------------------------------------------
15 -- Revisions  :
16 -- Date        Version  Author  Description
17 -- 2004-08-19  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
31 -------------------------------------------------------------------------------
32 -- PACKAGE
33 -------------------------------------------------------------------------------
34
35 package vga_pak is
36
37   constant RES_ACT   : std_logic := '0';            -- define reset active LO
38   constant ENABLE    : std_logic := '1';            -- define diverse enable HI
39   constant COLR_ON    : std_logic := '1';           -- define VGA color on as HI
40   constant COLR_OFF   : std_logic := '0';           -- define VGA color off as LO
41   constant SEG_WIDTH : integer := 7;                -- display has 7 segments
42   constant BCD_WIDTH : integer := 4;                -- BCD number has 4 bit
43   constant TOG_CNT_WIDTH : integer := 25;           -- bitwidth of counter that controls blinking
44
45   constant COL_CNT_WIDTH   : integer := 10;          -- width of the column counter
46   constant LINE_CNT_WIDTH  : integer := 9;           -- width of the line counter
47   constant HSYN_CNT_WIDTH : integer := 10;          -- width of the h-sync counter
48   constant VSYN_CNT_WIDTH : integer := 10;          -- width of the v-sync counter
49
50   constant RIGHT_BORDER:  std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "1001111111";  -- 640 columns (0...639)
51   constant BOTTOM_BORDER: std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "111011111";   -- 480 lines (0...479)
52
53   -- define coordinates of rectangle
54   constant X_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0001100100";  -- 100
55   constant X2_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0010100111";  -- 167
56   constant X3_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0011101000";  -- 232
57   constant X_MAX : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0101110000";  -- 368
58
59   constant Y_MIN : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "001100100";
60   constant Y_MAX : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "011001000";
61
62   -- define emumerated types for state machines
63   type hsync_state_type is (RESET_STATE, B_STATE, C_STATE, D_STATE, E_STATE,
64                             pre_D_STATE, pre_B_STATE);
65   type vsync_state_type is (RESET_STATE, P_STATE, Q_STATE, R_STATE, S_STATE,
66                             pre_R_STATE, pre_P_STATE);
67   
68   --  Definitions for 7-segment display                             gfedcba
69   constant DIGIT_ZERO  : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000000";
70   constant DIGIT_ONE   : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111001";
71   constant DIGIT_TWO   : std_logic_vector(SEG_WIDTH-1 downto 0) := "0100100";
72   constant DIGIT_THREE : std_logic_vector(SEG_WIDTH-1 downto 0) := "0110000";
73   constant DIGIT_FOUR  : std_logic_vector(SEG_WIDTH-1 downto 0) := "0011001";
74   constant DIGIT_FIVE  : std_logic_vector(SEG_WIDTH-1 downto 0) := "0010010";
75   constant DIGIT_SIX   : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000010";
76   constant DIGIT_SEVEN : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111000";
77   constant DIGIT_EIGHT : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000000";
78   constant DIGIT_NINE  : std_logic_vector(SEG_WIDTH-1 downto 0) := "0011000";
79   constant DIGIT_MINUS : std_logic_vector(SEG_WIDTH-1 downto 0) := "0111111";
80   constant DIGIT_A     : std_logic_vector(SEG_WIDTH-1 downto 0) := "0001000";
81   constant DIGIT_B     : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000011";
82   constant DIGIT_C     : std_logic_vector(SEG_WIDTH-1 downto 0) := "0110001";
83   constant DIGIT_D     : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000010";
84   constant DIGIT_E     : std_logic_vector(SEG_WIDTH-1 downto 0) := "1001111";
85   constant DIGIT_F     : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000111";
86   constant DIGIT_OFF   : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111111";
87  
88 end package;