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