Forum Discussion

UserID4331231's avatar
UserID4331231
Icon for Occasional Contributor rankOccasional Contributor
6 months ago

understanding Hex file creation

In my FPGA project I have couple of memory which I plan on using as Configuration memory and general purpose memory. In Platform designer I made my project and I intend to assign them some initial values using "hex" files. While creating a new hex file using quartus , it asks two questions

  • word size ?
  • number of words.?

Can you help me how to choose these parameters for give memory size?

My memories are lets say 1KBytes and 1MBytes.

for 1KB memory, I want to initialize this memory with 64bit / 8 byte signed integer values, Starting from AAAA_BBBB_CCCC_0000 to AAAA_BBBB_CCCC_007F. (128 long int x 8 =1024 bytes)

Once I move past selecting word size and number of words, I can right click and choose "custom fill cells" to auto fill my memory with desired pattern. However I believe due to mis configuration in word size and number of words its not taking AAAA_BBBB_CCCC_0000 as valid input. I chose some small values and moved on, now during synthesis I got warning code 23413 and 23414 indicating "Memory depth (**bleep**) in the design file differs from memory depth (yyy) in the Memory Initialization File. Path/intel_onchip_memory_1410/synth/d2h_mem.hex" -- setting initial value for remaining addresses to 0."

this means I am not creating hex file properly and cant assign them exact pattern I want to.

furthermore, what if my desired patterns are random and offset specific. for example, initial configuration status of a custom IP? my config space is large and manually editing values in quartus gui is not practical. Is there any python or C example which can show how to generate hex file with desired values for each offset? I have csv file which has offset,value listed for entire configuration space.

please

6 Replies

  • sstrell's avatar
    sstrell
    Icon for Super Contributor rankSuper Contributor

    It's not clear what you ended up choosing for word size and number of words. Are you saying you set the word size to 64 and the number of words to 128?

    Word size is in bits.

  • UserID4331231's avatar
    UserID4331231
    Icon for Occasional Contributor rankOccasional Contributor

    for 1K memory - I chose 64 as word size and 128 as word count.

    for 1M memory - i chose 64 as word size and 131072 as word count.

    i critical warning i got is this - Critical Warning(23414): Memory depth (262144) in the design file differs from memory depth (131073) in the Memory Initialization File "/user/path_to_project/ip/pcie_ed/pcie_ed_intel_onchip_memory_0/intel_onchip_memory_1410/synth/d2h_mem.hex" -- setting initial value for remaining addresses to 0

    this warning means I am not making Hex file correctly. so my question is how do i do it correctly?

  • sstrell's avatar
    sstrell
    Icon for Super Contributor rankSuper Contributor

    No it means there's a mismatch between the RAM(s) you've created and the .hex files. How did you create the RAM? As IP or through HDL inference? What options did you choose?

    • UserID4331231's avatar
      UserID4331231
      Icon for Occasional Contributor rankOccasional Contributor
      1. In platform designer - in IP catalog - i chose "On chip memory II (RAM or ROM) IP". I entered S1 port width, and entered size of memory in decimal (1024 for 1K instance and 1048756 for 1M instance). I chose hex file i wanted to chose for initialization.
      2. Once entire project is made in platform designer I click on generate HDL , closed platform designer and synthesised project in quartus.

      the Hex file was created with quartus gui

      1. I clicked on files - and in new file wizard chose "hexadecimal (intel-format) file".
      2. Gui asks for word size and number of words. I chose values as described above. I select cell - right click and chose "Custom Fill Cells". I chose options to get desired auto incrementing pattern.
  • ShengN_altera's avatar
    ShengN_altera
    Icon for Super Contributor rankSuper Contributor

    Hi,

    Sorry for delay reply,

    Since 64 bits equal to 8 bytes, the word size you need to put 8.

    Thanks,

    Regards,

    Sheng

  • ShengN_altera's avatar
    ShengN_altera
    Icon for Super Contributor rankSuper Contributor

    Hi,


    May I know if any further concern?


    Does the problem being resolved?


    Thanks,

    Regards,

    Sheng