vga/ps/2: ip-core hinzugefuegt
[hwmod.git] / src / textmode_vga / textmode_vga_pkg.vhd
diff --git a/src/textmode_vga/textmode_vga_pkg.vhd b/src/textmode_vga/textmode_vga_pkg.vhd
new file mode 100644 (file)
index 0000000..7646bad
--- /dev/null
@@ -0,0 +1,78 @@
+-------------------------------------------------------------------------\r
+--\r
+-- Filename: textmode_vga_pkg.vhd\r
+-- =========\r
+--\r
+-- Short Description:\r
+-- ==================\r
+--   Global declaration needed by the VGA interface.\r
+--   This package contains the declaration of the VGA timing values,\r
+--   the VGA dimensions and the supported commands.\r
+--\r
+-------------------------------------------------------------------------\r
+\r
+library ieee;\r
+use ieee.std_logic_1164.all;\r
+use work.textmode_vga_platform_dependent_pkg.all;\r
+--\r
+-- 640x480x60Hz\r
+--\r
+--     >=144           <784\r
+--   >=33 ---------------\r
+--        |             |\r
+--        |             |\r
+--        |             |\r
+--   <513 ---------------\r
+--\r
+-- PixelClock: 25,175 MHz\r
+--\r
+-- HSync   96\r
+-- BackP   48\r
+-- Data   640\r
+-- FrontP  16\r
+--        ---\r
+--        800\r
+--\r
+-- Vsync    2\r
+-- BackP   31\r
+-- Data   480\r
+-- FrontP  11\r
+--        ---\r
+--        524\r
+--\r
+\r
+package textmode_vga_pkg is\r
+  constant COLOR_SIZE : integer := 8;\r
+  constant CHAR_SIZE : integer := 8;\r
+\r
+  constant COLOR_BLACK : std_logic_vector(3 * COLOR_SIZE - 1 downto 0) := (others => '0');\r
+  constant COLOR_WHITE : std_logic_vector(3 * COLOR_SIZE - 1 downto 0) := (others => '1');\r
+\r
+  constant PIXEL_WIDTH : integer := 640;\r
+  constant PIXEL_HEIGHT : integer := 480;\r
+  constant HSYNC_CYCLES : integer := 96;\r
+  constant HBACK_CYCLES : integer := 48;\r
+  constant HFRONT_CYCLES : integer := 16;\r
+  constant VSYNC_LINES : integer := 2;\r
+  constant VBACK_LINES : integer := 31;\r
+  constant VFRONT_LINES : integer := 11;\r
+\r
+  subtype COLOR_RANGE is natural range COLOR_SIZE + CHAR_SIZE - 1 downto CHAR_SIZE;\r
+  subtype VGA_MEMORY_RANGE is natural range COLOR_SIZE + CHAR_SIZE - 1 downto 0;\r
+  \r
+  constant COMMAND_SIZE : integer := 8;\r
+  constant COMMAND_NOP : std_logic_vector(COMMAND_SIZE - 1 downto 0) := x"00";\r
+  constant COMMAND_SET_CHAR : std_logic_vector(COMMAND_SIZE - 1 downto 0) := x"01";\r
+  constant COMMAND_SET_BACKGROUND : std_logic_vector(COMMAND_SIZE - 1 downto 0) := x"02";\r
+  constant COMMAND_SET_CURSOR_STATE : std_logic_vector(COMMAND_SIZE - 1 downto 0) := x"03";\r
+  constant COMMAND_SET_CURSOR_COLOR : std_logic_vector(COMMAND_SIZE - 1 downto 0) := x"04";\r
+  constant COMMAND_SET_CURSOR_COLUMN : std_logic_vector(COMMAND_SIZE - 1 downto 0) := x"05";\r
+  constant COMMAND_SET_CURSOR_LINE : std_logic_vector(COMMAND_SIZE - 1 downto 0) := x"06";\r
+  \r
+  constant CHAR_NEW_LINE : std_logic_vector(CHAR_SIZE - 1 downto 0) := x"0A";\r
+  constant CHAR_CARRIAGE_RETURN : std_logic_vector(CHAR_SIZE - 1 downto 0) := x"0D";\r
+  constant CHAR_NULL : std_logic_vector(CHAR_SIZE - 1 downto 0) := x"00";\r
+  \r
+  type CURSOR_STATE_TYPE is (CURSOR_OFF, CURSOR_ON, CURSOR_BLINK);\r
+  constant CURSOR_BLINK_INTERVAL_MS : integer := 500;\r
+end package textmode_vga_pkg;\r