X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fam2900%2Fcomponents%2FGUIram5_12.java;h=7a1409e8b198cc9b40aa8a3997f2a5c0c7c046de;hb=bfd483ea32de08383550ba6903f77c11c33ea36d;hp=a8c397c3efcf530f2921dd9f5586da896f7d418c;hpb=1456c337d67378f8efb78a7066d6538e24a6beb4;p=Mograsim.git diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIram5_12.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIram5_12.java index a8c397c3..7a1409e8 100644 --- a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIram5_12.java +++ b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIram5_12.java @@ -81,7 +81,6 @@ public class GUIram5_12 extends SimpleRectangularHardcodedGUIComponent for (int i = 0; i < 3; i++) if (bits[i] == Z) return -1; - // TODO maybe this is the wrong way around return (bits[0] == ONE ? 4 : 0) + (bits[1] == ONE ? 2 : 0) + (bits[2] == ONE ? 1 : 0); } @@ -104,9 +103,11 @@ public class GUIram5_12 extends SimpleRectangularHardcodedGUIComponent { int addr = Integer.parseInt(m.group(1), 2); BitVector newHighLevelStateCasted = (BitVector) newHighLevelState; - if (newHighLevelStateCasted.length() != 3) - throw new IllegalArgumentException("Expected BitVector of length 3, not " + newHighLevelStateCasted.length()); - return ((BitVector[]) lastState)[addr] = newHighLevelStateCasted; + if (newHighLevelStateCasted.length() != 12) + throw new IllegalArgumentException("Expected BitVector of length 12, not " + newHighLevelStateCasted.length()); + BitVector[] memC = (BitVector[]) lastState; + memC[addr] = newHighLevelStateCasted; + return memC; } return super.setHighLevelState(lastState, stateID, newHighLevelState); }