COEGen v0.01 – Generate .coe files from binary files for Xilinx FPGA block RAM.

What it Does

This is just a simple utility for creating .coe files to initialise Xilinx FPGA block ram. It takes an input file, typically binary data of some sort, and out puts ‘inputfilename’.coe.

You can even set the width of each memory block and the length of the memory.

How to Use

Using the program is pretty simple. Here’s an example:

 $ COEGen --file binary.bin --width 8 --depth 256 

This will output ‘binary.bin.coe’. This will initialise 256 bytes of 8-bit memory from the file binary.bin.

Note that if the specified memory size is larger than the input file, the rest of the block RAM will be filled with zeros.


The easiest way to get COEGen is to install a binary package. Here’s the link:



I’ve uploaded a build of COEGen for Windows.

You’ll need to use Code::Blocks to build it. The only dependencies are the boost libraries. How to get the source:

 $ git clone 

If you have any issues, feel free to contact me by commenting below. Enjoy!