X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui.am2900%2Ftest%2Fnet%2Fmograsim%2Flogic%2Fui%2Fam2900%2FTestableAm2901Impl.java;h=9ca395af2d755389fce1debe20d04ed81f47deb8;hb=a2eef1d1616d03af5b464f347f6176ea9d2cc75e;hp=0b1adc2b39435d60e1b66aa9fe4bd5486b557738;hpb=1964378a139b469b535d78ab1e77524214303b30;p=Mograsim.git diff --git a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java index 0b1adc2b..9ca395af 100644 --- a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java +++ b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java @@ -19,11 +19,11 @@ import net.mograsim.logic.core.types.BitVector; import net.mograsim.logic.core.types.BitVector.BitVectorMutator; import net.mograsim.logic.ui.model.ViewModel; import net.mograsim.logic.ui.model.ViewModelModifiable; -import net.mograsim.logic.ui.model.components.GUIBitDisplay; import net.mograsim.logic.ui.model.components.GUIComponent; -import net.mograsim.logic.ui.model.components.GUIManualSwitch; -import net.mograsim.logic.ui.model.components.SubmodelComponent; +import net.mograsim.logic.ui.model.components.atomic.GUIBitDisplay; +import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch; import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.modeladapter.LogicModelParameters; import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter; @@ -181,8 +181,7 @@ public class TestableAm2901Impl implements TestableAm2901 @Override public void setReg_A(String val_4_bit) { - // reverse because the BitVector.parse() expects the LSBit at the beginning and the MSBit at the end - var bits = BitVector.parse(new StringBuilder(val_4_bit).reverse().toString()); + var bits = BitVector.parseMSBFirst(val_4_bit); A3.setToValueOf(bits.getBit(3)); A2.setToValueOf(bits.getBit(2)); A1.setToValueOf(bits.getBit(1)); @@ -192,8 +191,7 @@ public class TestableAm2901Impl implements TestableAm2901 @Override public void setReg_B(String val_4_bit) { - // reverse because the BitVector.parse() expects the LSBit at the beginning and the MSBit at the end - var bits = BitVector.parse(new StringBuilder(val_4_bit).reverse().toString()); + var bits = BitVector.parseMSBFirst(val_4_bit); B3.setToValueOf(bits.getBit(3)); B2.setToValueOf(bits.getBit(2)); B1.setToValueOf(bits.getBit(1)); @@ -215,8 +213,7 @@ public class TestableAm2901Impl implements TestableAm2901 @Override public void setD(String val_4_bit) { - // reverse because the BitVector.parse() expects the LSBit at the beginning and the MSBit at the end - var bits = BitVector.parse(new StringBuilder(val_4_bit).reverse().toString()); + var bits = BitVector.parseMSBFirst(val_4_bit); D4.setToValueOf(bits.getBit(3)); D3.setToValueOf(bits.getBit(2)); D2.setToValueOf(bits.getBit(1)); @@ -320,8 +317,7 @@ public class TestableAm2901Impl implements TestableAm2901 var y2 = Y3.getDisplayedValue(); var y1 = Y2.getDisplayedValue(); var y0 = Y1.getDisplayedValue(); - // reverse because BitVector.toString() returns the LSBit at the beginning and the MSBit at the end - return new StringBuilder(y0.concat(y1).concat(y2).concat(y3).toString()).reverse().toString(); + return y0.concat(y1).concat(y2).concat(y3).toBitStringMSBFirst(); } private void setField(String name, Object value) @@ -353,15 +349,13 @@ public class TestableAm2901Impl implements TestableAm2901 @Override public void setDirectly(Register r, String val_4_bit) { - // reverse because the BitVector.parse() expects the LSBit at the beginning and the MSBit at the end - am2901.setHighLevelState(regToStateID(r), BitVector.parse(new StringBuilder(val_4_bit).reverse().toString())); + am2901.setHighLevelState(regToStateID(r), BitVector.parseMSBFirst(val_4_bit)); } @Override public String getDirectly(Register r) { - // reverse because BitVector.toString() returns the LSBit at the beginning and the MSBit at the end - return new StringBuilder(am2901.getHighLevelState(regToStateID(r)).toString()).reverse().toString(); + return ((BitVector) am2901.getHighLevelState(regToStateID(r))).toBitStringMSBFirst(); } private static String regToStateID(Register r)