Added size() in MainMemoryDefinition
[Mograsim.git] / 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();
+       }
 }