1 package net.mograsim.machine;
3 public interface MemoryDefinition {
6 * The number of bits that the main memory uses to address cells. Note that this
7 * does not need to equal {@link MachineDefinition#getAddressBits()}.
9 * @return the number of bits used to address a memory cell
10 * @author Christian Femers
12 int getMemoryAddressBits();
15 * The minimal address possible to address/use. This is usually 0.
17 * @return the minimal possible address.
18 * @author Christian Femers
20 long getMinimalAddress();
23 * The maximal address possible to address/use.
25 * @return the maximal possible address as <b>unsigned long</b>
26 * @author Christian Femers
28 long getMaximalAddress();
31 * The size of the MainMemory as the amount of addressable memory cells.
33 * @return the amount of addressable memory cells
37 return getMaximalAddress() - getMinimalAddress() + 1;
40 public static MemoryDefinition create(int memoryAddressBits, long minimalAddress, long maximalAddress)
42 return new StandardMemoryDefinition(memoryAddressBits, minimalAddress, maximalAddress);