Before the implementation of any of these modules, please, check if your design leaves enough memory resources for the required memory. Logic requirements are negligible and working frequency is above 395MHz in most cases.
( figure source )
Pixels are addressed by lines from the top left to the bottom right. For example, using a 160×100 resolution, the top left pixel has address 0, its right neighbor has address 1, and the top right pixel has address 159 (0x009F). The Left pixel of the top second line has address 160 (0x00A0), and so on. The bottom left pixel has address 15840 (0x3DE0) and the bottom right has address 15999 (0x3E7F).
Different resolutions are available :
All resolutions are available from 1 bit/pixel to 12 bit/pixel. It is possible to chose between colored or greyscale for color depth of 2, 3 and 4 bits / pixel.
The graphic memory only contains 1 bit/address to match the pixel coding. The output is then black for '0' and white for '1'. As the VGA interface is coded using 4 bits / color (or 12 bits / pixel). It is possible to modify the white value by any other with simple logic gating.
The pixel value is encoded with 2 bits. The generic parameter grayscale makes it possible to code the screen as monochrome if set to true, if omitted, it is considered as false and display will be colored. The corresponding values are as follow :
In each case, the color is set at its maximal intensity.
Here again, the generic parameter grayscale makes it possible to code the screen as monochrome if set to true, if omitted, it is considered as false and display will be colored. With this coding scheme, each bit represent a primary color. Each individual color is always set at its maximum. The next table lists the expected colors.
The 4-bit representation is very similar to 3-bit. There is the possibility to use it to code grayscale or colored pixels. For colors, it uses the same scheme as 3-bit for the chrominance, and uses the MSB (4th) bit to code luminance. When the MSB is 0, colors are dark, when the MSB is '1', colors are bright. It is worth mentioning that dark white is a gray which is lighter than bright black.
Using this color scheme, colors are coded in RGB format where R, G and B may take three values (dark or 0, medium or 1, bright or 2). The corresponding values are then coded as an integer given by : (R*9 + G*3 + B). This representation only provides 27 different colors where 32 are actually possible, but it is a good compromise to provide RGB coding with low memory resources.
Beyond this point, pixel values are coded using RGB representation. The table below shows how bits are split to provide the expected coding :
All combinations could not be tested, so the information below may be incomplete. Please not that the following values are given for the Artix 7 family synthetized with ISE 14.7 .
|resolution||ISE synthesis||greedy Vivado (v1.1 and previous)|
|160×100||0.5 BRAM / bpp||0.5 BRAM / bpp|
|160×120||1 BRAM / bpp||1 BRAM / bpp|
|320×200||2 BRAM / bpp||2 BRAM / bpp|
|320×240||2.5 BRAM / bpp||4 BRAM / bpp|
|640×480||10 BRAM / bpp||16 BRAM / bpp|
Modules use excessively high memory resources when synthetising with Vivado. Versions 1.2 and above should soon fix this issue soon. Til then, 640×480 resolution can only be achieved at 8 bits/Pixel. (9 bits/pixel might work but was not tested, please give feedback concerning this limitation).