Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

How to create a *.mif (Memory Initialization File) from a picture (*.bmp)

Hello

I' am trying to make a *.mif (memory initialization file) from a picture(gray scale) and initialize it with memory i have create in fpga.

The memory is

reg [7:0] ram[76799:0] // 320X240

My question is how to create the file an how to initialize it with ram?

Thank you A.A

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The mif format is explained in Quartus Help when you look up "mif". It's a rather simple format and you can probably write a script or small software on your PC that reads the bmp file and writes the contents to a text file to generate the mif. Alternatively you can use a hex conversion program such as srecord (http://srecord.sourceforge.net/) that knows how to export to the MIF format.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I create the mif file from Quartus.

    How to connect it with verilog and initial memory ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The easiest way is to use the megawizard to create a ROM/RAM block. Then you can specify the .mif file to use for the block contents.