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=f46b68d1c18adc48b21b469c826b1fa1ead0f8ec;hb=646f89aaa0e5527a536d8a8b0188e6db87a11a05;hp=d1871f452f4132a8ea6e2a50c1655365f3c2a01c;hpb=d07d97764c8f41ff26f76e59d4d2f1789c2bcc9e;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 d1871f45..f46b68d1 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 @@ -26,7 +26,7 @@ public class GUIram5_12 extends SimpleRectangularHardcodedGUIComponent { public GUIram5_12(ViewModelModifiable model, String name) { - super(model, name, "RAM\n5 x 12 Bit"); + super(model, "GUIram5_12", name, "RAM\n5 x 12 Bit"); setSize(40, 40); addPin(new Pin(this, "A", 3, PinUsage.INPUT, 10, 0), Position.BOTTOM); addPin(new Pin(this, "B", 3, PinUsage.INPUT, 30, 0), Position.BOTTOM); @@ -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); } @@ -106,7 +105,9 @@ public class GUIram5_12 extends SimpleRectangularHardcodedGUIComponent BitVector newHighLevelStateCasted = (BitVector) newHighLevelState; if (newHighLevelStateCasted.length() != 12) throw new IllegalArgumentException("Expected BitVector of length 12, not " + newHighLevelStateCasted.length()); - return ((BitVector[]) lastState)[addr] = newHighLevelStateCasted; + BitVector[] memC = (BitVector[]) lastState; + memC[addr] = newHighLevelStateCasted; + return memC; } return super.setHighLevelState(lastState, stateID, newHighLevelState); }