Advanced VGA On A UP2: Software

Program Download:

Project Files
Char_Rom.zip

The Software
           Since quartus demands many files for compiling a project, all the project files are available for download in a zip file. All the files you'll need to compile & program are there.

           Since the software for this project won't fit all on one page I'll only explain the main character rom entity & architecture. If you have any lasting questions about the software just go to the forums and ask!

The Character Generating Rom
           Below is the entire code for a generic character generating rom. The character set included is limited to 4k bytes and all of it is used.

------------« Begin Code »------------
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.all;
USE IEEE.STD_LOGIC_ARITH.all;
USE IEEE.STD_LOGIC_UNSIGNED.all;
LIBRARY lpm;
USE lpm.lpm_components.ALL;

ENTITY Char_ROM IS
     PORT( character_address : IN STD_LOGIC_VECTOR(5 DOWNTO 0);
          font_row, font_col : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
          rom_mux_output : OUT STD_LOGIC);
END Char_ROM;

ARCHITECTURE struct OF Char_ROM IS
     SIGNAL rom_data : STD_LOGIC_VECTOR(7 DOWNTO 0);
     SIGNAL rom_address : STD_LOGIC_VECTOR(8 DOWNTO 0);
BEGIN
               -- Small 8 by 8 Character Generator ROM for Video Display
               -- Each character is eight 8-bits words of pixel data
     char_gen_rom: lpm_rom
          GENERIC MAP ( lpm_widthad => 9,
               lpm_numwords => 512,
               lpm_outdata => "UNREGISTERED",
               lpm_address_control => "UNREGISTERED",
                    -- Reads in mif file for character generator font data
               lpm_file => "char_set.mif",
               lpm_width => 8)
          PORT MAP ( address => rom_address, q => rom_data);

rom_address <= character_address & font_row;
          -- Mux to pick off correct rom data bit from 8-bit word
          -- for on screen character generation
rom_mux_output <= rom_data ( (CONV_INTEGER(NOT font_col(2 DOWNTO 0))));
END struct;
------------« End Code »------------
The Character Rom
           The LPM library gives us access to creating an lpm_rom. This rom is where our pre-made characters will be stored, specifically in the 'char_set.mif' file. The size of the rom & bit width is all set within this rom creation. Once it is created, we merely give the rom an row & column address and the pixel for that location is output via 'rom_mux_output'. The output 'rom_mux_output' should be directly connected to the Red, Green or Blue off the VGA module depending on which color you want to be output.



;