Prettige Kerst

Merry X-Mas

Prettige Kerst, Merry X-Mas, of course in style, by using a Digilent Nexys Video FPGA board to control a HDMI monitor.


The idea behind this mini X-Mas holiday project was to create a GPU for my RISC-V core, so it could output things on a monitor instead only turn on/off some LED’s. Since my VHDL skills are still not that great and calculating 1920x1080 pixels at 60Hz would mean FPGA clocks up to 147MHz which leave very little room for mistakes. Since I wanted it to have a bit of a C64 feeling I reduced the internal resolution from 1920x1080 to 480x270. Also I reduced the HDMI output from 1920x1080@60 to 1920x1080@30 so everything only has to run as 74MHz.

Since with the lower resolution every pixel is 4x4 pixels on the monitor, there is more time for doing memory reads. To fit everything inside the internal block RAM of the FPGA I also choose to use indexed colors, so every pixel is 1 byte that indexes a 256 entry color lookup table that than holds the 24bit color values.

Like the C64 I also wanted to at the possibility to use sprites and other special features, but like every software project, deadlines, not enough human resources, and technical difficulties meant that I only was able to create the minimum viable solution :-)

And even that minimum viable solution was hard enough, the first try was to get at least something on the screen.


The next step was to get something useful in the FPGA block RAM, to do this I wrote a small program that converted a 8bit indexed BMP image to a Xilinx COE file. Of course I messed up the endianess of the image


And Windows (thanks Microsoft) messed up the colors when saving a BMP to 8bit color, so I needed Linux to convert it to a BMP with the right colors.

But in the end it worked and just on time, so Merry X-mas and a Happy New Year to everybody!


Feel free to comment on Linkedin

See also