Behavior
A memory component stores data values that are up to 32 bits long. The number of stored data values is determined by the width of the address, which is defined in the property "Address Bit Width".
The property "Display content" can be used to control whether the memory component should display its memory content as part of the symbol during simulation. Even if the property is set, the memory content is only displayed in the symbol if the simulation speed is at most in the "Observe" category - in the fastest "Use" category the memory content is never displayed. For an explanation of simulation speeds see chapter Simulation.
Importing and exporting memory contents
A double click on a memory component opens a dialog that allows the memory content to be imported from a file (ROM only) and exported to a file. The memory content can also be reset, i.e. all memory cells are set to the value 0.
This allows you to write the content of a memory component in any editor, save it as a file, and then import it into the memory component. The imported memory content becomes part of the memory component and is added to the circuit file when the circuit is saved; the file from which the memory content was loaded is then no longer needed. The format of the file from which memory contents can be imported is described below.
When exporting the memory contents to a file, the current version of Antares always uses the "Standard" file format (see below).
"Standard" file format
The format of the file from which the data of a memory component can be imported is deliberately designed to be simple enough to allow the data to be written with any text editor.
The data in the file essentially consists of a sequence of hexadecimal values separated by either a space or a line break, whereby both types of separation can occur in any combination in the same file. This allows, for example, 8 bytes to be combined on one line.
The length of the hexadecimal value is determined by the property "Data Bit Width": e.g. data for an 8-bit memory have the form "FF". Antares accepts both uppercase letters and lowercase letters as hexadecimal digits.
1F 7E 05 B8 45 A0
The file format does not include "run-length encoding". Longer sections of data that have the same value at each address must explicitly contain these values. An exception are final 0 values, which do not have to occur explicitly. If a file with the above sample content is loaded into an 8-bit memory with 256 data cells, the first 6 bytes are set with the data from the file and the remaining 250 data cells are set to the value 0. The concluding 0 values do not therefore have to appear in the file.
The same applies to saving files. Antares only store "effectively relevant" data. In the example above, Antares determines after writing the last A0 byte that only 0 values will follow, and does not write these 0 values to the file.
Memory cells can contain an optional comment, which is displayed in the separate content view if "1 column" is selected as the display layout. Comments are separated from the data value in the file by a colon.
1F:Comment 7E 05:Comment2 B8 45:Comment3 A0
Because spaces are used to separate data cells and colons are used to separate data and comments, these two characters must be handled specially when they occur in comments. For this purpose, a so-called "escaping" with the help of the \ character (backslash) is used.
1F:This\ is\ a\ comment\ 7E 05:comment\ with\ \: B8 45:Comment \3 A0
File format "Single Lines"
The file format "Standard" is not very suitable for editing in an editor if there are many comments. This is the case, for example, if the file contains a machine program to be loaded into the ROM component of a microprocessor circuit. Such files can contain a comment with spaces in each line.
For this purpose Antares supports a second file format in which each data value including comment is on a separate line. With this file format it is therefore not necessary to escape blanks and colons.
#amd-nl-0.1 7000:Initialize I at 0800 1800 7065:Initialize L at 0801 1801 7000:Initialize S at 0802 1802 7001:Initialize ONE at 0803 1803 0801:IF (I == L) THEN GOTO END 3800 5013 0802:S = S + I 2800 1802 1FFE:Output S 0800:I = I + 1 2803 1800 6008:GOTO LOOP FF00:Stop program
In order for Antares to recognize the format when loading a file, the format ID amd-nl-0.1 must appear on the first line ("amd": Antares Memory Dump, "nl": Newline, 0.1: Version number of the format).
The corresponding format identifier of the "Standard" format is amd-df-0.1. It is optional. If Antares does not find a format identifier in a memory file to be loaded, the file will be interpreted as the default format. |
Show memory contents in the symbol
The property "Show content" can be used to control whether a part of the memory content should be displayed within the symbol. During simulation, Antares displays the memory content in the region of the current address and highlights the memory cell that is addressed. Comments are not displayed.
Show memory content separately
In addition to displaying the memory contents in the icon, the memory contents can also be displayed separately. Double-clicking a memory component opens a dialog that displays the memory content. In the "Layout" selection field, you can choose how many columns are displayed in a row. Comments are only displayed in the layout "1 Column".
When double-clicking with the Alt key pressed, the same view is displayed as subview in the main window. This can be useful if the contents of several memory components are to be displayed simultaneously.
Properties
- Orientation
-
The direction in which the data port is facing.
- Address Bit Width
-
The number of bits that make up the addresses of the memory component. This determines the number of memory cells of the memory component.
- Data Bit Width
-
The bit width of each memory cell.
- Show contents
-
Determines whether the memory content within the symbol should be displayed.
- Number of content rows
-
Can only be set if "Show content" is selected. Determines the number of rows of memory content display within the symbol.
- Number of content columns
-
Can only be set if "Show content" is selected. Determines the number of columns of the memory content display within the symbol.