X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.machine%2Fsrc%2Fnet%2Fmograsim%2Fmachine%2FMainMemoryDefinition.java;h=72153d6dfce722fef47400ff726457905b381c7a;hb=8bed58cd47f4e53a0a83e066d38864aa6875502f;hp=f01d119daae78400d7f0b68fbf3fe40cf5a50800;hpb=f37f1f93f2c1ceb780f1c7ecab888bcb8f4f8b89;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..72153d6d 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java @@ -1,55 +1,24 @@ package net.mograsim.machine; /** - * This interface provides a means to get information about the machines memory - * architecture. It is not bound to any actual memory. + * This interface provides a means to get information about the machines memory architecture. It is not bound to any actual memory. * * @author Christian Femers * */ -public interface MainMemoryDefinition { - +public interface MainMemoryDefinition extends MemoryDefinition +{ /** - * 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(); - - /** - * 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. + * 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. * * @return the addressable unit width in bits * @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); } }