X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2Fmi%2Fnandbased%2FGUIdff.java;h=dc53862bb45f69ebcd91aa622c147ee2daafad58;hb=574918bb58faa3c617911ed4f629f90066668364;hp=40f33310764e73ef5eb6e214f261d981e75be173;hpb=f14ea37d69488dd51518a36413af7176916b8bd7;p=Mograsim.git diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java index 40f33310..dc53862b 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java @@ -10,6 +10,8 @@ import net.mograsim.logic.ui.model.wires.WireCrossPoint; public class GUIdff extends SimpleRectangularSubmodelComponent { + private GUI_rsLatch _rsLatch; + public GUIdff(ViewModelModifiable model) { super(model, 1, "GUIdff"); @@ -30,7 +32,7 @@ public class GUIdff extends SimpleRectangularSubmodelComponent GUI_rsLatch _rsLatch1 = new GUI_rsLatch(submodelModifiable); GUInand3 nand3 = new GUInand3(submodelModifiable); GUINandGate nand2 = new GUINandGate(submodelModifiable, 1); - GUI_rsLatch _rsLatch2 = new GUI_rsLatch(submodelModifiable); + GUI_rsLatch _rsLatch2 = this._rsLatch = new GUI_rsLatch(submodelModifiable); WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1); WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1); @@ -61,5 +63,34 @@ public class GUIdff extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, cp4, nand2.getPin("A"), new Point(100, 65)); new GUIWire(submodelModifiable, _rsLatch2.getPin("Q"), Q); new GUIWire(submodelModifiable, _rsLatch2.getPin("_Q"), _Q); + + addAtomicHighLevelStateID("q"); + } + + @Override + public void setAtomicHighLevelState(String stateID, Object newState) + { + switch (stateID) + { + case "q": + _rsLatch.setHighLevelState("q", newState); + break; + default: + // should not happen because we tell SubmodelComponent to only allow these state IDs. + throw new IllegalStateException("Illegal atomic state ID: " + stateID); + } + } + + @Override + public Object getAtomicHighLevelState(String stateID) + { + switch (stateID) + { + case "q": + return _rsLatch.getHighLevelState("q"); + default: + // should not happen because we tell SubmodelComponent to only allow these state IDs. + throw new IllegalStateException("Illegal atomic state ID: " + stateID); + } } } \ No newline at end of file