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=4a13c471055e188252fbdf7eebc06e0b10842dc1;hb=0a04a4ed66ecebd4254541c4977599f6052c115a;hp=a8c397c3efcf530f2921dd9f5586da896f7d418c;hpb=21ffb2a7f764069fb3c55b71647b43e8803e668c;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..4a13c471 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 @@ -13,8 +13,8 @@ import java.util.regex.Pattern; import net.mograsim.logic.core.types.Bit; import net.mograsim.logic.core.types.BitVector; -import net.mograsim.logic.core.wires.Wire.ReadEnd; -import net.mograsim.logic.core.wires.Wire.ReadWriteEnd; +import net.mograsim.logic.core.wires.CoreWire.ReadEnd; +import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd; import net.mograsim.logic.model.model.ViewModelModifiable; import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedGUIComponent; import net.mograsim.logic.model.model.wires.Pin; @@ -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); } @@ -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); }