SimpleRectangularSubmodelComponent now supports pin names
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / am2901 / GUIAm2901ALUInclDecode.java
1 package net.mograsim.logic.ui.model.components.mi.nandbased.am2901;
2
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.ui.model.ViewModelModifiable;
5 import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent;
6 import net.mograsim.logic.ui.model.components.mi.nandbased.GUIxor;
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
11 public class GUIAm2901ALUInclDecode extends SimpleRectangularSubmodelComponent
12 {
13         public GUIAm2901ALUInclDecode(ViewModelModifiable model)
14         {
15                 super(model, 1, "GUIAm2901ALUInclDecode");
16                 setSubmodelScale(.25);
17                 setInputPins("I5", "I4", "I3", "Cn", "R1", "R2", "R3", "R4", "S1", "S2", "S3", "S4");
18                 setOutputPins("F1", "F2", "F3", "F4", "Cnplus4", "OVR");
19                 initSubmodelComponents();
20         }
21
22         @SuppressWarnings("unused") // for GUIWires being created
23         private void initSubmodelComponents()
24         {
25                 Pin I5 = getInputSubmodelPins().get(0);
26                 Pin I4 = getInputSubmodelPins().get(1);
27                 Pin I3 = getInputSubmodelPins().get(2);
28                 Pin Cn = getInputSubmodelPins().get(3);
29                 Pin R1 = getInputSubmodelPins().get(4);
30                 Pin R2 = getInputSubmodelPins().get(5);
31                 Pin R3 = getInputSubmodelPins().get(6);
32                 Pin R4 = getInputSubmodelPins().get(7);
33                 Pin S1 = getInputSubmodelPins().get(8);
34                 Pin S2 = getInputSubmodelPins().get(9);
35                 Pin S3 = getInputSubmodelPins().get(10);
36                 Pin S4 = getInputSubmodelPins().get(11);
37                 Pin F1 = getOutputSubmodelPins().get(0);
38                 Pin F2 = getOutputSubmodelPins().get(1);
39                 Pin F3 = getOutputSubmodelPins().get(2);
40                 Pin F4 = getOutputSubmodelPins().get(3);
41                 Pin Cnplus4 = getOutputSubmodelPins().get(4);
42                 Pin OVR = getOutputSubmodelPins().get(5);
43
44                 GUIAm2901ALUFuncDecode funcDecode = new GUIAm2901ALUFuncDecode(submodelModifiable);
45                 GUIAm2901ALUOneBit alu1 = new GUIAm2901ALUOneBit(submodelModifiable);
46                 GUIAm2901ALUOneBit alu2 = new GUIAm2901ALUOneBit(submodelModifiable);
47                 GUIAm2901ALUOneBit alu3 = new GUIAm2901ALUOneBit(submodelModifiable);
48                 GUIAm2901ALUOneBit alu4 = new GUIAm2901ALUOneBit(submodelModifiable);
49                 GUIxor xorOVR = new GUIxor(submodelModifiable);
50
51                 WireCrossPoint cpI5 = new WireCrossPoint(submodelModifiable, 1);
52                 WireCrossPoint cpI4 = new WireCrossPoint(submodelModifiable, 1);
53                 WireCrossPoint cpI3 = new WireCrossPoint(submodelModifiable, 1);
54                 WireCrossPoint cpCoutE1 = new WireCrossPoint(submodelModifiable, 1);
55                 WireCrossPoint cpCoutE2 = new WireCrossPoint(submodelModifiable, 1);
56                 WireCrossPoint cpCoutE3 = new WireCrossPoint(submodelModifiable, 1);
57                 WireCrossPoint cpCinE1 = new WireCrossPoint(submodelModifiable, 1);
58                 WireCrossPoint cpCinE2 = new WireCrossPoint(submodelModifiable, 1);
59                 WireCrossPoint cpCinE3 = new WireCrossPoint(submodelModifiable, 1);
60                 WireCrossPoint cpRN1 = new WireCrossPoint(submodelModifiable, 1);
61                 WireCrossPoint cpRN2 = new WireCrossPoint(submodelModifiable, 1);
62                 WireCrossPoint cpRN3 = new WireCrossPoint(submodelModifiable, 1);
63                 WireCrossPoint cpSN1 = new WireCrossPoint(submodelModifiable, 1);
64                 WireCrossPoint cpSN2 = new WireCrossPoint(submodelModifiable, 1);
65                 WireCrossPoint cpSN3 = new WireCrossPoint(submodelModifiable, 1);
66                 WireCrossPoint cpFN1 = new WireCrossPoint(submodelModifiable, 1);
67                 WireCrossPoint cpFN2 = new WireCrossPoint(submodelModifiable, 1);
68                 WireCrossPoint cpFN3 = new WireCrossPoint(submodelModifiable, 1);
69                 WireCrossPoint cpL1 = new WireCrossPoint(submodelModifiable, 1);
70                 WireCrossPoint cpL2 = new WireCrossPoint(submodelModifiable, 1);
71                 WireCrossPoint cpL3 = new WireCrossPoint(submodelModifiable, 1);
72                 WireCrossPoint cpCnplus3 = new WireCrossPoint(submodelModifiable, 1);
73                 WireCrossPoint cpCnplus4 = new WireCrossPoint(submodelModifiable, 1);
74
75                 funcDecode.moveTo(15, 25);
76                 alu1.moveTo(45, 80);
77                 alu2.moveTo(45, 180);
78                 alu3.moveTo(45, 280);
79                 alu4.moveTo(45, 380);
80                 xorOVR.moveTo(95, 400);
81                 cpI5.moveCenterTo(5, 20);
82                 cpI4.moveCenterTo(5, 60);
83                 cpI3.moveCenterTo(10, 65);
84                 cpCoutE1.moveCenterTo(25, 95);
85                 cpCoutE2.moveCenterTo(25, 195);
86                 cpCoutE3.moveCenterTo(25, 295);
87                 cpCinE1.moveCenterTo(27.5, 105);
88                 cpCinE2.moveCenterTo(27.5, 205);
89                 cpCinE3.moveCenterTo(27.5, 305);
90                 cpRN1.moveCenterTo(30, 125);
91                 cpRN2.moveCenterTo(30, 225);
92                 cpRN3.moveCenterTo(30, 325);
93                 cpSN1.moveCenterTo(32.5, 145);
94                 cpSN2.moveCenterTo(32.5, 245);
95                 cpSN3.moveCenterTo(32.5, 345);
96                 cpFN1.moveCenterTo(35, 155);
97                 cpFN2.moveCenterTo(35, 255);
98                 cpFN3.moveCenterTo(35, 355);
99                 cpL1.moveCenterTo(37.5, 165);
100                 cpL2.moveCenterTo(37.5, 265);
101                 cpL3.moveCenterTo(37.5, 365);
102                 cpCnplus3.moveCenterTo(85, 375);
103                 cpCnplus4.moveCenterTo(85, 385);
104
105                 new GUIWire(submodelModifiable, I5, cpI5, new Point[0]);
106                 new GUIWire(submodelModifiable, cpI5, funcDecode.getInputPins().get(0), new Point(5, 30));
107                 new GUIWire(submodelModifiable, I4, cpI4, new Point[0]);
108                 new GUIWire(submodelModifiable, cpI4, funcDecode.getInputPins().get(1), new Point(5, 40));
109                 new GUIWire(submodelModifiable, I3, cpI3, new Point(10, 100));
110                 new GUIWire(submodelModifiable, cpI3, funcDecode.getInputPins().get(2), new Point(10, 50));
111                 new GUIWire(submodelModifiable, funcDecode.getOutputPins().get(2), cpCoutE1, new Point(52.5, 50), new Point(52.5, 57.5),
112                                 new Point(25, 57.5));
113                 new GUIWire(submodelModifiable, cpCoutE1, cpCoutE2, new Point[0]);
114                 new GUIWire(submodelModifiable, cpCoutE2, cpCoutE3, new Point[0]);
115                 new GUIWire(submodelModifiable, cpCoutE1, alu1.getInputPins().get(1), new Point[0]);
116                 new GUIWire(submodelModifiable, cpCoutE2, alu2.getInputPins().get(1), new Point[0]);
117                 new GUIWire(submodelModifiable, cpCoutE3, alu3.getInputPins().get(1), new Point[0]);
118                 new GUIWire(submodelModifiable, cpCoutE3, alu4.getInputPins().get(1), new Point(25, 395));
119                 new GUIWire(submodelModifiable, funcDecode.getOutputPins().get(0), cpCinE1, new Point(57.5, 30), new Point(57.5, 62.5),
120                                 new Point(27.5, 62.5));
121                 new GUIWire(submodelModifiable, cpCinE1, cpCinE2, new Point[0]);
122                 new GUIWire(submodelModifiable, cpCinE2, cpCinE3, new Point[0]);
123                 new GUIWire(submodelModifiable, cpCinE1, alu1.getInputPins().get(2), new Point[0]);
124                 new GUIWire(submodelModifiable, cpCinE2, alu2.getInputPins().get(2), new Point[0]);
125                 new GUIWire(submodelModifiable, cpCinE3, alu3.getInputPins().get(2), new Point[0]);
126                 new GUIWire(submodelModifiable, cpCinE3, alu4.getInputPins().get(2), new Point(27.5, 405));
127                 new GUIWire(submodelModifiable, cpI3, cpRN1, new Point(30, 65));
128                 new GUIWire(submodelModifiable, cpRN1, cpRN2, new Point[0]);
129                 new GUIWire(submodelModifiable, cpRN2, cpRN3, new Point[0]);
130                 new GUIWire(submodelModifiable, cpRN1, alu1.getInputPins().get(4), new Point[0]);
131                 new GUIWire(submodelModifiable, cpRN2, alu2.getInputPins().get(4), new Point[0]);
132                 new GUIWire(submodelModifiable, cpRN3, alu3.getInputPins().get(4), new Point[0]);
133                 new GUIWire(submodelModifiable, cpRN3, alu4.getInputPins().get(4), new Point(30, 425));
134                 new GUIWire(submodelModifiable, cpI4, cpSN1, new Point(32.5, 60));
135                 new GUIWire(submodelModifiable, cpSN1, cpSN2, new Point[0]);
136                 new GUIWire(submodelModifiable, cpSN2, cpSN3, new Point[0]);
137                 new GUIWire(submodelModifiable, cpSN1, alu1.getInputPins().get(6), new Point[0]);
138                 new GUIWire(submodelModifiable, cpSN2, alu2.getInputPins().get(6), new Point[0]);
139                 new GUIWire(submodelModifiable, cpSN3, alu3.getInputPins().get(6), new Point[0]);
140                 new GUIWire(submodelModifiable, cpSN3, alu4.getInputPins().get(6), new Point(32.5, 445));
141                 new GUIWire(submodelModifiable, cpI5, cpFN1, new Point(60, 20), new Point(60, 65), new Point(35, 65));
142                 new GUIWire(submodelModifiable, cpFN1, cpFN2, new Point[0]);
143                 new GUIWire(submodelModifiable, cpFN2, cpFN3, new Point[0]);
144                 new GUIWire(submodelModifiable, cpFN1, alu1.getInputPins().get(7), new Point[0]);
145                 new GUIWire(submodelModifiable, cpFN2, alu2.getInputPins().get(7), new Point[0]);
146                 new GUIWire(submodelModifiable, cpFN3, alu3.getInputPins().get(7), new Point[0]);
147                 new GUIWire(submodelModifiable, cpFN3, alu4.getInputPins().get(7), new Point(35, 455));
148                 new GUIWire(submodelModifiable, funcDecode.getOutputPins().get(1), cpL1, new Point(55, 40), new Point(55, 60), new Point(37.5, 60));
149                 new GUIWire(submodelModifiable, cpL1, cpL2, new Point[0]);
150                 new GUIWire(submodelModifiable, cpL2, cpL3, new Point[0]);
151                 new GUIWire(submodelModifiable, cpL1, alu1.getInputPins().get(8), new Point[0]);
152                 new GUIWire(submodelModifiable, cpL2, alu2.getInputPins().get(8), new Point[0]);
153                 new GUIWire(submodelModifiable, cpL3, alu3.getInputPins().get(8), new Point[0]);
154                 new GUIWire(submodelModifiable, cpL3, alu4.getInputPins().get(8), new Point(37.5, 465));
155                 new GUIWire(submodelModifiable, R1, alu1.getInputPins().get(3), new Point(10, 180), new Point(10, 115));
156                 new GUIWire(submodelModifiable, R2, alu2.getInputPins().get(3), new Point(10, 220), new Point(10, 215));
157                 new GUIWire(submodelModifiable, R3, alu3.getInputPins().get(3), new Point(10, 260), new Point(10, 315));
158                 new GUIWire(submodelModifiable, R4, alu4.getInputPins().get(3), new Point(20, 300), new Point(20, 415));
159                 new GUIWire(submodelModifiable, S1, alu1.getInputPins().get(5), new Point(15, 340), new Point(15, 135));
160                 new GUIWire(submodelModifiable, S2, alu2.getInputPins().get(5), new Point(5, 380), new Point(5, 235));
161                 new GUIWire(submodelModifiable, S3, alu3.getInputPins().get(5), new Point(10, 420), new Point(10, 335));
162                 new GUIWire(submodelModifiable, S4, alu4.getInputPins().get(5), new Point(10, 460), new Point(10, 435));
163                 new GUIWire(submodelModifiable, Cn, alu1.getInputPins().get(0), new Point(5, 140), new Point(5, 85));
164                 new GUIWire(submodelModifiable, alu1.getOutputPins().get(0), alu2.getInputPins().get(0), new Point(85, 85), new Point(85, 175),
165                                 new Point(40, 175), new Point(40, 185));
166                 new GUIWire(submodelModifiable, alu2.getOutputPins().get(0), alu3.getInputPins().get(0), new Point(85, 185), new Point(85, 275),
167                                 new Point(40, 275), new Point(40, 285));
168                 new GUIWire(submodelModifiable, alu3.getOutputPins().get(0), cpCnplus3, new Point(85, 285));
169                 new GUIWire(submodelModifiable, cpCnplus3, alu4.getInputPins().get(0), new Point(40, 375), new Point(40, 385));
170                 new GUIWire(submodelModifiable, alu4.getOutputPins().get(0), cpCnplus4, new Point[0]);
171                 new GUIWire(submodelModifiable, alu1.getOutputPins().get(1), F1, new Point(90, 95), new Point(90, 20));
172                 new GUIWire(submodelModifiable, alu2.getOutputPins().get(1), F2, new Point(95, 195), new Point(95, 60));
173                 new GUIWire(submodelModifiable, alu3.getOutputPins().get(1), F3, new Point(100, 295), new Point(100, 100));
174                 new GUIWire(submodelModifiable, alu4.getOutputPins().get(1), F4, new Point(105, 395), new Point(105, 140));
175                 new GUIWire(submodelModifiable, cpCnplus3, xorOVR.getInputPins().get(0), new Point(90, 375), new Point(90, 405));
176                 new GUIWire(submodelModifiable, cpCnplus4, xorOVR.getInputPins().get(1), new Point(85, 415));
177                 new GUIWire(submodelModifiable, cpCnplus4, Cnplus4, new Point(130, 385), new Point(130, 180));
178                 new GUIWire(submodelModifiable, xorOVR.getOutputPins().get(0), OVR);
179         }
180 }