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=a4dd04a7d2bd87fa91cb9b1b20c6def2ff8f0264;hb=670c28835b67281935fbd3e20f83c127292994ad;hp=d8934cedfbe23f13abe20d000800e03ef2f75745;hpb=81d89ebec7f67ddcfda22018d5dbfebe64fbe11a;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 d8934ced..a4dd04a7 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 @@ -114,6 +114,7 @@ public class TestableAm2901Impl implements TestableAm2901 for (String id : am2901.getOutputPinNames()) { GUIBitDisplay bd = new GUIBitDisplay(viewModel); +// bd.addRedrawListener(() -> System.out.println(id + " " + bd.getBitDisplay().getDisplayedValue())); new GUIWire(viewModel, am2901.getPin(id), bd.getInputPin()); idDisplayMap.put(id, bd); } @@ -127,8 +128,6 @@ public class TestableAm2901Impl implements TestableAm2901 setField(entry.getKey().replaceAll("\\+|=", "_"), entry.getValue().getManualSwitch()); for (var entry : idDisplayMap.entrySet()) setField(entry.getKey().replaceAll("\\+|=", "_"), entry.getValue().getBitDisplay()); - // Switch Clock off first - C.switchOff(); // Debug code HashSet wiresIncludingSubmodels = new HashSet<>(); @@ -146,7 +145,6 @@ public class TestableAm2901Impl implements TestableAm2901 { if (debugWires) { - System.out.println(w); wireDebugChangeSet.add(w.toString()); } })); @@ -247,9 +245,9 @@ public class TestableAm2901Impl implements TestableAm2901 } @Override - public void toogleClock() + public void clockOn(boolean isClockOn) { - C.toggle(); + C.setState(isClockOn); } @Override @@ -347,4 +345,23 @@ public class TestableAm2901Impl implements TestableAm2901 } return mutator.toBitVector(); } + + @Override + public void setDirectly(Register r, String val_4_bit) + { + am2901.setHighLevelState(regToStateID(r), BitVector.parse(val_4_bit)); + } + + @Override + public String getDirectly(Register r) + { + return am2901.getHighLevelState(regToStateID(r)).toString(); + } + + private static String regToStateID(Register r) + { + if (r == Register.Q) + return "qreg.q"; + return "regs.c" + r.toBitString() + ".q"; + } }