1 package net.mograsim.machine;
3 public interface MemoryDefinition
7 * The number of bits that the main memory uses to address cells. Note that this does not need to equal
8 * {@link MachineDefinition#getAddressBits()}.
10 * @return the number of bits used to address a memory cell
11 * @author Christian Femers
13 int getMemoryAddressBits();
16 * The minimal address possible to address/use. This is usually 0.
18 * @return the minimal possible address.
19 * @author Christian Femers
21 long getMinimalAddress();
24 * The maximal address possible to address/use.
26 * @return the maximal possible address as <b>unsigned long</b>
27 * @author Christian Femers
29 long getMaximalAddress();
32 * The size of the MainMemory as the amount of addressable memory cells.
34 * @return the amount of addressable memory cells
38 return getMaximalAddress() - getMinimalAddress() + 1;
41 public static MemoryDefinition create(int memoryAddressBits, long minimalAddress, long maximalAddress)
43 return new StandardMemoryDefinition(memoryAddressBits, minimalAddress, maximalAddress);