Forum Discussion

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

MIF following

I need a program which runs over a MIF and gets out is data.

anybody knows how to do that ?

thank you for help...

5 Replies

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

    should be easy to write in TCL.

    Mif files are read at compile time, so there would be no use in reading the text from a .mif file in compiled VHDL.

    Unless this is for a testbench?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I would recommend using Intel .hex file format. Its easy to generate using C code, and easy to parse in a testbench directly.

    Wikipedia has the format of .hex files.

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

    Use the Altera tools to generate a couple of example files, and you'll see the format they expect.

    For example, here's a few lines from the start and the end of a MAX II UFM memory contents file:

    
    :020000000000FE
    :020001000403F6
    :0200020060019B
    :020003000400F7
    :020004004B802F
    :02000500001CDD
    :020006000200F6
    ...
    :0201FD00FFFF02
    :0201FE00FFFF01
    :0201FF00FFFF00
    :00000001FF
    

    You can use the Wikipedia page to 'decode' these bytes. Here's the C-code data to help you decoding the bytes

    
    /* FTDI FT245BM USB-to-Serial with serial number SERIAL01 */
    static int usb_to_serial01_data = {
        0x0000, 0x0403, 0x6001, 0x0400, 0x4B80, 0x001C, 0x0200, 0x0A94,
        0x329E, 0x12D0, 0x030A, 0x0046, 0x0054, 0x0044, 0x0049, 0x0332,
        0x0055, 0x0053, 0x0042, 0x0020, 0x003C, 0x002D, 0x003E, 0x0020,
        0x0053, 0x0065, 0x0072, 0x0069, 0x0061, 0x006C, 0x0020, 0x0043,
        0x006F, 0x006E, 0x0076, 0x0065, 0x0072, 0x0074, 0x0065, 0x0072,
        0x0312, 0x0053, 0x0045, 0x0052, 0x0049, 0x0041, 0x004C, 0x0030,
        0x0031, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
        0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x896F
    };
    

    Cheers,

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

    first of all - Thank you very much for your comments and you help.

    secondly- I allready have a GUI software which converts "my language" into MIF file, so for activating a robot by "my language" i have to follow the MIF file .

    i wrote a ROM program (by lpm), and i wrote a program counter which counts up the addresses. but it does not work...

    is some one can guss why ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    shahin, thank you about your comment , but i think we are talking about different things...

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

    --- Quote Start ---

    secondly- I allready have a GUI software which converts "my language" into MIF file, so for activating a robot by "my language" i have to follow the MIF file .

    --- Quote End ---

    From this comment then, I take it that you understand how to create the MIF file.

    --- Quote Start ---

    i wrote a ROM program (by lpm), and i wrote a program counter which counts up the addresses. but it does not work...

    --- Quote End ---

    This comment is a little confusing.

    Do you understand how to create a Modelsim simulation? If so, have you created a testbench that reads the ROM and confirms that the bytes are what you expect?

    That would be the first step in confirming that your MIF file has been created correctly.

    Cheers,

    Dave