Hexadecimal (Intel-Format) File (.hex) Definition
An ASCII text file (with the extension .hex). You can use a Hexadecimal (Intel-Format) File (.hex) in the Quartus® Prime software to store the initial memory values for a memory block, such as RAM or ROM, that is implemented in an FPGA device, or to build software project executables.
You can use .hex files as input files in the Quartus® Prime software in the following ways:
- The Memory Editor can create a .hex file for memory initialization in the Compiler and Simulator. You can also use a Memory Initialization File (.mif) to provide memory initialization data.
- The In-System Memory Content Editor can use and create a .hex file to import and export data.
- The Quartus® Prime version of the .hex file uses line feed (LF) line endings, whereas Intel-Format .hex supports carraige return (CR) or LF line endings.
- The Quartus® Prime version of the .hex file is dependent on the width of the target memory, whereas Intel-Format .hex does not depend on the width of the target memory.
The format of each line in a .hexfile is as follows::AABBBBCCDD"¦DDEE | |
---|---|
Code |
Definition |
AA |
the number of bytes in the data field (DD"¦DD) |
BBBB |
starting address |
CC |
type (00 = data, 01 = end of file, 02 = address offset) |
DD..DD |
data field |
EE |
checksum value |
Important:
Use
the Quartus® Prime Memory Editor to create
.hex
files
for use in the Quartus® Prime
software.
|
You can store configuration data for one or more Intel devices in an output file called a Hexadecimal (Intel-Format) Output File (.hexout). The .hexout file format is an ASCII text file with the extension .hexout to avoid overwriting initial memory content files that have the extension .hex.
The data width of a .hex file is always a multiple of 8 bits. When you initialize a memory block that is not the same width as the .hex file, the Quartus® Prime software wraps or pads the file as described in the table below:
File data width greater than memory width |
File data width smaller than memory width |
---|---|
Memory size is a multiple of 8:
Memory size is not a multiple of 8: The Quartus® Prime software wraps the data to the memory width equal to the multiple of 8 and just greater than the actual memory width, and then truncates the memory block to the actual size of the memory width, which is not a multiple of 8. |
|
If the size of the .hex file does not match the size of the memory you are initializing, the Quartus® Prime software performs as described in the table below:
File data depth greater than memory depth |
File data depth smaller than memory depth |
---|---|
Ignores extra data. |
|
In the Quartus® Prime software, you have the option of reading or writing .hex files in the byte addressable (Intel hexadecimal format) mode, or the word-addressable mode. You can choose between the two modes by changing the Read or write Hexadecimal Files (.hex) using byte addressing (Intel format) option in the Quartus® Prime software. Set this option in the Memory Editor page in the Options dialog box. Turning on this option for the current project overrides the global setting.
The Quartus® Prime software always reads word addressable .hex files in the word addressable mode even if you turn on Read or write Hexadecimal Files (.hex) using byte addressing (Intel format).