1 package net.mograsim.logic.ui.model.components.mi.nandbased.am2901;
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.ui.model.ViewModelModifiable;
5 import net.mograsim.logic.ui.model.components.atomic.GUINandGate;
6 import net.mograsim.logic.ui.model.components.mi.nandbased.GUIand;
7 import net.mograsim.logic.ui.model.components.mi.nandbased.GUIfulladder;
8 import net.mograsim.logic.ui.model.components.mi.nandbased.GUImux1;
9 import net.mograsim.logic.ui.model.components.mi.nandbased.GUIxor;
10 import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent;
11 import net.mograsim.logic.ui.model.wires.GUIWire;
12 import net.mograsim.logic.ui.model.wires.Pin;
13 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
15 public class GUIAm2901ALUOneBit extends SimpleRectangularSubmodelComponent
17 public GUIAm2901ALUOneBit(ViewModelModifiable model)
19 super(model, 1, "GUIAm2901ALUOneBit");
21 setInputPins("Cin", "CoutE", "CinE", "R", "RN", "S", "SN", "FN", "L");
22 setOutputPins("Cout", "F");
23 initSubmodelComponents();
26 @SuppressWarnings("unused") // for GUIWires being created
27 private void initSubmodelComponents()
29 Pin Cin = getSubmodelPin("Cin");
30 Pin CoutE = getSubmodelPin("CoutE");
31 Pin CinE = getSubmodelPin("CinE");
32 Pin R = getSubmodelPin("R");
33 Pin RN = getSubmodelPin("RN");
34 Pin S = getSubmodelPin("S");
35 Pin SN = getSubmodelPin("SN");
36 Pin FN = getSubmodelPin("FN");
37 Pin L = getSubmodelPin("L");
38 Pin Cout = getSubmodelPin("Cout");
39 Pin F = getSubmodelPin("F");
41 GUIand Cinand = new GUIand(submodelModifiable);
42 GUIxor Rxor = new GUIxor(submodelModifiable);
43 GUIxor Sxor = new GUIxor(submodelModifiable);
44 GUIfulladder add = new GUIfulladder(submodelModifiable);
45 GUINandGate nand = new GUINandGate(submodelModifiable, 1);
46 GUIand Coutand = new GUIand(submodelModifiable);
47 GUImux1 Fsel = new GUImux1(submodelModifiable);
48 GUIxor Fxor = new GUIxor(submodelModifiable);
50 WireCrossPoint cpRXored = new WireCrossPoint(submodelModifiable, 1);
51 WireCrossPoint cpSXored = new WireCrossPoint(submodelModifiable, 1);
53 Cinand.moveTo(10, 20);
58 Coutand.moveTo(135, 20);
61 cpRXored.moveCenterTo(50, 60);
62 cpSXored.moveCenterTo(55, 70);
64 new GUIWire(submodelModifiable, Cin, Cinand.getPin("A"), new Point[0]);
65 new GUIWire(submodelModifiable, CoutE, Coutand.getPin("A"), new Point(5, 75), new Point(5, 10), new Point(130, 10),
67 new GUIWire(submodelModifiable, CinE, Cinand.getPin("B"), new Point(7.5, 125), new Point(7.5, 35));
68 new GUIWire(submodelModifiable, R, Rxor.getPin("A"));
69 new GUIWire(submodelModifiable, RN, Rxor.getPin("B"));
70 new GUIWire(submodelModifiable, S, Sxor.getPin("A"));
71 new GUIWire(submodelModifiable, SN, Sxor.getPin("B"));
72 new GUIWire(submodelModifiable, FN, Fxor.getPin("B"), new Point(130, 375), new Point(130, 85));
73 new GUIWire(submodelModifiable, L, Fsel.getPin("S0"), new Point(87.5, 425), new Point(87.5, 75));
74 new GUIWire(submodelModifiable, Cinand.getPin("Y"), add.getPin("A"), new Point[0]);
75 new GUIWire(submodelModifiable, Rxor.getPin("Y"), cpRXored, new Point(50, 195));
76 new GUIWire(submodelModifiable, cpRXored, add.getPin("B"), new Point(50, 35));
77 new GUIWire(submodelModifiable, cpRXored, nand.getPin("A"), new Point[0]);
78 new GUIWire(submodelModifiable, Sxor.getPin("Y"), cpSXored, new Point(55, 295));
79 new GUIWire(submodelModifiable, cpSXored, add.getPin("C"), new Point(55, 45));
80 new GUIWire(submodelModifiable, cpSXored, nand.getPin("B"), new Point[0]);
81 new GUIWire(submodelModifiable, add.getPin("Y"), Fsel.getPin("I0"), new Point(100, 25), new Point(100, 65), new Point(85, 65),
83 new GUIWire(submodelModifiable, add.getPin("Z"), Coutand.getPin("B"), new Point[0]);
84 new GUIWire(submodelModifiable, nand.getPin("Y"), Fsel.getPin("I1"), new Point(82.5, 65), new Point(82.5, 95));
85 new GUIWire(submodelModifiable, Fsel.getPin("Y"), Fxor.getPin("A"), new Point[0]);
86 new GUIWire(submodelModifiable, Coutand.getPin("Y"), Cout, new Point[0]);
87 new GUIWire(submodelModifiable, Fxor.getPin("Y"), F, new Point[0]);