Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17249 Discussions

how to add hex file into design file to compile

Altera_Forum
Honored Contributor II
5,742 Views

I'm using Quartus II version 7.2, a few issues I'm stuck on. I have a design file and a hex file that was generated from the asm codes (these files are handed down, I did not create them). In the design file, all the necessary library files have been added (Assignments => Settings => Libraries). Now what I need is to incorporate the hex file I have into the design file and compile, but I have no clue on how to do that.

0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
4,267 Views

Hello, 

 

the only possible usage of hex files I'm aware of, would be to initialize a ROM or RAM in FPGA internal memory. Could be instructions for a small software processor or tables used in calculation. This would be achieved by referencing the files in respective memory Megafunctions. 

 

If you are intending something different, you should clarify. 

 

Regards, 

Frank
0 Kudos
Altera_Forum
Honored Contributor II
4,267 Views

What is your "design file"? If it is an HDL file, look inside for instances of altsyncram or similar megafunctions. 

 

As Frank mentioned, there should be a reference to your hex file used for memory content initialization. If it is matching your hex file name, then you only have to put both files in the same folder and run a compile, Quartus will "incorporate" the hex file automatically.
0 Kudos
Altera_Forum
Honored Contributor II
4,267 Views

thank you both for replying. I was able to add the hex file into the project and was able to compile without errors. I can see the hex file added in the project navigator, but it seems like even after I compile I'm getting the same checksum in the output (.pof) file as if the hex file is not there. I added the hex file using Project => Add Filename and point to where the file is stored at. Could it be that the hex file name is not matching the name that is hard code somewhere in the HDL file?

0 Kudos
Altera_Forum
Honored Contributor II
4,267 Views

 

--- Quote Start ---  

Could it be that the hex file name is not matching the name that is hard code somewhere in the HDL file? 

--- Quote End ---  

 

 

I'm still guessing how you referenced the hex file in your design (or "hard coded" it). Can you please clarify. If it is e. g. referenced in a RAM or ROM Megafunction instance and not found during compilation (because of wrong filename or whatever), then you get a clear and understandable warning in compilation report. It would not be necessary to count bytes to check for.
0 Kudos
Altera_Forum
Honored Contributor II
4,267 Views

I have a memory initialization file that is referenced in ROM altsyncram megafunction 

init_file = "C:/Project/...../File.mif"  

and when I open the mif file, it states "Quartus II generated memory initialization file (.mif)" As you mentioned before, I would just need to place both the hex and the mif files within the same directory and quartus will automatically recognize the hex file. But the problem that I see now is, every time I have a new hex file, the mif file doesn't automatically update when I compile. So what are the steps I should take to have quartus update the mif file whenever I add the new hex file? As far as I see, compilation does not update the mif file.
0 Kudos
Altera_Forum
Honored Contributor II
4,267 Views

I've had luck putting the hex files in the project's working directory.

0 Kudos
Altera_Forum
Honored Contributor II
4,267 Views

There is no automatic conversion from *.hex to *.mif, as far as I know. If you want an externally created hex file to be compiled into your design, you must specify *.hex instead of *.mif in Megafunction instance. Quartus is supporting both formats. You have to use also *.hex memory images when simulating with ModelSim, cause ModelSim needs *.hex input.

0 Kudos
Reply