coetool is a cli or gui program to convert from .coe files (VGA memory map for a ROM in an FPGA) to image files and the other way around, load an image and generate .coe file. Also it is possible to zoom images, export (both .coe file and image) and view raw bytes. #uayor #4fun
It is free software, cross-platform (same code runs on Linux, Windows and MacOSX), developed using python3 and PyQt5, and looks like this:
jaxvi@piv:~/DEVEL/COETOOL$ python3 coetool.py -h usage: coetool.py [-h] [-c FILE FILE] coetool: convert from .coe file (VGA mem) to image file and vice versa optional arguments: -h, --help show this help message and exit -c FILE FILE, --convert FILE FILE convert from IN_FILE to OUT_FILE (supported output formats: bmp, jpg, png, and coe ) Example: coetool --convert rom_vga.coe outimage.jpg
Basically I wanted to generate my own .coe file from an image in order to configure a ROM for the FPGA board we use in laboratory: Nexys 2 Spartan 3 FGA.A .coe file is used when working with Xilinx in a variety of ways, in my case I was given a romvga.coe file to test, this is: create ROM, load to FPGA + some VHDL code to control etc... and generate VGA signal to show.
The main part in this file is a "MEMORY_INITIALIZATION_VECTOR" providing the bytes of the img data we want to show via VGA. I wrote a code to read this file, take bytes string and create a bitmap to show or to save as image file. Each byte represents a pixel in RGB332 8 bits indexed format: 3 bits Red, 3 bits Green and 2 bits Blue. No more and no less.
The tricky part is the conversion between image formats, because you usually have a RGB 24 bits or 32bits, with alpha channel, compressed, header stuff etc.. (see Lenna.png example) and need a plain bitmap, in fact the bytes array with the image data. I use both PyQt5 and PIL as graphics libraries to deal with that and a custom palette needed because of the indexed 8 bits format. You'd rather see the code...
COETOOL-V01/ ├── coetoolcore.py ├── coetoolgui.py └── coetool.pyDownload coetool-v01.tar.gz source code.
for example in Ubuntu, open a terminal and try:
sudo apt-get install python3-pil python3-pyqt5Linux Debian jessie/sid x64 | Windows 7 pro x32 | MacOSX 10.8.5 x64 | FPGA VGA signal on stage! |
---|---|---|---|