1 package net.mograsim.logic.model.model.components.mi.nandbased.am2901;
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.model.model.ViewModelModifiable;
5 import net.mograsim.logic.model.model.components.atomic.GUINandGate;
6 import net.mograsim.logic.model.model.components.mi.nandbased.GUIand;
7 import net.mograsim.logic.model.model.components.mi.nandbased.GUIfulladder;
8 import net.mograsim.logic.model.model.components.mi.nandbased.GUImux1;
9 import net.mograsim.logic.model.model.components.mi.nandbased.GUIxor;
10 import net.mograsim.logic.model.model.components.submodels.SimpleRectangularSubmodelComponent;
11 import net.mograsim.logic.model.model.wires.GUIWire;
12 import net.mograsim.logic.model.model.wires.Pin;
13 import net.mograsim.logic.model.model.wires.WireCrossPoint;
14 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
16 public class GUIAm2901ALUOneBit extends SimpleRectangularSubmodelComponent
18 public GUIAm2901ALUOneBit(ViewModelModifiable model)
23 public GUIAm2901ALUOneBit(ViewModelModifiable model, String name)
25 super(model, 1, "GUIAm2901ALUOneBit", name);
27 setInputPins("Cin", "CoutE", "CinE", "R", "RN", "S", "SN", "FN", "L");
28 setOutputPins("Cout", "F");
29 initSubmodelComponents();
32 @SuppressWarnings("unused") // for GUIWires being created
33 private void initSubmodelComponents()
35 Pin Cin = getSubmodelPin("Cin");
36 Pin CoutE = getSubmodelPin("CoutE");
37 Pin CinE = getSubmodelPin("CinE");
38 Pin R = getSubmodelPin("R");
39 Pin RN = getSubmodelPin("RN");
40 Pin S = getSubmodelPin("S");
41 Pin SN = getSubmodelPin("SN");
42 Pin FN = getSubmodelPin("FN");
43 Pin L = getSubmodelPin("L");
44 Pin Cout = getSubmodelPin("Cout");
45 Pin F = getSubmodelPin("F");
47 GUIand Cinand = new GUIand(submodelModifiable);
48 GUIxor Rxor = new GUIxor(submodelModifiable);
49 GUIxor Sxor = new GUIxor(submodelModifiable);
50 GUIfulladder add = new GUIfulladder(submodelModifiable);
51 GUINandGate nand = new GUINandGate(submodelModifiable, 1);
52 GUIand Coutand = new GUIand(submodelModifiable);
53 GUImux1 Fsel = new GUImux1(submodelModifiable);
54 GUIxor Fxor = new GUIxor(submodelModifiable);
56 WireCrossPoint cpRXored = new WireCrossPoint(submodelModifiable, 1);
57 WireCrossPoint cpSXored = new WireCrossPoint(submodelModifiable, 1);
59 Cinand.moveTo(10, 20);
64 Coutand.moveTo(135, 20);
67 cpRXored.moveCenterTo(50, 60);
68 cpSXored.moveCenterTo(55, 70);
70 new GUIWire(submodelModifiable, Cin, Cinand.getPin("A"), new Point[0]);
71 new GUIWire(submodelModifiable, CoutE, Coutand.getPin("A"), new Point(5, 75), new Point(5, 10), new Point(130, 10),
73 new GUIWire(submodelModifiable, CinE, Cinand.getPin("B"), new Point(7.5, 125), new Point(7.5, 35));
74 new GUIWire(submodelModifiable, R, Rxor.getPin("A"));
75 new GUIWire(submodelModifiable, RN, Rxor.getPin("B"));
76 new GUIWire(submodelModifiable, S, Sxor.getPin("A"));
77 new GUIWire(submodelModifiable, SN, Sxor.getPin("B"));
78 new GUIWire(submodelModifiable, FN, Fxor.getPin("B"), new Point(130, 375), new Point(130, 85));
79 new GUIWire(submodelModifiable, L, Fsel.getPin("S0"), new Point(87.5, 425), new Point(87.5, 75));
80 new GUIWire(submodelModifiable, Cinand.getPin("Y"), add.getPin("A"), new Point[0]);
81 new GUIWire(submodelModifiable, Rxor.getPin("Y"), cpRXored, new Point(50, 195));
82 new GUIWire(submodelModifiable, cpRXored, add.getPin("B"), new Point(50, 35));
83 new GUIWire(submodelModifiable, cpRXored, nand.getPin("A"), new Point[0]);
84 new GUIWire(submodelModifiable, Sxor.getPin("Y"), cpSXored, new Point(55, 295));
85 new GUIWire(submodelModifiable, cpSXored, add.getPin("C"), new Point(55, 45));
86 new GUIWire(submodelModifiable, cpSXored, nand.getPin("B"), new Point[0]);
87 new GUIWire(submodelModifiable, add.getPin("Y"), Fsel.getPin("I0"), new Point(100, 25), new Point(100, 65), new Point(85, 65),
89 new GUIWire(submodelModifiable, add.getPin("Z"), Coutand.getPin("B"), new Point[0]);
90 new GUIWire(submodelModifiable, nand.getPin("Y"), Fsel.getPin("I1"), new Point(82.5, 65), new Point(82.5, 95));
91 new GUIWire(submodelModifiable, Fsel.getPin("Y"), Fxor.getPin("A"), new Point[0]);
92 new GUIWire(submodelModifiable, Coutand.getPin("Y"), Cout, new Point[0]);
93 new GUIWire(submodelModifiable, Fxor.getPin("Y"), F, new Point[0]);
98 IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUOneBit.class.getCanonicalName(),
99 (m, p, n) -> new GUIAm2901ALUOneBit(m, n));