OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [VHDL/] [vdu8_bert.vhd] - Diff between revs 66 and 118

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 66 Rev 118
Line 1... Line 1...
-- ---------------------------------------------------
--===========================================================================--
-- Video Display terminal
--                                                                           --
-- ---------------------------------------------------
--  vdu8_bert.vhd - Synthesizable Colour Video Display Unit for System09     --
-- John Kent
--                                                                           --
-- 3th September 2004
--===========================================================================--
 
--
 
--  File name      : vdu8_bert.vhd
 
--
 
--  Purpose        : Implements a text based Colour Video Display Unit for System09
 
--                   Supports 2KByte Text buffer and 2KByte Attribute memory
 
--                   Displays 80 characters across by 25 character rows
 
--                   Characters are 8 pixels across x 16 lines down.
 
--                   Character attribute bita for foreground and backgrond colour
 
--                   1 bit for each Blue Green and Red signal
 
--                   Supports 2 x 8 chunky graphics character mode.
-- Assumes a pixel clock input of 50 MHz
-- Assumes a pixel clock input of 50 MHz
-- Generates a 12.5MHz CPU Clock output
--                   Generates a 12.5MHz CPU Clock output for old Spartan 2 boards.
 
--                   Partially cleaned up by Bertrand Cuzeau
 
--                  
 
--  Dependencies   : ieee.Std_Logic_1164
 
--                   ieee.std_logic_unsigned
 
--                   ieee.std_logic_arith
 
--                   ieee.numeric_std
 
--
 
--  Uses           : ram_2k (ram2k_b16.vhd)             2KByte Character & Attribute buffer
 
--                   char_rom (char_rom2k_b16.vhd)      2KByte Character Generator ROM 
 
--
 
--  Author         : John E. Kent
 
--
 
--  Email          : dilbert57@opencores.org      
 
--
 
--  Web            : http://opencores.org/project,system09
 
--
 
--  Description    : Display Timing:
 
--                       800 pixels / line
 
--                       446 lines / frame
 
--                       None interlaced
 
--                       25MHz pixel clock implies 
 
--                       31.25 KHz line rate
 
--                       70.067 Hz frame rate   
 
--                       Timing settable by generics.
 
--
 
--                   Display Size:
 
--                       80 characters across
 
--                       25 characters down.
 
--
 
--                   Character Size:
 
--                        8 horizontal pixels across
 
--                       16 vertical scan lines down (2 scan lines/row)
 
--
 
--                   Registers:
 
--                   Base + 0 ASCII character register
 
--                            Writing to this register writes an 8 bit byte 
 
--                            into the text buffer at the specified cursor position
 
--                            Text Mode: ASCII Character (0 to 127)
 
--                            Chunky Graphics Mode: B0 B1 (0 to 255)
 
--                                                  B2 B3
 
--                                                  B4 B5
 
--                                                  B6 B7
 
--                   Base + 1 Attibute bit (0 to 255)
 
--                            Writing to the register writes an 8 bit byte 
 
--                            into the attribute buffer at the specified cursor position
 
--                            B7 - 0 => Text Mode / 1 => Chunky Graphics Mode
 
--                            B6 - 1 => Character Background Blue
 
--                            B5 - 1 => Character Background Green
 
--                            B4 - 1 => Character Background Red
 
--                            B3 - 1 => Character Background & Foreground Alternates
 
--                            B2 - 1 => Character Foreground Blue
 
--                            B1 - 1 => Character Foreground Green
 
--                            B0 - 1 => Character Foreground Red
 
--                   Base + 2 Cursor Horizontal Position (0 to 79)
 
--                   Base + 3 Cusror Vertical Position (0 to 24)
 
--                   Base + 4 Vertical Scroll Offset (0 to 24)
 
--                            Scrolls the display up by the specified number of character rows
 
--
 
--  Video Timing :
 
--
 
--  Horizontal 800 Pixels/ 25MHz Pixel Clock = 32usec Line period = 31.25 KHz Line Frequency
 
--  /--------------------------\_____________/---------------\______________/
 
--      640 Pixels Display       16 Pixel FP    96 Pixel HS     48 Pixel BP
 
--    
 
--      VGA_CLK_FREQ           : integer := 25000000; -- HZ
 
--           VGA_HOR_FRONT_PORCH    : integer := 16; -- PIXELS 0.64us (0.94us)
 
--           VGA_HOR_SYNC           : integer := 96; -- PIXELS 3.84us (3.77us)
 
--           VGA_HOR_BACK_PORCH     : integer := 48; -- PIXELS 1.92us (1.89us)
 
--           VGA_PIX_PER_CHAR       : integer := 8;  -- PIXELS 0.32us
 
--           VGA_HOR_CHARS          : integer := 80; -- CHARACTERS 25.6us
 
--
 
--  Vertical 446 Lines * 32 usec Line rate = 14.272ms Frame Period = 70.07Hz Frame frequency  
 
--  /---------------------------\____________/---------------\______________/
 
--      400 Line Display          10 Line FP     2 Line VS      34 Line BP
--
--
-- Display Format is:
--           VGA_VER_FRONT_PORCH    : integer := 10; -- LINES 0.320ms
-- 80 characters across by 25 characters down.
--           VGA_VER_SYNC           : integer := 2;  -- LINES 0.064ms
-- 8 horizontal pixels / character
--           VGA_VER_BACK_PORCH     : integer := 34; -- LINES 1.088ms
-- 16 vertical scan lines / character (2 scan lines/row)
--           VGA_LIN_PER_CHAR       : integer := 16; -- LINES 0.512ms
 
--           VGA_VER_CHARS          : integer := 25; -- CHARACTERS 12.8ms
--
--
-- Modified by Bert Cuzeau for compliance and code cleanliness
--
 
--  Copyright (C) 2003 - 2010 John Kent
 
--
 
--  This program is free software: you can redistribute it and/or modify
 
--  it under the terms of the GNU General Public License as published by
 
--  the Free Software Foundation, either version 3 of the License, or
 
--  (at your option) any later version.
 
--
 
--  This program is distributed in the hope that it will be useful,
 
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
--  GNU General Public License for more details.
 
--
 
--  You should have received a copy of the GNU General Public License
 
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
--
 
--===========================================================================--
 
--                                                                           --
 
--                              Revision  History                            --
 
--                                                                           --
 
--===========================================================================--
 
--
 
-- Version Author      Date        Changes
 
--
 
-- 0.1     John Kent   2004-09-03  Initial release
 
--
 
-- 0.2     Bert Cuzeau 2007-01-16  Modified by for compliance and code cleanliness
-- The effort is not over.
-- The effort is not over.
-- There are still signal initialized, which is BAD.
-- There are still signal initialized, which is BAD.
 
--
 
-- 0.3     John Kent   2010-06-16  Added GPL notice. Updated description
 
--
 
 
Library IEEE;
Library IEEE;
  use IEEE.std_logic_1164.all;
  use IEEE.std_logic_1164.all;
  use IEEE.numeric_std.all;
  use IEEE.numeric_std.all;
 
 
Entity vdu8 is
Entity vdu8 is
 
  generic(
 
        VGA_CLK_FREQ           : integer := 25000000; -- HZ
 
             VGA_HOR_CHARS          : integer := 80; -- CHARACTERS 25.6us
 
             VGA_HOR_CHAR_PIXELS    : integer := 8;  -- PIXELS 0.32us
 
             VGA_HOR_FRONT_PORCH    : integer := 16; -- PIXELS 0.64us
 
             VGA_HOR_SYNC           : integer := 96; -- PIXELS 3.84us
 
             VGA_HOR_BACK_PORCH     : integer := 48; -- PIXELS 1.92us
 
             VGA_VER_CHARS          : integer := 25; -- CHARACTERS 12.8ms
 
             VGA_VER_CHAR_LINES     : integer := 16; -- LINES 0.512ms
 
             VGA_VER_FRONT_PORCH    : integer := 10; -- LINES 0.320ms
 
             VGA_VER_SYNC           : integer := 2;  -- LINES 0.064ms
 
             VGA_VER_BACK_PORCH     : integer := 34  -- LINES 1.088ms
 
  );
  port(
  port(
    -- control register interface
    -- control register interface
    vdu_clk_in   : in  std_logic;       -- 50MHz  System clock
    vdu_clk_in   : in  std_logic;       -- 50MHz  System clock
    cpu_clk_out  : out std_logic;       -- 12.5 MHz CPU Clock
    cpu_clk_out  : out std_logic;       -- 12.5 MHz CPU Clock
    vdu_rst      : in  std_logic;
    vdu_rst      : in  std_logic;
Line 43... Line 170...
Architecture RTL of vdu8 is
Architecture RTL of vdu8 is
 
 
  --
  --
  -- Synchronisation constants
  -- Synchronisation constants
  --
  --
  constant HOR_DISP_END : integer := 639;  -- Last horizontal pixel displayed
  --
  constant HOR_SYNC_BEG : integer := 679;  -- Start of horizontal synch pulse
  -- Synchronisation constants
  constant HOR_SYNC_END : integer := 775;  -- End of Horizontal Synch pulse
  --
  constant HOR_SCAN_END : integer := 799;  -- Last pixel in scan line
  -- Displayed Characters per row
  constant HOR_DISP_CHR : integer := 80;  -- Number of characters displayed per row
  constant HOR_DISP_CHR : integer := VGA_HOR_CHARS;
 
  -- Last horizontal pixel displayed
  constant VER_DISP_END : integer := 399;  -- last row displayed
  constant HOR_DISP_END : integer := (HOR_DISP_CHR * VGA_HOR_CHAR_PIXELS) - 1;
  constant VER_SYNC_BEG : integer := 413;  -- start of vertical synch pulse
  -- Start of horizontal synch pulse
  constant VER_SYNC_END : integer := 414;  -- end of vertical synch pulse
  constant HOR_SYNC_BEG : integer := HOR_DISP_END + VGA_HOR_FRONT_PORCH;
  constant VER_SCAN_END : integer := 450;  -- Last scan row in the frame
  -- End of Horizontal Synch pulse
  constant VER_DISP_CHR : integer := 25;  -- Number of character rows displayed
  constant HOR_SYNC_END : integer := HOR_SYNC_BEG + VGA_HOR_SYNC;
 
  -- Last pixel in scan line
 
  constant HOR_SCAN_END : integer := HOR_SYNC_END + VGA_HOR_BACK_PORCH;
 
 
 
  -- Number of displayed characters rows
 
  constant VER_DISP_CHR : integer := VGA_VER_CHARS;
 
  -- last row displayed
 
  constant VER_DISP_END : integer := (VER_DISP_CHR * VGA_VER_CHAR_LINES) - 1;
 
  -- start of vertical synch pulse
 
  constant VER_SYNC_BEG : integer := VER_DISP_END + VGA_VER_FRONT_PORCH;
 
  -- end of vertical synch pulse
 
  constant VER_SYNC_END : integer := VER_SYNC_BEG + VGA_VER_SYNC;
 
  -- Last scan row in the frame
 
  constant VER_SCAN_END : integer := VER_SYNC_END + VGA_VER_BACK_PORCH;
 
 
  signal horiz_sync    : std_logic := '1';
  signal horiz_sync    : std_logic := '1';
  signal vert_sync     : std_logic := '1';
  signal vert_sync     : std_logic := '1';
  signal cursor_on_v   : std_logic;
  signal cursor_on_v   : std_logic;
  signal cursor_on_h   : std_logic;
  signal cursor_on_h   : std_logic;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.