X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.machine%2Fsrc%2Fnet%2Fmograsim%2Fmachine%2FMainMemoryDefinition.java;h=4f696736274a61bd3c831e131a3bdb6751c05d4f;hb=97fd4dc20d7db4f5b3d162f56910df4fc56b7871;hp=f01d119daae78400d7f0b68fbf3fe40cf5a50800;hpb=853d979edee5d49d3b3c5fe08609f6cfd82d863f;p=Mograsim.git diff --git a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java index f01d119d..4f696736 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java @@ -7,17 +7,8 @@ package net.mograsim.machine; * @author Christian Femers * */ -public interface MainMemoryDefinition { - - /** - * The number of bits that the main memory uses to address cells. Note that this - * does not need to equal {@link MachineDefinition#getAddressBits()}. - * - * @return the number of bits used to address a memory cell - * @author Christian Femers - */ - int getMemoryAddressBits(); - +public interface MainMemoryDefinition extends MemoryDefinition +{ /** * The width in bits of an addressable memory cell/unit. This is often 8 (= one * byte). The actual cells/lines of the memory may be a lot larger. @@ -26,30 +17,9 @@ public interface MainMemoryDefinition { * @author Christian Femers */ int getCellWidth(); - - /** - * The minimal address possible to address/use. This is usually 0. - * - * @return the minimal possible address. - * @author Christian Femers - */ - long getMinimalAddress(); - - /** - * The maximal address possible to address/use. - * - * @return the maximal possible address as unsigned long - * @author Christian Femers - */ - long getMaximalAddress(); - /** - * The size of the MainMemory as the amount of addressable memory cells. - * - * @return the amount of addressable memory cells - */ - default long size() + public static MainMemoryDefinition create(int memoryAddressBits, int cellWidth, long minimalAddress, long maximalAddress) { - return getMaximalAddress() - getMinimalAddress(); + return new StandardMainMemoryDefinition(memoryAddressBits, cellWidth, minimalAddress, maximalAddress); } }