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.submodels.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.ui.model.wires.GUIWire;
8 import net.mograsim.logic.ui.model.wires.Pin;
9 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
10 import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
12 public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent
14 public GUIAm2901SourceDecode(ViewModelModifiable model)
16 super(model, 1, "Am2901SourceDecode");
17 setSubmodelScale(.25);
18 setInputPins("I2", "I1", "I0");
19 setOutputPins("SQ", "RA", "SB", "SA", "RD");
20 initSubmodelComponents();
23 @SuppressWarnings("unused") // for GUIWires being created
24 private void initSubmodelComponents()
26 Pin I2 = getSubmodelPin("I2");
27 Pin I1 = getSubmodelPin("I1");
28 Pin I0 = getSubmodelPin("I0");
29 Pin SQ = getSubmodelPin("SQ");
30 Pin RA = getSubmodelPin("RA");
31 Pin SB = getSubmodelPin("SB");
32 Pin SA = getSubmodelPin("SA");
33 Pin RD = getSubmodelPin("RD");
35 GUINandGate notI2 = new GUINandGate(submodelModifiable, 1);
36 GUINandGate notI1 = new GUINandGate(submodelModifiable, 1);
37 GUINandGate notI0 = new GUINandGate(submodelModifiable, 1);
38 GUINandGate nand21 = new GUINandGate(submodelModifiable, 1);
39 GUINandGate nand22 = new GUINandGate(submodelModifiable, 1);
40 GUINandGate nand23 = new GUINandGate(submodelModifiable, 1);
41 GUINandGate nand24 = new GUINandGate(submodelModifiable, 1);
42 GUINandGate nand25 = new GUINandGate(submodelModifiable, 1);
43 GUINandGate nand31 = new GUINandGate(submodelModifiable, 1);
44 GUINandGate nand32 = new GUINandGate(submodelModifiable, 1);
45 GUINandGate nand33 = new GUINandGate(submodelModifiable, 1);
46 GUINandGate nand34 = new GUINandGate(submodelModifiable, 1);
47 GUINandGate nand35 = new GUINandGate(submodelModifiable, 1);
48 GUINandGate nand41 = new GUINandGate(submodelModifiable, 1);
49 GUINandGate nand42 = new GUINandGate(submodelModifiable, 1);
51 WireCrossPoint cpI21 = new WireCrossPoint(submodelModifiable, 1);
52 WireCrossPoint cpI22 = new WireCrossPoint(submodelModifiable, 1);
53 WireCrossPoint cpI23 = new WireCrossPoint(submodelModifiable, 1);
54 WireCrossPoint cpI1 = new WireCrossPoint(submodelModifiable, 1);
55 WireCrossPoint cpI01 = new WireCrossPoint(submodelModifiable, 1);
56 WireCrossPoint cpI02 = new WireCrossPoint(submodelModifiable, 1);
57 WireCrossPoint cpNotI2 = new WireCrossPoint(submodelModifiable, 1);
58 WireCrossPoint cpNotI11 = new WireCrossPoint(submodelModifiable, 1);
59 WireCrossPoint cpNotI12 = new WireCrossPoint(submodelModifiable, 1);
60 WireCrossPoint cpNotI13 = new WireCrossPoint(submodelModifiable, 1);
61 WireCrossPoint cpNotI0 = new WireCrossPoint(submodelModifiable, 1);
62 WireCrossPoint cpNand22 = new WireCrossPoint(submodelModifiable, 1);
63 WireCrossPoint cpNand23 = new WireCrossPoint(submodelModifiable, 1);
64 WireCrossPoint cpNand24 = new WireCrossPoint(submodelModifiable, 1);
65 WireCrossPoint cpNand31 = new WireCrossPoint(submodelModifiable, 1);
66 WireCrossPoint cpNand35 = new WireCrossPoint(submodelModifiable, 1);
71 nand21.moveTo(40, 10);
72 nand22.moveTo(40, 50);
73 nand23.moveTo(40, 90);
74 nand24.moveTo(40, 130);
75 nand25.moveTo(40, 170);
76 nand31.moveTo(70, 10);
77 nand32.moveTo(70, 50);
78 nand33.moveTo(70, 90);
79 nand34.moveTo(70, 130);
80 nand35.moveTo(70, 170);
81 nand41.moveTo(100, 10);
82 nand42.moveTo(100, 170);
83 cpI21.moveCenterTo(5, 20);
84 cpI22.moveCenterTo(7.5, 20);
85 cpI23.moveCenterTo(5, 145);
86 cpI1.moveCenterTo(7.5, 60);
87 cpI01.moveCenterTo(7.5, 100);
88 cpI02.moveCenterTo(7.5, 105);
89 cpNotI2.moveCenterTo(32.5, 55);
90 cpNotI11.moveCenterTo(35, 60);
91 cpNotI12.moveCenterTo(35, 65);
92 cpNotI13.moveCenterTo(35, 135);
93 cpNotI0.moveCenterTo(37.5, 100);
94 cpNand22.moveCenterTo(65, 60);
95 cpNand23.moveCenterTo(65, 100);
96 cpNand24.moveCenterTo(65, 140);
97 cpNand31.moveCenterTo(95, 20);
98 cpNand35.moveCenterTo(95, 180);
100 new GUIWire(submodelModifiable, I2, cpI21, new Point[0]);
101 new GUIWire(submodelModifiable, cpI21, nand21.getPin("A"), new Point(5, 5), new Point(35, 5), new Point(35, 15));
102 new GUIWire(submodelModifiable, cpI21, cpI22, new Point[0]);
103 new GUIWire(submodelModifiable, cpI22, notI2.getPin("A"), new Point(7.5, 15));
104 new GUIWire(submodelModifiable, cpI22, notI2.getPin("B"), new Point(7.5, 25));
105 new GUIWire(submodelModifiable, cpI21, cpI23, new Point[0]);
106 new GUIWire(submodelModifiable, cpI23, nand24.getPin("B"), new Point[0]);
107 new GUIWire(submodelModifiable, cpI23, nand35.getPin("B"), new Point(5, 195), new Point(65, 195), new Point(65, 185));
108 new GUIWire(submodelModifiable, I1, cpI1, new Point[0]);
109 new GUIWire(submodelModifiable, cpI1, notI1.getPin("A"), new Point(7.5, 55));
110 new GUIWire(submodelModifiable, cpI1, notI1.getPin("B"), new Point(7.5, 65));
111 new GUIWire(submodelModifiable, I0, cpI01, new Point[0]);
112 new GUIWire(submodelModifiable, cpI01, notI0.getPin("A"), new Point(7.5, 95));
113 new GUIWire(submodelModifiable, cpI01, cpI02, new Point[0]);
114 new GUIWire(submodelModifiable, cpI02, notI0.getPin("B"), new Point[0]);
115 new GUIWire(submodelModifiable, cpI02, nand23.getPin("B"), new Point(7.5, 112.5), new Point(32.5, 112.5), new Point(32.5, 105));
116 new GUIWire(submodelModifiable, notI2.getPin("Y"), cpNotI2, new Point(32.5, 20));
117 new GUIWire(submodelModifiable, cpNotI2, nand22.getPin("A"), new Point[0]);
118 new GUIWire(submodelModifiable, cpNotI2, nand23.getPin("A"), new Point(32.5, 95));
119 new GUIWire(submodelModifiable, notI1.getPin("Y"), cpNotI11, new Point[0]);
120 new GUIWire(submodelModifiable, cpNotI11, nand21.getPin("B"), new Point(35, 25));
121 new GUIWire(submodelModifiable, cpNotI11, cpNotI12, new Point[0]);
122 new GUIWire(submodelModifiable, cpNotI12, nand22.getPin("B"), new Point[0]);
123 new GUIWire(submodelModifiable, cpNotI12, cpNotI13, new Point[0]);
124 new GUIWire(submodelModifiable, cpNotI13, nand24.getPin("A"), new Point[0]);
125 new GUIWire(submodelModifiable, cpNotI13, nand25.getPin("A"), new Point(35, 175));
126 new GUIWire(submodelModifiable, notI0.getPin("Y"), cpNotI0, new Point[0]);
127 new GUIWire(submodelModifiable, cpNotI0, nand31.getPin("B"), new Point(37.5, 35), new Point(65, 35), new Point(65, 25));
128 new GUIWire(submodelModifiable, cpNotI0, nand25.getPin("B"), new Point(37.5, 185));
129 new GUIWire(submodelModifiable, nand21.getPin("Y"), nand31.getPin("A"));
130 new GUIWire(submodelModifiable, nand22.getPin("Y"), cpNand22, new Point[0]);
131 new GUIWire(submodelModifiable, cpNand22, nand32.getPin("A"), new Point(65, 55));
132 new GUIWire(submodelModifiable, cpNand22, nand32.getPin("B"), new Point(65, 65));
133 new GUIWire(submodelModifiable, nand23.getPin("Y"), cpNand23, new Point[0]);
134 new GUIWire(submodelModifiable, cpNand23, nand33.getPin("A"), new Point(65, 95));
135 new GUIWire(submodelModifiable, cpNand23, nand33.getPin("B"), new Point(65, 105));
136 new GUIWire(submodelModifiable, nand24.getPin("Y"), cpNand24, new Point[0]);
137 new GUIWire(submodelModifiable, cpNand24, nand34.getPin("A"), new Point(65, 135));
138 new GUIWire(submodelModifiable, cpNand24, nand34.getPin("B"), new Point(65, 145));
139 new GUIWire(submodelModifiable, nand25.getPin("Y"), nand35.getPin("A"));
140 new GUIWire(submodelModifiable, nand31.getPin("Y"), cpNand31, new Point[0]);
141 new GUIWire(submodelModifiable, cpNand31, nand41.getPin("A"), new Point(95, 15));
142 new GUIWire(submodelModifiable, cpNand31, nand41.getPin("B"), new Point(95, 25));
143 new GUIWire(submodelModifiable, nand32.getPin("Y"), RA, new Point[0]);
144 new GUIWire(submodelModifiable, nand33.getPin("Y"), SB, new Point[0]);
145 new GUIWire(submodelModifiable, nand34.getPin("Y"), SA, new Point[0]);
146 new GUIWire(submodelModifiable, nand35.getPin("Y"), cpNand35, new Point[0]);
147 new GUIWire(submodelModifiable, cpNand35, nand42.getPin("A"), new Point(95, 175));
148 new GUIWire(submodelModifiable, cpNand35, nand42.getPin("B"), new Point(95, 185));
149 new GUIWire(submodelModifiable, nand41.getPin("Y"), SQ, new Point[0]);
150 new GUIWire(submodelModifiable, nand42.getPin("Y"), RD, new Point[0]);
155 IndirectGUIComponentCreator.setComponentProvider(GUIAm2901SourceDecode.class.getCanonicalName(),
156 (m, p) -> new GUIAm2901SourceDecode(m));