JSS Device MemoryW4D4
This device simulates a memory with word size 4-bits and data bus connection 4-bits. Internally, data is stored in bytes (two 4-bit words are packed into a byte). When an address is read the memory will return data in the lower 4-bits of the Java long value. When written, only the lower 4-bits will be taken into consideration and stored according to the specified address. This type of memory is useful with 4-bit CPUs, such as the Intel 4004.
Options
- initialization_policy - Decides how this memory is initialized. Values:
- ZERO - All locations are initialized with zero.
- RANDOM - Locations are initialized with random values.
- FIXED - Locations are initialized with a fixed value, set by the "fixed_value" option.
- VALUES - Individual values are specified in the "initialization_values" option.
- fixed_value - Value used to initialize memory when the "initialization_policy" is set to "FIXED".
- initialization_values - List of values used to initialize the memory, separated by space or comma. Only the number of values present in the list are used (some memory locations may remain uninitialized if the list has less values than the memory size).
- load_hex - Specifies a HEX file that will be read in the memory.
- load_hex_offset - This value is subtracted from the address specified in the HEX file.
- load_bin - Specifies a BINARY file that will be read in the memory.
- load_bin_offset - Specifies the starting address for the BINARY file. Its use differs from the HEX file, since the BINARY file does not have any address specified internally.
- invert_nibbles - When loading either a HEX file or a BINARY file, it will invert the nibbles. This may be useful with 4-bit memory if the values were stored in the HEX file in reverse order.
Implementation
https://github.com/ComputingMongoose/JavaSystemSimulator/blob/main/src/jss/devices/memory/impl/MemoryW4D4.javaExample configuration
{
"name":"DataRAM",
"type":"MemoryW4D4",
"configuration":[
{"key":"size", "value":500},
{"key":"initialization_policy", "value":"ZERO"}
]
}