Added size() in MainMemoryDefinition
authorFabian Stemmler <stemmler@in.tum.de>
Mon, 26 Aug 2019 11:09:58 +0000 (13:09 +0200)
committerFabian Stemmler <stemmler@in.tum.de>
Mon, 26 Aug 2019 11:09:58 +0000 (13:09 +0200)
net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java

index 3128cdd..f01d119 100644 (file)
@@ -42,4 +42,14 @@ public interface MainMemoryDefinition {
         * @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()
+       {
+               return getMaximalAddress() - getMinimalAddress();
+       }
 }