Revisited some hardcoded components
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / am2900 / components / GUIram5_12.java
index d1871f4..7a1409e 100644 (file)
@@ -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);
        }