X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodel%2Fcomponents%2Fmi%2Fnandbased%2Fam2901%2FGUIAm2901ALUOneBit.java;fp=net.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodel%2Fcomponents%2Fmi%2Fnandbased%2Fam2901%2FGUIAm2901ALUOneBit.java;h=453a6694cea4024c5d2869b26438ce50c62eae2f;hb=b5d8c2d71e27350ea7c9314e40df5bb0584271cd;hp=0000000000000000000000000000000000000000;hpb=69cb6725ef670328959d55649257ded6ac924b33;p=Mograsim.git diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/model/components/mi/nandbased/am2901/GUIAm2901ALUOneBit.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/model/components/mi/nandbased/am2901/GUIAm2901ALUOneBit.java new file mode 100644 index 00000000..453a6694 --- /dev/null +++ b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/model/components/mi/nandbased/am2901/GUIAm2901ALUOneBit.java @@ -0,0 +1,101 @@ +package net.mograsim.logic.model.model.components.mi.nandbased.am2901; + +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.mograsim.logic.model.model.ViewModelModifiable; +import net.mograsim.logic.model.model.components.atomic.GUINandGate; +import net.mograsim.logic.model.model.components.mi.nandbased.GUIand; +import net.mograsim.logic.model.model.components.mi.nandbased.GUIfulladder; +import net.mograsim.logic.model.model.components.mi.nandbased.GUImux1; +import net.mograsim.logic.model.model.components.mi.nandbased.GUIxor; +import net.mograsim.logic.model.model.components.submodels.SimpleRectangularSubmodelComponent; +import net.mograsim.logic.model.model.wires.GUIWire; +import net.mograsim.logic.model.model.wires.Pin; +import net.mograsim.logic.model.model.wires.WireCrossPoint; +import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; + +public class GUIAm2901ALUOneBit extends SimpleRectangularSubmodelComponent +{ + public GUIAm2901ALUOneBit(ViewModelModifiable model) + { + this(model, null); + } + + public GUIAm2901ALUOneBit(ViewModelModifiable model, String name) + { + super(model, 1, "GUIAm2901ALUOneBit", name); + setSubmodelScale(.2); + setInputPins("Cin", "CoutE", "CinE", "R", "RN", "S", "SN", "FN", "L"); + setOutputPins("Cout", "F"); + initSubmodelComponents(); + } + + @SuppressWarnings("unused") // for GUIWires being created + private void initSubmodelComponents() + { + Pin Cin = getSubmodelPin("Cin"); + Pin CoutE = getSubmodelPin("CoutE"); + Pin CinE = getSubmodelPin("CinE"); + Pin R = getSubmodelPin("R"); + Pin RN = getSubmodelPin("RN"); + Pin S = getSubmodelPin("S"); + Pin SN = getSubmodelPin("SN"); + Pin FN = getSubmodelPin("FN"); + Pin L = getSubmodelPin("L"); + Pin Cout = getSubmodelPin("Cout"); + Pin F = getSubmodelPin("F"); + + GUIand Cinand = new GUIand(submodelModifiable); + GUIxor Rxor = new GUIxor(submodelModifiable); + GUIxor Sxor = new GUIxor(submodelModifiable); + GUIfulladder add = new GUIfulladder(submodelModifiable); + GUINandGate nand = new GUINandGate(submodelModifiable, 1); + GUIand Coutand = new GUIand(submodelModifiable); + GUImux1 Fsel = new GUImux1(submodelModifiable); + GUIxor Fxor = new GUIxor(submodelModifiable); + + WireCrossPoint cpRXored = new WireCrossPoint(submodelModifiable, 1); + WireCrossPoint cpSXored = new WireCrossPoint(submodelModifiable, 1); + + Cinand.moveTo(10, 20); + Rxor.moveTo(10, 190); + Sxor.moveTo(10, 290); + add.moveTo(60, 20); + nand.moveTo(60, 55); + Coutand.moveTo(135, 20); + Fsel.moveTo(90, 70); + Fxor.moveTo(135, 70); + cpRXored.moveCenterTo(50, 60); + cpSXored.moveCenterTo(55, 70); + + new GUIWire(submodelModifiable, Cin, Cinand.getPin("A"), new Point[0]); + new GUIWire(submodelModifiable, CoutE, Coutand.getPin("A"), new Point(5, 75), new Point(5, 10), new Point(130, 10), + new Point(130, 25)); + new GUIWire(submodelModifiable, CinE, Cinand.getPin("B"), new Point(7.5, 125), new Point(7.5, 35)); + new GUIWire(submodelModifiable, R, Rxor.getPin("A")); + new GUIWire(submodelModifiable, RN, Rxor.getPin("B")); + new GUIWire(submodelModifiable, S, Sxor.getPin("A")); + new GUIWire(submodelModifiable, SN, Sxor.getPin("B")); + new GUIWire(submodelModifiable, FN, Fxor.getPin("B"), new Point(130, 375), new Point(130, 85)); + new GUIWire(submodelModifiable, L, Fsel.getPin("S0"), new Point(87.5, 425), new Point(87.5, 75)); + new GUIWire(submodelModifiable, Cinand.getPin("Y"), add.getPin("A"), new Point[0]); + new GUIWire(submodelModifiable, Rxor.getPin("Y"), cpRXored, new Point(50, 195)); + new GUIWire(submodelModifiable, cpRXored, add.getPin("B"), new Point(50, 35)); + new GUIWire(submodelModifiable, cpRXored, nand.getPin("A"), new Point[0]); + new GUIWire(submodelModifiable, Sxor.getPin("Y"), cpSXored, new Point(55, 295)); + new GUIWire(submodelModifiable, cpSXored, add.getPin("C"), new Point(55, 45)); + new GUIWire(submodelModifiable, cpSXored, nand.getPin("B"), new Point[0]); + new GUIWire(submodelModifiable, add.getPin("Y"), Fsel.getPin("I0"), new Point(100, 25), new Point(100, 65), new Point(85, 65), + new Point(85, 85)); + new GUIWire(submodelModifiable, add.getPin("Z"), Coutand.getPin("B"), new Point[0]); + new GUIWire(submodelModifiable, nand.getPin("Y"), Fsel.getPin("I1"), new Point(82.5, 65), new Point(82.5, 95)); + new GUIWire(submodelModifiable, Fsel.getPin("Y"), Fxor.getPin("A"), new Point[0]); + new GUIWire(submodelModifiable, Coutand.getPin("Y"), Cout, new Point[0]); + new GUIWire(submodelModifiable, Fxor.getPin("Y"), F, new Point[0]); + } + + static + { + IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUOneBit.class.getCanonicalName(), + (m, p, n) -> new GUIAm2901ALUOneBit(m, n)); + } +} \ No newline at end of file