-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemorySlot.java
More file actions
45 lines (36 loc) · 1.1 KB
/
MemorySlot.java
File metadata and controls
45 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
public class MemorySlot {
private int start; // the address where the memory slot starts
private int end; // the address where the memory slot ends
private final int blockStart; // address of where the block starts
private final int blockEnd; // address of where the block ends
/* The following should always hold true:
* start >= blockStart
* end <= blockEnd */
public MemorySlot(int start, int end, int blockStart, int blockEnd) {
if ((start < blockStart) || (end > blockEnd)) {
throw new java.lang.RuntimeException("Memory access out of bounds.");
}
this.start = start;
this.end = end;
this.blockStart = blockStart;
this.blockEnd = blockEnd;
}
public int getBlockStart() {
return blockStart;
}
public int getBlockEnd() {
return blockEnd;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
}