An ASCII text file (with the extension .hex). You can use a Hexadecimal (Intel-Format) File (.hex) in the Quartus® Prime Standard Edition software to store the initial memory values for a memory block, such as CAM, RAM, or ROM, that is implemented in an Altera device, or to build software project executables.
You can use .hex files as input files in the Quartus® Prime Standard Edition software in the following ways:
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: Due to the complexity of the Hexadecimal (Intel-Format)
File type, Altera recommends that you use the Quartus® Prime Standard Edition Memory Editor to
create .hex files.
|
You can store configuration data for one or more Altera 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 Standard Edition 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 Standard Edition 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 Standard Edition 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 Standard Edition 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 Standard Edition software. Setting 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 Standard Edition software always reads word addressable .hex files in the word addressable mode even if the Read or write Hexadecimal Files (.hex) using byte addressing (Intel format) option is turned on.