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.wires.GUIWire;
8 import net.mograsim.logic.ui.model.wires.Pin;
9 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
11 public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent
13 public GUIAm2901SourceDecode(ViewModelModifiable model)
15 super(model, 1, "Am2901SourceDecode");
16 setSubmodelScale(.25);
17 setInputPins("I2", "I1", "I0");
18 setOutputPins("SQ", "RA", "SB", "SA", "RD");
19 initSubmodelComponents();
22 @SuppressWarnings("unused") // for GUIWires being created
23 private void initSubmodelComponents()
25 Pin I2 = getSubmodelPin("I2");
26 Pin I1 = getSubmodelPin("I1");
27 Pin I0 = getSubmodelPin("I0");
28 Pin SQ = getSubmodelPin("SQ");
29 Pin RA = getSubmodelPin("RA");
30 Pin SB = getSubmodelPin("SB");
31 Pin SA = getSubmodelPin("SA");
32 Pin RD = getSubmodelPin("RD");
34 GUINandGate notI2 = new GUINandGate(submodelModifiable, 1);
35 GUINandGate notI1 = new GUINandGate(submodelModifiable, 1);
36 GUINandGate notI0 = new GUINandGate(submodelModifiable, 1);
37 GUINandGate nand21 = new GUINandGate(submodelModifiable, 1);
38 GUINandGate nand22 = new GUINandGate(submodelModifiable, 1);
39 GUINandGate nand23 = new GUINandGate(submodelModifiable, 1);
40 GUINandGate nand24 = new GUINandGate(submodelModifiable, 1);
41 GUINandGate nand25 = new GUINandGate(submodelModifiable, 1);
42 GUINandGate nand31 = new GUINandGate(submodelModifiable, 1);
43 GUINandGate nand32 = new GUINandGate(submodelModifiable, 1);
44 GUINandGate nand33 = new GUINandGate(submodelModifiable, 1);
45 GUINandGate nand34 = new GUINandGate(submodelModifiable, 1);
46 GUINandGate nand35 = new GUINandGate(submodelModifiable, 1);
47 GUINandGate nand41 = new GUINandGate(submodelModifiable, 1);
48 GUINandGate nand42 = new GUINandGate(submodelModifiable, 1);
50 WireCrossPoint cpI21 = new WireCrossPoint(submodelModifiable, 1);
51 WireCrossPoint cpI22 = new WireCrossPoint(submodelModifiable, 1);
52 WireCrossPoint cpI23 = new WireCrossPoint(submodelModifiable, 1);
53 WireCrossPoint cpI1 = new WireCrossPoint(submodelModifiable, 1);
54 WireCrossPoint cpI01 = new WireCrossPoint(submodelModifiable, 1);
55 WireCrossPoint cpI02 = new WireCrossPoint(submodelModifiable, 1);
56 WireCrossPoint cpNotI2 = new WireCrossPoint(submodelModifiable, 1);
57 WireCrossPoint cpNotI11 = new WireCrossPoint(submodelModifiable, 1);
58 WireCrossPoint cpNotI12 = new WireCrossPoint(submodelModifiable, 1);
59 WireCrossPoint cpNotI13 = new WireCrossPoint(submodelModifiable, 1);
60 WireCrossPoint cpNotI0 = new WireCrossPoint(submodelModifiable, 1);
61 WireCrossPoint cpNand22 = new WireCrossPoint(submodelModifiable, 1);
62 WireCrossPoint cpNand23 = new WireCrossPoint(submodelModifiable, 1);
63 WireCrossPoint cpNand24 = new WireCrossPoint(submodelModifiable, 1);
64 WireCrossPoint cpNand31 = new WireCrossPoint(submodelModifiable, 1);
65 WireCrossPoint cpNand35 = new WireCrossPoint(submodelModifiable, 1);
70 nand21.moveTo(40, 10);
71 nand22.moveTo(40, 50);
72 nand23.moveTo(40, 90);
73 nand24.moveTo(40, 130);
74 nand25.moveTo(40, 170);
75 nand31.moveTo(70, 10);
76 nand32.moveTo(70, 50);
77 nand33.moveTo(70, 90);
78 nand34.moveTo(70, 130);
79 nand35.moveTo(70, 170);
80 nand41.moveTo(100, 10);
81 nand42.moveTo(100, 170);
82 cpI21.moveCenterTo(5, 20);
83 cpI22.moveCenterTo(7.5, 20);
84 cpI23.moveCenterTo(5, 145);
85 cpI1.moveCenterTo(7.5, 60);
86 cpI01.moveCenterTo(7.5, 100);
87 cpI02.moveCenterTo(7.5, 105);
88 cpNotI2.moveCenterTo(32.5, 55);
89 cpNotI11.moveCenterTo(35, 60);
90 cpNotI12.moveCenterTo(35, 65);
91 cpNotI13.moveCenterTo(35, 135);
92 cpNotI0.moveCenterTo(37.5, 100);
93 cpNand22.moveCenterTo(65, 60);
94 cpNand23.moveCenterTo(65, 100);
95 cpNand24.moveCenterTo(65, 140);
96 cpNand31.moveCenterTo(95, 20);
97 cpNand35.moveCenterTo(95, 180);
99 new GUIWire(submodelModifiable, I2, cpI21, new Point[0]);
100 new GUIWire(submodelModifiable, cpI21, nand21.getPin("A"), new Point(5, 5), new Point(35, 5), new Point(35, 15));
101 new GUIWire(submodelModifiable, cpI21, cpI22, new Point[0]);
102 new GUIWire(submodelModifiable, cpI22, notI2.getPin("A"), new Point(7.5, 15));
103 new GUIWire(submodelModifiable, cpI22, notI2.getPin("B"), new Point(7.5, 25));
104 new GUIWire(submodelModifiable, cpI21, cpI23, new Point[0]);
105 new GUIWire(submodelModifiable, cpI23, nand24.getPin("B"), new Point[0]);
106 new GUIWire(submodelModifiable, cpI23, nand35.getPin("B"), new Point(5, 195), new Point(65, 195), new Point(65, 185));
107 new GUIWire(submodelModifiable, I1, cpI1, new Point[0]);
108 new GUIWire(submodelModifiable, cpI1, notI1.getPin("A"), new Point(7.5, 55));
109 new GUIWire(submodelModifiable, cpI1, notI1.getPin("B"), new Point(7.5, 65));
110 new GUIWire(submodelModifiable, I0, cpI01, new Point[0]);
111 new GUIWire(submodelModifiable, cpI01, notI0.getPin("A"), new Point(7.5, 95));
112 new GUIWire(submodelModifiable, cpI01, cpI02, new Point[0]);
113 new GUIWire(submodelModifiable, cpI02, notI0.getPin("B"), new Point[0]);
114 new GUIWire(submodelModifiable, cpI02, nand23.getPin("B"), new Point(7.5, 112.5), new Point(32.5, 112.5),
115 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]);