Next: Formal Syntax, Previous: Specifying Registers, Up: Configuration
The specification of memory blocks follows the machine description and register specification. Multiple blocks may be specified.
Memory is assumed to be byte addressed. It may be initialized as either bytes or words (in which case the endianness is taken into account).
Byte memory is specified by the keywords BYTE MEMORY
followed by
a comma separated list within parentheses specifying the start address
of the memory and its size in bytes.
For example a 256 byte memory at location 0x8000 would be specified as follows.
BYTE MEMORY (0x8000, 256)
This declaration is optionally followed by a comma separated list of bytes
giving initial values of locations. Not all (or any) locations need be
specified. Any unspecified will be uninitialized. There may not be more
bytes specified than the size of the memory. Thus the first 12 bytes of
the memory specified at location 0x8000 could be set to the ASCII
representation of C string "Hello World"
as follows.
BYTE MEMORY (0x8000, 256) 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x00
The byte list ends at the end of file, or the start of the next memory block specification.
Word memory is specified by the keywords WORD MEMORY
followed by
a comma separated list within parentheses specifying the start address
of the memory and its size in bytes.
Note: The size is still in bytes, even though this is word memory.
For example a 0x3a0 byte long memory at location 0x1000 would be specified as follows.
WORD MEMORY (0x1000, 0x3a0)
This declamation is optionally followed by a comma separated list of words giving initial values of locations. These will be stored in bytes of memory according to the endianness specified in the machine description.
Note: Words are assumed to be 4 bytes long. This is a limitation of the current implementation.
As with byte memory, not all (or any) locations need be specified. Any unspecified will be uninitialized. There may not be more words specified than the size of the memory. The memory specified at location 0x1000 could be initialized with an OpenRISC 1000 program image as follows:
WORD MEMORY (0x1000, 0x3a0) 0x9c21fff8, 0xd4011000, 0x9c410008, 0xd7e21ffc, 0x15000001, 0x84410000, 0x44004800, 0x9c210008, 0x9c21fff8, 0xd4011000, 0x9c410008, 0xd7e21ffc, 0x15000004, 0x84410000, 0x44004800, 0x9c210008, ... lots more similar ... 0x07ffffb0, 0x15000000, 0x9c60002a, 0x07ffff74, 0x15000000, 0x18600000, 0xa86313bd, 0x07ffffa9, 0x15000000, 0x07ffffe3, 0x15000000, 0x8562fffc, 0x85210000, 0x84410004, 0x44004800, 0x9c21000c
The word list ends at the end of file, or the start of the next memory block specification.