Forum Discussion

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

Control panel: write memory file format?

Using the DE2 Control Panel you can read/write to the SRAM or SDRAM.

I am trying to write the SRAM memory contents to a file using the Control Panel.

I was hoping to get a text file with address and 16b value however, the Control Panel appears to write a binary file of some sort. The DE2 does not specify what the file format is? only that you can write the memory contents to a file.

Any help to would be appreciated.

Tony

4 Replies

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

    I never used it but I think DE2 control panel supports hex file format.

    Look here and check if your generated file matches the specification:

    http://en.wikipedia.org/wiki/intel_hex

    Otherwise post the file and I'll take a look at it; maybe I can suggest you a method to extract memory data.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The attached zip file is the result of using the control panel feature "Load SRAM content to a file" with the load entire SRAM box checked.

    I zipped the file only because that is one of the formats allowed for update. I did not know what file ext to give the file.

    Before writing the file I was able to read memory contents 16b at a time by entering an address and clicking the "SRAM read" button so the control panel is functioning ok.

    The resulting file is not ascii text but some type of binary file. From what I understand the hex format is an ascii based file type is it not? I have no idea how to extract the memory data from this file.

    If you can take a look at the file that would be appreciated. Thanks for your feedback.

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

    You are right. That's definitely a binary file.

    You can open it with any binary file viewer or write a simple application to print out the content in a readable way. e.g. I used VisualStudio, but I have sometimes used a tool called HexWorkshop; I believe you can find a lot of such programs on the web.

    However, the problem is now understand how data is stored in the file.

    In the beginning there is 01 00 02 00, then more 'random' bytes. Does this suggest you anything?

    I'd read a limited memory area with a known content and compare it with the file, in order to understand if memory is simply saved as is, without any formatting. I think probably so, since your file is exactly 512KB long, which is probably you sram dimension.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    ok, I understand now. It is a binary file which when read in an appropriate hex editor shows the memory contents properly. It is a straight dump but it seems to write the bytes in reverse order. ie. from control panel address 0 is shown as 0001 and address 1 is 0002.

    I used a freeware program called XVI32 to load the file in windows.

    As you say I just have to figure out a way to save these hex values in an ascii file using the proper editor.

    They should add a comment about the file format in the altera documentation.