SVGA Tutorial


  1. Learn the basic structure of the SVGA peripheral.
  2. Learn how to make and reflect changed to peripherals provided.
  3. Learn how to set the screen state from system.c
This tutorial does not have exact steps to follow like the previous tutorials on purpose. The objective is to go through the thinking process so that you know how to modify the SVGA peripheral in the way you want after completing this tutorial.


    This tutorial is intended to show how a small change in the design propagates to many places in the SVGA peripheral. In this tutorial changes involving changing the icon size will be followed. Changing the size of the icons is simple, but then many internal signals have to be changed to the appropriate width to match the new icon size. Similar process should be performed when you change the screen size, icon size or number or icons for your final lab.

The Tutorial Quick Steps

  1. Copy Its Art from public drive and change the name of the directory
  2. Create pcores directory in the project directory
  3. Copy SVGA peripheral from public drive
  4. Modify the SVGA peripheral copied
    1. Modify icon_rom.vhd so that the icon size is now 16x16 instead of 8x8
    2. Modify index.vhd to change the addressing
    3. Modify fsl_svga_art.vhd so that it works for the new icons.
  5. Create system.c.
  6. Build and download your project.

Overview of the SVGA peripheral

fsl_svga_art.vhd is the main VHDL that communicates with the microblaze and use other entities to do its task.
There are two different tasks that this entity performs. The first task called "User IO Half" in the comments reads from the FSL and updates the bitmapram. The second part called "SVGA Half" reads values from the bitmapram to find out which icon it is trying to draw, and reads from the icon rom to see if the coordinate within that icon is high or low.
svga_sync.vhd is where the protocol is implemented.
bitmapram.vhd is the entity used to read/write the state of the screen.
icon_rom.vhd is the entity used to read a pixel of an icon.
index.vhd is the entity used to translate the coordinates into addresses in BRAM.

There are three different coordinate systems used in this peripheral. The first one is the screen coordinate in terms of pixels. The second one is the screen coordinate in terms of icons. The first one needs much more space to express the entire screen, because an icon can represent a block of a screen. Another coordinate is the coordinate within an icon.

In the case of 800x600 screen with 8x8 icons, the first system has 800x600 points, the second one has 100x75 points, and the last one has 8x8 points.
In this tutorial, one of the coordinates (the icon size) will be changed while keeping the first one (screen size) fixed. Then the second coordinates needs to be changed to match the new systems.

Detailed Steps

  1. Copy the directory P:\Its_Art to your drive (Z). Z:\SVGA_Tutorial will be used in this tutorial.

  2. Create Z:\SVGA_Tutorial\pcores

  3. Copy P:\EDK_Peripherals\FSL\pcores\fsl_svga_art_v1_00_a into Z:\SVGA_Tutorial\pcores
    This is how to use a local version of some peripheral available in the public drive, if you want to make changes to it.

  4. Replace fsl_svg_art.vhd with this one that has all the places that requires change commented out. It is also labeled with the step that requires to change that region.

  5. Modify Z:\SVGA_Tutorial\pcores\fsl_svga_art_v1_00_a\hdl\vhdl\icon_rom.vhd
    1. Look at the ports of icon_rom. The important ones are Icon_Num, Row and Col. Icon_Num tells which icon it is, and Row and Col specifies where in that icon. It is now using 3bits each for Row and Col, because it is 8x8. Make Row and Col 4bits to make it work for 16x16 icons.
    2. If you look at the architecture of this entity, signal Addr is concatenation of all of the above three inputs. Addr is used to specify the address in the BRAM, so the length of this signal has to stay the same (14bits). Change the length of Icon_Num to 6bits to make the adjustment.(This is simply saying you can only have fewer icons if one Icon is larger)
    3. The generic INIT_00 is used to set the initial values for the BRAM. The values are represented as hex values and the 64 hex values are representing four 8x8 icons. You need 64 hex values to represent one 16x16 icon, so INIT_00 is enough for only one icon. Add generics INIT_01, INIT_02, and INIT_03 to initialize all four 16x16 icons.
    4. Update the component declaration of icon_rom in fsl_svga_art.vhd.
    5. Perl scripts to help you with the icons are available here.

  6. Modify Z:\SVGA_Tutorial\pcores\fsl_svga_art_v1_00_a\hdl\vhdl\index.vhd
    Component index is used to translate screen coordinates in icons into BRAM addresses. Since bitmapram requires 13bit addresses, this component must output a 13bit address as well. The address can be anything, if it is unique for expected input.
    1. Change the inputs to 6bits, since only 6bits are used in the new coordinate system (screen in icons).
    2. Define the output as some combination of the inputs so that it is unique.
      The original file is doing very complicated operations to make it unique, because the original coordinate system was 7bits each. Since they are now 6bits each, simply concatenating would not exceed 13bits. Add an extra constant bit somewhere to make it 13bits.
    3. Don't forget to update the component declaration of index in fsl_svga_art.vhd.

  7. Modify Z:\SVGA_Tutorial\pcores\fsl_svga_art_v1_00_a\hdl\vhdl\fsl_svga_art.vhd
    Since the size of the icons has been changed, many changes need to happen. All changes are essentially changing the width of the vectors to match the new icon size.
    1. Modify the first part of the entity where it writes to the BRAM the value read from the FSL.
      IN_Col, IN_Row, and IN_Icon are internal signals that are assigned part of the data read from the FSL. The data read from FSL contains multiple data, encoded into 32bit. The first 8 bits are used to specify if write is requested (although only one out of 8 bits are used). The next 8 bits are used to specify the column, the next 8 for row. The last 8 bits are used to specify the id of icon in case of a write.
      The last three parameters have variable length depending on the size of the screen and the size of the icon, so the size of the internal signals must be adjusted. Since we have 4 icons, IN_Icon must be 2 bits wide. Using 16x16 icons to represent 800x600 screen requires 50x37 icons. 6bits are required to express either 50 or 37, so IN_Row and IN_Col must be 6bits.
      The read from the FSL data and the declaration of the signals are the places that need to be changed. Now the size of these signals should be consistent with the index component.
    2. The internal signals Row and Col are signals that store screen coordinates in pixels, outputs from svga_sync. Since the screen size has not changed, these signals stay the same size. However, when these signals are used as parameters given to index, only the higher 6bits are used instead of 7.
    3. Using VID_Addr the address in bitmapram for the given coordinate in terms of icons, the ID of the icon VID_Icon is acquired. VID_Icon is padded with 0s to make it 6bits, since the icon_rom now accepts 6bits as the icon number. Change the size of V_ID_Icon_Number (the result of padding) appropriately. The padding takes place when the number of icons actually used is smaller than the number of possible icons that fit in the icon_rom.
      Icon_Row and Icon_Col are the lower bits in Row/Col that were not used previously. The first 6bits of the screen coordinates are used to specify the icon, and the remaining 4bits are the coordinates within the icon.
      Change the declaration and assignment to Icon_Row and Icon_Col. icon rom is accessed with Icon_Row, Icon_Col and padded VID_Icon to get one bit output Pixel
    4. Pixel is a bit to let the icon have two different colors. Now RGB values needs to be defined as some function of the VID_Icon_D, Pixel, and possibly other values like Row or Col if you want the icon to have different colors based on where in the screen it is. Modify the when constructs in the original file so that each icon has a different color when Pixel is 1 and black if Pixel is 0.

  8. system.c
    1. First use this file, which initializes the entire screen with icon 0.
    2. Try changing the c file so that it displays all the icons.
    3. Since Its Art was used as the base of this tutorial, you can do many things using buttons and switches connected to the microblaze. Try changing icons in response to some event.

BRAM components

You may have noticed that components like RAMB16_S1 or RAMB16_S2_S2 were used in icon rom or bitmapram. These are pre-defined components used to access BRAM. One Sn means it is single ported and having two means dual ported. You may need to use other components for your final lab, for example if you have more than 4 icons, the bitmapram needs to be able to output more than 2 bits. Then you need to use RAMB16_S4_S4. There are other components available. More information can be found in the following pages. RAMB16_Sn, dual ported components.