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.GUINandGate;
6 import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.ui.model.components.mi.nandbased.GUIand;
8 import net.mograsim.logic.ui.model.components.mi.nandbased.GUIfulladder;
9 import net.mograsim.logic.ui.model.components.mi.nandbased.GUImux1;
10 import net.mograsim.logic.ui.model.components.mi.nandbased.GUIxor;
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");
23 initSubmodelComponents();
26 @SuppressWarnings("unused") // for GUIWires being created
27 private void initSubmodelComponents()
29 Pin Cin = getInputSubmodelPins().get(0);
30 Pin CoutE = getInputSubmodelPins().get(1);
31 Pin CinE = getInputSubmodelPins().get(2);
32 Pin R = getInputSubmodelPins().get(3);
33 Pin RN = getInputSubmodelPins().get(4);
34 Pin S = getInputSubmodelPins().get(5);
35 Pin SN = getInputSubmodelPins().get(6);
36 Pin FN = getInputSubmodelPins().get(7);
37 Pin L = getInputSubmodelPins().get(8);
38 Pin Cout = getOutputSubmodelPins().get(0);
39 Pin F = getOutputSubmodelPins().get(1);
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.getInputPins().get(0), new Point[0]);
65 new GUIWire(submodelModifiable, CoutE, Coutand.getInputPins().get(0), new Point(5, 75), new Point(5, 10), new Point(130, 10),
67 new GUIWire(submodelModifiable, CinE, Cinand.getInputPins().get(1), new Point(7.5, 125), new Point(7.5, 35));
68 new GUIWire(submodelModifiable, R, Rxor.getInputPins().get(0));
69 new GUIWire(submodelModifiable, RN, Rxor.getInputPins().get(1));
70 new GUIWire(submodelModifiable, S, Sxor.getInputPins().get(0));
71 new GUIWire(submodelModifiable, SN, Sxor.getInputPins().get(1));
72 new GUIWire(submodelModifiable, FN, Fxor.getInputPins().get(1), new Point(130, 375), new Point(130, 85));
73 new GUIWire(submodelModifiable, L, Fsel.getInputPins().get(0), new Point(87.5, 425), new Point(87.5, 75));
74 new GUIWire(submodelModifiable, Cinand.getOutputPins().get(0), add.getInputPins().get(0), new Point[0]);
75 new GUIWire(submodelModifiable, Rxor.getOutputPins().get(0), cpRXored, new Point(50, 195));
76 new GUIWire(submodelModifiable, cpRXored, add.getInputPins().get(1), new Point(50, 35));
77 new GUIWire(submodelModifiable, cpRXored, nand.getInputPins().get(0), new Point[0]);
78 new GUIWire(submodelModifiable, Sxor.getOutputPins().get(0), cpSXored, new Point(55, 295));
79 new GUIWire(submodelModifiable, cpSXored, add.getInputPins().get(2), new Point(55, 45));
80 new GUIWire(submodelModifiable, cpSXored, nand.getInputPins().get(1), new Point[0]);
81 new GUIWire(submodelModifiable, add.getOutputPins().get(0), Fsel.getInputPins().get(1), new Point(100, 25), new Point(100, 65),
82 new Point(85, 65), new Point(85, 85));
83 new GUIWire(submodelModifiable, add.getOutputPins().get(1), Coutand.getInputPins().get(1), new Point[0]);
84 new GUIWire(submodelModifiable, nand.getOutputPin(), Fsel.getInputPins().get(2), new Point(82.5, 65), new Point(82.5, 95));
85 new GUIWire(submodelModifiable, Fsel.getOutputPins().get(0), Fxor.getInputPins().get(0), new Point[0]);
86 new GUIWire(submodelModifiable, Coutand.getOutputPins().get(0), Cout, new Point[0]);
87 new GUIWire(submodelModifiable, Fxor.getOutputPins().get(0), F, new Point[0]);