projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added Am2900 MainMemory and MicroInstructionMemory Core/Model Components
[Mograsim.git]
/
net.mograsim.machine
/
src
/
net
/
mograsim
/
machine
/
Memory.java
diff --git
a/net.mograsim.machine/src/net/mograsim/machine/Memory.java
b/net.mograsim.machine/src/net/mograsim/machine/Memory.java
index
e421e47
..
77c0d48
100644
(file)
--- a/
net.mograsim.machine/src/net/mograsim/machine/Memory.java
+++ b/
net.mograsim.machine/src/net/mograsim/machine/Memory.java
@@
-16,7
+16,11
@@
public interface Memory<T>
*/
public void setCell(long address, T data);
*/
public void setCell(long address, T data);
- public long size();
+ public default long size()
+ {
+ MemoryDefinition def = getDefinition();
+ return Long.max(0, def.getMaximalAddress() - def.getMinimalAddress() + 1);
+ }
/**
* Registers an observer to be notified when a memory cell is modified
/**
* Registers an observer to be notified when a memory cell is modified
@@
-26,4
+30,6
@@
public interface Memory<T>
public void deregisterObserver(MemoryObserver ob);
public void notifyObservers(long address);
public void deregisterObserver(MemoryObserver ob);
public void notifyObservers(long address);
+
+ public MemoryDefinition getDefinition();
}
}