projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update README to use GitHub Actions Build Status
[Mograsim.git]
/
plugins
/
net.mograsim.plugin.core
/
src
/
net
/
mograsim
/
plugin
/
launch
/
MainMemoryBlockExtension.java
diff --git
a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java
b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java
index
8d16998
..
5d4cf5d
100644
(file)
--- a/
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java
+++ b/
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java
@@
-25,7
+25,8
@@
import net.mograsim.preferences.Preferences;
public class MainMemoryBlockExtension extends PlatformObject implements IMemoryBlockExtension
{
public class MainMemoryBlockExtension extends PlatformObject implements IMemoryBlockExtension
{
- // TODO do we want to make the memory accessible byte-wise?
+ private static final byte MEM_BYTE_FLAGS = (byte) (MemoryByte.READABLE | MemoryByte.WRITABLE | MemoryByte.ENDIANESS_KNOWN
+ | MemoryByte.BIG_ENDIAN);
private final String expression;
private final MachineDebugTarget debugTarget;
private final String expression;
private final MachineDebugTarget debugTarget;
@@
-71,7
+72,7
@@
public class MainMemoryBlockExtension extends PlatformObject implements IMemoryB
if (baseAddrWords.compareTo(minAddrWords) < 0 || baseAddrWords.compareTo(maxAddrWords) > 0)
throwDebugException("Base address out of range");
if (baseAddrWords.compareTo(minAddrWords) < 0 || baseAddrWords.compareTo(maxAddrWords) > 0)
throwDebugException("Base address out of range");
- if (baseAddrWords.add(lengthWords).compareTo(maxAddrWords) > 0)
+ if (baseAddrWords.add(lengthWords).
subtract(BigInteger.ONE).
compareTo(maxAddrWords) > 0)
throwDebugException("End address out of range");
this.clients = new HashSet<>();
throwDebugException("End address out of range");
this.clients = new HashSet<>();
@@
-194,7
+195,7
@@
public class MainMemoryBlockExtension extends PlatformObject implements IMemoryB
@Override
public int getAddressSize() throws DebugException
{
@Override
public int getAddressSize() throws DebugException
{
- return
Long.BYTES
;
+ return
(getBigLength().bitLength() + 7) / 8
;
}
@Override
}
@Override
@@
-242,9
+243,9
@@
public class MainMemoryBlockExtension extends PlatformObject implements IMemoryB
int l = wordBytes[0] == 0 ? 1 : 0;
int k;
for (k = 0; k < cellWidthBytes - wordBytes.length + l; k++)
int l = wordBytes[0] == 0 ? 1 : 0;
int k;
for (k = 0; k < cellWidthBytes - wordBytes.length + l; k++)
- bytes[i + k] = new MemoryByte();
+ bytes[i + k] = new MemoryByte(
(byte) 0, MEM_BYTE_FLAGS
);
for (; k < cellWidthBytes; k++, l++)
for (; k < cellWidthBytes; k++, l++)
- bytes[i + k] = new MemoryByte(wordBytes[l]);
+ bytes[i + k] = new MemoryByte(wordBytes[l]
, MEM_BYTE_FLAGS
);
} else
for (int k = 0; k < cellWidthBytes; k++)
bytes[i + k] = new MemoryByte((byte) 0, (byte) 0);
} else
for (int k = 0; k < cellWidthBytes; k++)
bytes[i + k] = new MemoryByte((byte) 0, (byte) 0);