GUIram2: Moved components to correct location
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIram2.java
1 package net.mograsim.logic.ui.model.components.mi.nandbased;
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.wires.GUIWire;
7 import net.mograsim.logic.ui.model.wires.Pin;
8 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
9
10 public class GUIram2 extends SimpleRectangularSubmodelComponent
11 {
12         public GUIram2(ViewModelModifiable model)
13         {
14                 super(model, 1, "GUIram2");
15                 setSubmodelScale(.1);
16                 setInputCount(9);
17                 setOutputCount(8);
18                 initSubmodelComponents();
19         }
20
21         // TODO clean up D lines
22         @SuppressWarnings("unused") // for GUIWires being created
23         private void initSubmodelComponents()
24         {
25                 Pin A0 = getInputSubmodelPins().get(0);
26                 Pin A1 = getInputSubmodelPins().get(1);
27                 Pin B0 = getInputSubmodelPins().get(2);
28                 Pin B1 = getInputSubmodelPins().get(3);
29                 Pin WE = getInputSubmodelPins().get(4);
30                 Pin D1 = getInputSubmodelPins().get(5);
31                 Pin D2 = getInputSubmodelPins().get(6);
32                 Pin D3 = getInputSubmodelPins().get(7);
33                 Pin D4 = getInputSubmodelPins().get(8);
34                 Pin QA1 = getOutputSubmodelPins().get(0);
35                 Pin QA2 = getOutputSubmodelPins().get(1);
36                 Pin QA3 = getOutputSubmodelPins().get(2);
37                 Pin QA4 = getOutputSubmodelPins().get(3);
38                 Pin QB1 = getOutputSubmodelPins().get(4);
39                 Pin QB2 = getOutputSubmodelPins().get(5);
40                 Pin QB3 = getOutputSubmodelPins().get(6);
41                 Pin QB4 = getOutputSubmodelPins().get(7);
42
43                 GUIdemux2 demuxA = new GUIdemux2(submodelModifiable);
44                 GUIdemux2 demuxB = new GUIdemux2(submodelModifiable);
45                 GUIand41 weAndB = new GUIand41(submodelModifiable);
46                 GUIdlatch4 cell00 = new GUIdlatch4(submodelModifiable);
47                 GUIdlatch4 cell01 = new GUIdlatch4(submodelModifiable);
48                 GUIdlatch4 cell10 = new GUIdlatch4(submodelModifiable);
49                 GUIdlatch4 cell11 = new GUIdlatch4(submodelModifiable);
50                 GUIand41 andA00 = new GUIand41(submodelModifiable);
51                 GUIandor414 andorA01 = new GUIandor414(submodelModifiable);
52                 GUIandor414 andorA10 = new GUIandor414(submodelModifiable);
53                 GUIandor414 andorA11 = new GUIandor414(submodelModifiable);
54                 GUIand41 andB00 = new GUIand41(submodelModifiable);
55                 GUIandor414 andorB01 = new GUIandor414(submodelModifiable);
56                 GUIandor414 andorB10 = new GUIandor414(submodelModifiable);
57                 GUIandor414 andorB11 = new GUIandor414(submodelModifiable);
58
59                 WireCrossPoint cpB00 = new WireCrossPoint(submodelModifiable, 1);
60                 WireCrossPoint cpB01 = new WireCrossPoint(submodelModifiable, 1);
61                 WireCrossPoint cpB10 = new WireCrossPoint(submodelModifiable, 1);
62                 WireCrossPoint cpB11 = new WireCrossPoint(submodelModifiable, 1);
63                 WireCrossPoint cpD100 = new WireCrossPoint(submodelModifiable, 1);
64                 WireCrossPoint cpD200 = new WireCrossPoint(submodelModifiable, 1);
65                 WireCrossPoint cpD300 = new WireCrossPoint(submodelModifiable, 1);
66                 WireCrossPoint cpD400 = new WireCrossPoint(submodelModifiable, 1);
67                 WireCrossPoint cpD101 = new WireCrossPoint(submodelModifiable, 1);
68                 WireCrossPoint cpD201 = new WireCrossPoint(submodelModifiable, 1);
69                 WireCrossPoint cpD301 = new WireCrossPoint(submodelModifiable, 1);
70                 WireCrossPoint cpD401 = new WireCrossPoint(submodelModifiable, 1);
71                 WireCrossPoint cpD110 = new WireCrossPoint(submodelModifiable, 1);
72                 WireCrossPoint cpD210 = new WireCrossPoint(submodelModifiable, 1);
73                 WireCrossPoint cpD310 = new WireCrossPoint(submodelModifiable, 1);
74                 WireCrossPoint cpD410 = new WireCrossPoint(submodelModifiable, 1);
75                 WireCrossPoint cpQ100 = new WireCrossPoint(submodelModifiable, 1);
76                 WireCrossPoint cpQ200 = new WireCrossPoint(submodelModifiable, 1);
77                 WireCrossPoint cpQ300 = new WireCrossPoint(submodelModifiable, 1);
78                 WireCrossPoint cpQ400 = new WireCrossPoint(submodelModifiable, 1);
79                 WireCrossPoint cpQ101 = new WireCrossPoint(submodelModifiable, 1);
80                 WireCrossPoint cpQ201 = new WireCrossPoint(submodelModifiable, 1);
81                 WireCrossPoint cpQ301 = new WireCrossPoint(submodelModifiable, 1);
82                 WireCrossPoint cpQ401 = new WireCrossPoint(submodelModifiable, 1);
83                 WireCrossPoint cpQ110 = new WireCrossPoint(submodelModifiable, 1);
84                 WireCrossPoint cpQ210 = new WireCrossPoint(submodelModifiable, 1);
85                 WireCrossPoint cpQ310 = new WireCrossPoint(submodelModifiable, 1);
86                 WireCrossPoint cpQ410 = new WireCrossPoint(submodelModifiable, 1);
87                 WireCrossPoint cpQ111 = new WireCrossPoint(submodelModifiable, 1);
88                 WireCrossPoint cpQ211 = new WireCrossPoint(submodelModifiable, 1);
89                 WireCrossPoint cpQ311 = new WireCrossPoint(submodelModifiable, 1);
90                 WireCrossPoint cpQ411 = new WireCrossPoint(submodelModifiable, 1);
91
92                 demuxA.moveTo(50, 50);
93                 demuxB.moveTo(50, 150);
94                 weAndB.moveTo(125, 150);
95                 cell00.moveTo(50, 325);
96                 cell01.moveTo(50, 475);
97                 cell10.moveTo(50, 625);
98                 cell11.moveTo(50, 775);
99                 andA00.moveTo(230, 375);
100                 andorA01.moveTo(230, 485);
101                 andorA10.moveTo(230, 635);
102                 andorA11.moveTo(230, 785);
103                 andB00.moveTo(145, 325);
104                 andorB01.moveTo(145, 435);
105                 andorB10.moveTo(145, 585);
106                 andorB11.moveTo(145, 735);
107                 cpB00.moveCenterTo(105, 155);
108                 cpB01.moveCenterTo(100, 165);
109                 cpB10.moveCenterTo(95, 175);
110                 cpB11.moveCenterTo(90, 185);
111                 cpD100.moveCenterTo(45, 330);
112                 cpD200.moveCenterTo(40, 340);
113                 cpD300.moveCenterTo(35, 350);
114                 cpD400.moveCenterTo(30, 360);
115                 cpD101.moveCenterTo(45, 480);
116                 cpD201.moveCenterTo(40, 490);
117                 cpD301.moveCenterTo(35, 500);
118                 cpD401.moveCenterTo(30, 510);
119                 cpD110.moveCenterTo(45, 630);
120                 cpD210.moveCenterTo(40, 640);
121                 cpD310.moveCenterTo(35, 650);
122                 cpD410.moveCenterTo(30, 660);
123                 cpQ100.moveCenterTo(140, 330);
124                 cpQ200.moveCenterTo(135, 340);
125                 cpQ300.moveCenterTo(130, 350);
126                 cpQ400.moveCenterTo(125, 360);
127                 cpQ101.moveCenterTo(140, 480);
128                 cpQ201.moveCenterTo(135, 490);
129                 cpQ301.moveCenterTo(130, 500);
130                 cpQ401.moveCenterTo(125, 510);
131                 cpQ110.moveCenterTo(140, 630);
132                 cpQ210.moveCenterTo(135, 640);
133                 cpQ310.moveCenterTo(130, 650);
134                 cpQ410.moveCenterTo(125, 660);
135                 cpQ111.moveCenterTo(140, 780);
136                 cpQ211.moveCenterTo(135, 790);
137                 cpQ311.moveCenterTo(130, 800);
138                 cpQ411.moveCenterTo(125, 810);
139
140                 new GUIWire(submodelModifiable, A0, demuxA.getInputPins().get(0), new Point[0]);
141                 new GUIWire(submodelModifiable, A1, demuxA.getInputPins().get(1), new Point[0]);
142                 new GUIWire(submodelModifiable, B0, demuxB.getInputPins().get(0), new Point[0]);
143                 new GUIWire(submodelModifiable, B1, demuxB.getInputPins().get(1), new Point[0]);
144                 new GUIWire(submodelModifiable, demuxB.getOutputPins().get(0), cpB00, new Point[0]);
145                 new GUIWire(submodelModifiable, demuxB.getOutputPins().get(1), cpB01, new Point[0]);
146                 new GUIWire(submodelModifiable, demuxB.getOutputPins().get(2), cpB10, new Point[0]);
147                 new GUIWire(submodelModifiable, demuxB.getOutputPins().get(3), cpB11, new Point[0]);
148                 new GUIWire(submodelModifiable, cpB00, weAndB.getInputPins().get(0), new Point[0]);
149                 new GUIWire(submodelModifiable, cpB01, weAndB.getInputPins().get(1), new Point[0]);
150                 new GUIWire(submodelModifiable, cpB10, weAndB.getInputPins().get(2), new Point[0]);
151                 new GUIWire(submodelModifiable, cpB11, weAndB.getInputPins().get(3), new Point[0]);
152                 new GUIWire(submodelModifiable, WE, weAndB.getInputPins().get(4), new Point[0]);
153                 new GUIWire(submodelModifiable, weAndB.getOutputPins().get(0), cell00.getInputPins().get(4), new Point[0]);
154                 new GUIWire(submodelModifiable, weAndB.getOutputPins().get(1), cell01.getInputPins().get(4), new Point[0]);
155                 new GUIWire(submodelModifiable, weAndB.getOutputPins().get(2), cell10.getInputPins().get(4), new Point[0]);
156                 new GUIWire(submodelModifiable, weAndB.getOutputPins().get(3), cell11.getInputPins().get(4), new Point[0]);
157                 new GUIWire(submodelModifiable, D1, cpD100, new Point[0]);
158                 new GUIWire(submodelModifiable, D2, cpD200, new Point[0]);
159                 new GUIWire(submodelModifiable, D3, cpD300, new Point[0]);
160                 new GUIWire(submodelModifiable, D4, cpD400, new Point[0]);
161                 new GUIWire(submodelModifiable, cpD100, cell00.getInputPins().get(0), new Point[0]);
162                 new GUIWire(submodelModifiable, cpD200, cell00.getInputPins().get(1), new Point[0]);
163                 new GUIWire(submodelModifiable, cpD300, cell00.getInputPins().get(2), new Point[0]);
164                 new GUIWire(submodelModifiable, cpD400, cell00.getInputPins().get(3), new Point[0]);
165                 new GUIWire(submodelModifiable, cpD100, cpD101, new Point[0]);
166                 new GUIWire(submodelModifiable, cpD200, cpD201, new Point[0]);
167                 new GUIWire(submodelModifiable, cpD300, cpD301, new Point[0]);
168                 new GUIWire(submodelModifiable, cpD400, cpD401, new Point[0]);
169                 new GUIWire(submodelModifiable, cpD101, cell01.getInputPins().get(0), new Point[0]);
170                 new GUIWire(submodelModifiable, cpD201, cell01.getInputPins().get(1), new Point[0]);
171                 new GUIWire(submodelModifiable, cpD301, cell01.getInputPins().get(2), new Point[0]);
172                 new GUIWire(submodelModifiable, cpD401, cell01.getInputPins().get(3), new Point[0]);
173                 new GUIWire(submodelModifiable, cpD101, cpD110, new Point[0]);
174                 new GUIWire(submodelModifiable, cpD201, cpD210, new Point[0]);
175                 new GUIWire(submodelModifiable, cpD301, cpD310, new Point[0]);
176                 new GUIWire(submodelModifiable, cpD401, cpD410, new Point[0]);
177                 new GUIWire(submodelModifiable, cpD110, cell10.getInputPins().get(0), new Point[0]);
178                 new GUIWire(submodelModifiable, cpD210, cell10.getInputPins().get(1), new Point[0]);
179                 new GUIWire(submodelModifiable, cpD310, cell10.getInputPins().get(2), new Point[0]);
180                 new GUIWire(submodelModifiable, cpD410, cell10.getInputPins().get(3), new Point[0]);
181                 new GUIWire(submodelModifiable, cpD110, cell11.getInputPins().get(0), new Point[0]);
182                 new GUIWire(submodelModifiable, cpD210, cell11.getInputPins().get(1), new Point[0]);
183                 new GUIWire(submodelModifiable, cpD310, cell11.getInputPins().get(2), new Point[0]);
184                 new GUIWire(submodelModifiable, cpD410, cell11.getInputPins().get(3), new Point[0]);
185                 new GUIWire(submodelModifiable, cell00.getOutputPins().get(0), cpQ100, new Point[0]);
186                 new GUIWire(submodelModifiable, cell00.getOutputPins().get(1), cpQ200, new Point[0]);
187                 new GUIWire(submodelModifiable, cell00.getOutputPins().get(2), cpQ300, new Point[0]);
188                 new GUIWire(submodelModifiable, cell00.getOutputPins().get(3), cpQ400, new Point[0]);
189                 new GUIWire(submodelModifiable, cell01.getOutputPins().get(0), cpQ101, new Point[0]);
190                 new GUIWire(submodelModifiable, cell01.getOutputPins().get(1), cpQ201, new Point[0]);
191                 new GUIWire(submodelModifiable, cell01.getOutputPins().get(2), cpQ301, new Point[0]);
192                 new GUIWire(submodelModifiable, cell01.getOutputPins().get(3), cpQ401, new Point[0]);
193                 new GUIWire(submodelModifiable, cell10.getOutputPins().get(0), cpQ110, new Point[0]);
194                 new GUIWire(submodelModifiable, cell10.getOutputPins().get(1), cpQ210, new Point[0]);
195                 new GUIWire(submodelModifiable, cell10.getOutputPins().get(2), cpQ310, new Point[0]);
196                 new GUIWire(submodelModifiable, cell10.getOutputPins().get(3), cpQ410, new Point[0]);
197                 new GUIWire(submodelModifiable, cell11.getOutputPins().get(0), cpQ111, new Point[0]);
198                 new GUIWire(submodelModifiable, cell11.getOutputPins().get(1), cpQ211, new Point[0]);
199                 new GUIWire(submodelModifiable, cell11.getOutputPins().get(2), cpQ311, new Point[0]);
200                 new GUIWire(submodelModifiable, cell11.getOutputPins().get(3), cpQ411, new Point[0]);
201                 new GUIWire(submodelModifiable, demuxA.getOutputPins().get(0), andA00.getInputPins().get(4), new Point[0]);
202                 new GUIWire(submodelModifiable, demuxA.getOutputPins().get(1), andorA01.getInputPins().get(8), new Point[0]);
203                 new GUIWire(submodelModifiable, demuxA.getOutputPins().get(2), andorA10.getInputPins().get(8), new Point[0]);
204                 new GUIWire(submodelModifiable, demuxA.getOutputPins().get(3), andorA11.getInputPins().get(8), new Point[0]);
205                 new GUIWire(submodelModifiable, cpB00, andB00.getInputPins().get(4), new Point[0]);
206                 new GUIWire(submodelModifiable, cpB01, andorB01.getInputPins().get(8), new Point[0]);
207                 new GUIWire(submodelModifiable, cpB10, andorB10.getInputPins().get(8), new Point[0]);
208                 new GUIWire(submodelModifiable, cpB11, andorB11.getInputPins().get(8), new Point[0]);
209                 new GUIWire(submodelModifiable, cpQ100, andA00.getInputPins().get(0), new Point[0]);
210                 new GUIWire(submodelModifiable, cpQ200, andA00.getInputPins().get(1), new Point[0]);
211                 new GUIWire(submodelModifiable, cpQ300, andA00.getInputPins().get(2), new Point[0]);
212                 new GUIWire(submodelModifiable, cpQ400, andA00.getInputPins().get(3), new Point[0]);
213                 new GUIWire(submodelModifiable, cpQ101, andorA01.getInputPins().get(4), new Point[0]);
214                 new GUIWire(submodelModifiable, cpQ201, andorA01.getInputPins().get(5), new Point[0]);
215                 new GUIWire(submodelModifiable, cpQ301, andorA01.getInputPins().get(6), new Point[0]);
216                 new GUIWire(submodelModifiable, cpQ401, andorA01.getInputPins().get(7), new Point[0]);
217                 new GUIWire(submodelModifiable, cpQ110, andorA10.getInputPins().get(4), new Point[0]);
218                 new GUIWire(submodelModifiable, cpQ210, andorA10.getInputPins().get(5), new Point[0]);
219                 new GUIWire(submodelModifiable, cpQ310, andorA10.getInputPins().get(6), new Point[0]);
220                 new GUIWire(submodelModifiable, cpQ410, andorA10.getInputPins().get(7), new Point[0]);
221                 new GUIWire(submodelModifiable, cpQ111, andorA11.getInputPins().get(4), new Point[0]);
222                 new GUIWire(submodelModifiable, cpQ211, andorA11.getInputPins().get(5), new Point[0]);
223                 new GUIWire(submodelModifiable, cpQ311, andorA11.getInputPins().get(6), new Point[0]);
224                 new GUIWire(submodelModifiable, cpQ411, andorA11.getInputPins().get(7), new Point[0]);
225                 new GUIWire(submodelModifiable, cpQ100, andB00.getInputPins().get(0), new Point[0]);
226                 new GUIWire(submodelModifiable, cpQ200, andB00.getInputPins().get(1), new Point[0]);
227                 new GUIWire(submodelModifiable, cpQ300, andB00.getInputPins().get(2), new Point[0]);
228                 new GUIWire(submodelModifiable, cpQ400, andB00.getInputPins().get(3), new Point[0]);
229                 new GUIWire(submodelModifiable, cpQ101, andorB01.getInputPins().get(4), new Point[0]);
230                 new GUIWire(submodelModifiable, cpQ201, andorB01.getInputPins().get(5), new Point[0]);
231                 new GUIWire(submodelModifiable, cpQ301, andorB01.getInputPins().get(6), new Point[0]);
232                 new GUIWire(submodelModifiable, cpQ401, andorB01.getInputPins().get(7), new Point[0]);
233                 new GUIWire(submodelModifiable, cpQ110, andorB10.getInputPins().get(4), new Point[0]);
234                 new GUIWire(submodelModifiable, cpQ210, andorB10.getInputPins().get(5), new Point[0]);
235                 new GUIWire(submodelModifiable, cpQ310, andorB10.getInputPins().get(6), new Point[0]);
236                 new GUIWire(submodelModifiable, cpQ410, andorB10.getInputPins().get(7), new Point[0]);
237                 new GUIWire(submodelModifiable, cpQ111, andorB11.getInputPins().get(4), new Point[0]);
238                 new GUIWire(submodelModifiable, cpQ211, andorB11.getInputPins().get(5), new Point[0]);
239                 new GUIWire(submodelModifiable, cpQ311, andorB11.getInputPins().get(6), new Point[0]);
240                 new GUIWire(submodelModifiable, cpQ411, andorB11.getInputPins().get(7), new Point[0]);
241                 new GUIWire(submodelModifiable, andA00.getOutputPins().get(0), andorA01.getInputPins().get(0), new Point[0]);
242                 new GUIWire(submodelModifiable, andA00.getOutputPins().get(1), andorA01.getInputPins().get(1), new Point[0]);
243                 new GUIWire(submodelModifiable, andA00.getOutputPins().get(2), andorA01.getInputPins().get(2), new Point[0]);
244                 new GUIWire(submodelModifiable, andA00.getOutputPins().get(3), andorA01.getInputPins().get(3), new Point[0]);
245                 new GUIWire(submodelModifiable, andorA01.getOutputPins().get(0), andorA10.getInputPins().get(0), new Point[0]);
246                 new GUIWire(submodelModifiable, andorA01.getOutputPins().get(1), andorA10.getInputPins().get(1), new Point[0]);
247                 new GUIWire(submodelModifiable, andorA01.getOutputPins().get(2), andorA10.getInputPins().get(2), new Point[0]);
248                 new GUIWire(submodelModifiable, andorA01.getOutputPins().get(3), andorA10.getInputPins().get(3), new Point[0]);
249                 new GUIWire(submodelModifiable, andorA10.getOutputPins().get(0), andorA11.getInputPins().get(0), new Point[0]);
250                 new GUIWire(submodelModifiable, andorA10.getOutputPins().get(1), andorA11.getInputPins().get(1), new Point[0]);
251                 new GUIWire(submodelModifiable, andorA10.getOutputPins().get(2), andorA11.getInputPins().get(2), new Point[0]);
252                 new GUIWire(submodelModifiable, andorA10.getOutputPins().get(3), andorA11.getInputPins().get(3), new Point[0]);
253                 new GUIWire(submodelModifiable, andorA11.getOutputPins().get(0), QA1, new Point[0]);
254                 new GUIWire(submodelModifiable, andorA11.getOutputPins().get(1), QA2, new Point[0]);
255                 new GUIWire(submodelModifiable, andorA11.getOutputPins().get(2), QA3, new Point[0]);
256                 new GUIWire(submodelModifiable, andorA11.getOutputPins().get(3), QA4, new Point[0]);
257                 new GUIWire(submodelModifiable, andB00.getOutputPins().get(0), andorB01.getInputPins().get(0), new Point[0]);
258                 new GUIWire(submodelModifiable, andB00.getOutputPins().get(1), andorB01.getInputPins().get(1), new Point[0]);
259                 new GUIWire(submodelModifiable, andB00.getOutputPins().get(2), andorB01.getInputPins().get(2), new Point[0]);
260                 new GUIWire(submodelModifiable, andB00.getOutputPins().get(3), andorB01.getInputPins().get(3), new Point[0]);
261                 new GUIWire(submodelModifiable, andorB01.getOutputPins().get(0), andorB10.getInputPins().get(0), new Point[0]);
262                 new GUIWire(submodelModifiable, andorB01.getOutputPins().get(1), andorB10.getInputPins().get(1), new Point[0]);
263                 new GUIWire(submodelModifiable, andorB01.getOutputPins().get(2), andorB10.getInputPins().get(2), new Point[0]);
264                 new GUIWire(submodelModifiable, andorB01.getOutputPins().get(3), andorB10.getInputPins().get(3), new Point[0]);
265                 new GUIWire(submodelModifiable, andorB10.getOutputPins().get(0), andorB11.getInputPins().get(0), new Point[0]);
266                 new GUIWire(submodelModifiable, andorB10.getOutputPins().get(1), andorB11.getInputPins().get(1), new Point[0]);
267                 new GUIWire(submodelModifiable, andorB10.getOutputPins().get(2), andorB11.getInputPins().get(2), new Point[0]);
268                 new GUIWire(submodelModifiable, andorB10.getOutputPins().get(3), andorB11.getInputPins().get(3), new Point[0]);
269                 new GUIWire(submodelModifiable, andorB11.getOutputPins().get(0), QB1, new Point[0]);
270                 new GUIWire(submodelModifiable, andorB11.getOutputPins().get(1), QB2, new Point[0]);
271                 new GUIWire(submodelModifiable, andorB11.getOutputPins().get(2), QB3, new Point[0]);
272                 new GUIWire(submodelModifiable, andorB11.getOutputPins().get(3), QB4, new Point[0]);
273         }
274 }