1 -------------------------------------------------------------------------------
3 -- Project : LU Digital Design
4 -------------------------------------------------------------------------------
6 -- Author : Thomas Handl
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 -------------------------------------------------------------------------------
16 -- Date Version Author Description
17 -- 2004-08-19 1.0 handl Created
18 -- 2006-02-24 2.0 ST revised
19 -------------------------------------------------------------------------------
21 -------------------------------------------------------------------------------
23 -------------------------------------------------------------------------------
26 use IEEE.std_logic_1164.all;
27 use IEEE.std_logic_unsigned.all;
28 use IEEE.std_logic_arith.all;
31 -------------------------------------------------------------------------------
33 -------------------------------------------------------------------------------
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
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
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)
53 -- define coordinates of rectangle
54 constant X_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0001100100"; -- 100
55 constant X_MAX : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0011001000"; -- 200
56 constant Y_MIN : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "001100100";
57 constant Y_MAX : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "011001000";
59 -- define emumerated types for state machines
60 type hsync_state_type is (RESET_STATE, B_STATE, C_STATE, D_STATE, E_STATE,
61 pre_D_STATE, pre_B_STATE);
62 type vsync_state_type is (RESET_STATE, P_STATE, Q_STATE, R_STATE, S_STATE,
63 pre_R_STATE, pre_P_STATE);
65 -- Definitions for 7-segment display gfedcba
66 constant DIGIT_ZERO : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000000";
67 constant DIGIT_ONE : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111001";
68 constant DIGIT_TWO : std_logic_vector(SEG_WIDTH-1 downto 0) := "0100100";
69 constant DIGIT_THREE : std_logic_vector(SEG_WIDTH-1 downto 0) := "0110000";
70 constant DIGIT_FOUR : std_logic_vector(SEG_WIDTH-1 downto 0) := "0011001";
71 constant DIGIT_FIVE : std_logic_vector(SEG_WIDTH-1 downto 0) := "0010010";
72 constant DIGIT_SIX : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000010";
73 constant DIGIT_SEVEN : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111000";
74 constant DIGIT_EIGHT : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000000";
75 constant DIGIT_NINE : std_logic_vector(SEG_WIDTH-1 downto 0) := "0011000";
76 constant DIGIT_MINUS : std_logic_vector(SEG_WIDTH-1 downto 0) := "0111111";
77 constant DIGIT_A : std_logic_vector(SEG_WIDTH-1 downto 0) := "0001000";
78 constant DIGIT_B : std_logic_vector(SEG_WIDTH-1 downto 0) := "0000011";
79 constant DIGIT_C : std_logic_vector(SEG_WIDTH-1 downto 0) := "0110001";
80 constant DIGIT_D : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000010";
81 constant DIGIT_E : std_logic_vector(SEG_WIDTH-1 downto 0) := "1001111";
82 constant DIGIT_F : std_logic_vector(SEG_WIDTH-1 downto 0) := "1000111";
83 constant DIGIT_OFF : std_logic_vector(SEG_WIDTH-1 downto 0) := "1111111";