Renamed logic.ui to logic.model
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / model / components / mi / nandbased / am2901 / GUIAm2901ALUInclDecode.java
1 package net.mograsim.logic.model.model.components.mi.nandbased.am2901;
2
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.model.model.ViewModelModifiable;
5 import net.mograsim.logic.model.model.components.mi.nandbased.GUIxor;
6 import net.mograsim.logic.model.model.components.submodels.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.model.model.wires.GUIWire;
8 import net.mograsim.logic.model.model.wires.Pin;
9 import net.mograsim.logic.model.model.wires.WireCrossPoint;
10 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
11
12 public class GUIAm2901ALUInclDecode extends SimpleRectangularSubmodelComponent
13 {
14         public GUIAm2901ALUInclDecode(ViewModelModifiable model)
15         {
16                 this(model, null);
17         }
18
19         public GUIAm2901ALUInclDecode(ViewModelModifiable model, String name)
20         {
21                 super(model, 1, "GUIAm2901ALUInclDecode", name);
22                 setSubmodelScale(.25);
23                 setInputPins("I5", "I4", "I3", "Cn", "R1", "R2", "R3", "R4", "S1", "S2", "S3", "S4");
24                 setOutputPins("F1", "F2", "F3", "F4", "Cn+4", "OVR");
25                 initSubmodelComponents();
26         }
27
28         @SuppressWarnings("unused") // for GUIWires being created
29         private void initSubmodelComponents()
30         {
31                 Pin I5 = getSubmodelPin("I5");
32                 Pin I4 = getSubmodelPin("I4");
33                 Pin I3 = getSubmodelPin("I3");
34                 Pin Cn = getSubmodelPin("Cn");
35                 Pin R1 = getSubmodelPin("R1");
36                 Pin R2 = getSubmodelPin("R2");
37                 Pin R3 = getSubmodelPin("R3");
38                 Pin R4 = getSubmodelPin("R4");
39                 Pin S1 = getSubmodelPin("S1");
40                 Pin S2 = getSubmodelPin("S2");
41                 Pin S3 = getSubmodelPin("S3");
42                 Pin S4 = getSubmodelPin("S4");
43                 Pin F1 = getSubmodelPin("F1");
44                 Pin F2 = getSubmodelPin("F2");
45                 Pin F3 = getSubmodelPin("F3");
46                 Pin F4 = getSubmodelPin("F4");
47                 Pin Cnplus4 = getSubmodelPin("Cn+4");
48                 Pin OVR = getSubmodelPin("OVR");
49
50                 GUIAm2901ALUFuncDecode funcDecode = new GUIAm2901ALUFuncDecode(submodelModifiable);
51                 GUIAm2901ALUOneBit alu1 = new GUIAm2901ALUOneBit(submodelModifiable);
52                 GUIAm2901ALUOneBit alu2 = new GUIAm2901ALUOneBit(submodelModifiable);
53                 GUIAm2901ALUOneBit alu3 = new GUIAm2901ALUOneBit(submodelModifiable);
54                 GUIAm2901ALUOneBit alu4 = new GUIAm2901ALUOneBit(submodelModifiable);
55                 GUIxor xorOVR = new GUIxor(submodelModifiable);
56
57                 WireCrossPoint cpCoutE1 = new WireCrossPoint(submodelModifiable, 1);
58                 WireCrossPoint cpCoutE2 = new WireCrossPoint(submodelModifiable, 1);
59                 WireCrossPoint cpCoutE3 = new WireCrossPoint(submodelModifiable, 1);
60                 WireCrossPoint cpCinE1 = new WireCrossPoint(submodelModifiable, 1);
61                 WireCrossPoint cpCinE2 = new WireCrossPoint(submodelModifiable, 1);
62                 WireCrossPoint cpCinE3 = new WireCrossPoint(submodelModifiable, 1);
63                 WireCrossPoint cpRN1 = new WireCrossPoint(submodelModifiable, 1);
64                 WireCrossPoint cpRN2 = new WireCrossPoint(submodelModifiable, 1);
65                 WireCrossPoint cpRN3 = new WireCrossPoint(submodelModifiable, 1);
66                 WireCrossPoint cpSN1 = new WireCrossPoint(submodelModifiable, 1);
67                 WireCrossPoint cpSN2 = new WireCrossPoint(submodelModifiable, 1);
68                 WireCrossPoint cpSN3 = new WireCrossPoint(submodelModifiable, 1);
69                 WireCrossPoint cpFN1 = new WireCrossPoint(submodelModifiable, 1);
70                 WireCrossPoint cpFN2 = new WireCrossPoint(submodelModifiable, 1);
71                 WireCrossPoint cpFN3 = new WireCrossPoint(submodelModifiable, 1);
72                 WireCrossPoint cpL1 = new WireCrossPoint(submodelModifiable, 1);
73                 WireCrossPoint cpL2 = new WireCrossPoint(submodelModifiable, 1);
74                 WireCrossPoint cpL3 = new WireCrossPoint(submodelModifiable, 1);
75                 WireCrossPoint cpCnplus3 = new WireCrossPoint(submodelModifiable, 1);
76                 WireCrossPoint cpCnplus4 = new WireCrossPoint(submodelModifiable, 1);
77
78                 funcDecode.moveTo(20, 2.5);
79                 alu1.moveTo(45, 80);
80                 alu2.moveTo(45, 180);
81                 alu3.moveTo(45, 280);
82                 alu4.moveTo(45, 380);
83                 xorOVR.moveTo(95, 400);
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, funcDecode.getPin("I5"), new Point(5, 20), new Point(5, 7.5));
106                 new GUIWire(submodelModifiable, I4, funcDecode.getPin("I4"), new Point(10, 60), new Point(10, 17.5));
107                 new GUIWire(submodelModifiable, I3, funcDecode.getPin("I3"), new Point(15, 100), new Point(15, 27.5));
108                 new GUIWire(submodelModifiable, funcDecode.getPin("SBE"), cpCoutE1, new Point(62.5, 37.5), new Point(62.5, 70), new Point(25, 70));
109                 new GUIWire(submodelModifiable, cpCoutE1, cpCoutE2, new Point[0]);
110                 new GUIWire(submodelModifiable, cpCoutE2, cpCoutE3, new Point[0]);
111                 new GUIWire(submodelModifiable, cpCoutE1, alu1.getPin("CoutE"), new Point[0]);
112                 new GUIWire(submodelModifiable, cpCoutE2, alu2.getPin("CoutE"), new Point[0]);
113                 new GUIWire(submodelModifiable, cpCoutE3, alu3.getPin("CoutE"), new Point[0]);
114                 new GUIWire(submodelModifiable, cpCoutE3, alu4.getPin("CoutE"), new Point(25, 395));
115                 new GUIWire(submodelModifiable, funcDecode.getPin("CinE"), cpCinE1, new Point(70, 7.5), new Point(70, 77.5), new Point(27.5, 77.5));
116                 new GUIWire(submodelModifiable, cpCinE1, cpCinE2, new Point[0]);
117                 new GUIWire(submodelModifiable, cpCinE2, cpCinE3, new Point[0]);
118                 new GUIWire(submodelModifiable, cpCinE1, alu1.getPin("CinE"), new Point[0]);
119                 new GUIWire(submodelModifiable, cpCinE2, alu2.getPin("CinE"), new Point[0]);
120                 new GUIWire(submodelModifiable, cpCinE3, alu3.getPin("CinE"), new Point[0]);
121                 new GUIWire(submodelModifiable, cpCinE3, alu4.getPin("CinE"), new Point(27.5, 405));
122                 new GUIWire(submodelModifiable, funcDecode.getPin("RN"), cpRN1, new Point(57.5, 57.5), new Point(57.5, 65), new Point(30, 65));
123                 new GUIWire(submodelModifiable, cpRN1, cpRN2, new Point[0]);
124                 new GUIWire(submodelModifiable, cpRN2, cpRN3, new Point[0]);
125                 new GUIWire(submodelModifiable, cpRN1, alu1.getPin("RN"), new Point[0]);
126                 new GUIWire(submodelModifiable, cpRN2, alu2.getPin("RN"), new Point[0]);
127                 new GUIWire(submodelModifiable, cpRN3, alu3.getPin("RN"), new Point[0]);
128                 new GUIWire(submodelModifiable, cpRN3, alu4.getPin("RN"), new Point(30, 425));
129                 new GUIWire(submodelModifiable, funcDecode.getPin("SN"), cpSN1, new Point(65, 27.5), new Point(65, 72.5), new Point(32.5, 72.5));
130                 new GUIWire(submodelModifiable, cpSN1, cpSN2, new Point[0]);
131                 new GUIWire(submodelModifiable, cpSN2, cpSN3, new Point[0]);
132                 new GUIWire(submodelModifiable, cpSN1, alu1.getPin("SN"), new Point[0]);
133                 new GUIWire(submodelModifiable, cpSN2, alu2.getPin("SN"), new Point[0]);
134                 new GUIWire(submodelModifiable, cpSN3, alu3.getPin("SN"), new Point[0]);
135                 new GUIWire(submodelModifiable, cpSN3, alu4.getPin("SN"), new Point(32.5, 445));
136                 new GUIWire(submodelModifiable, funcDecode.getPin("FN"), cpFN1, new Point(60, 47.5), new Point(60, 67.5), new Point(35, 67.5));
137                 new GUIWire(submodelModifiable, cpFN1, cpFN2, new Point[0]);
138                 new GUIWire(submodelModifiable, cpFN2, cpFN3, new Point[0]);
139                 new GUIWire(submodelModifiable, cpFN1, alu1.getPin("FN"), new Point[0]);
140                 new GUIWire(submodelModifiable, cpFN2, alu2.getPin("FN"), new Point[0]);
141                 new GUIWire(submodelModifiable, cpFN3, alu3.getPin("FN"), new Point[0]);
142                 new GUIWire(submodelModifiable, cpFN3, alu4.getPin("FN"), new Point(35, 455));
143                 new GUIWire(submodelModifiable, funcDecode.getPin("L"), cpL1, new Point(67.5, 17.5), new Point(67.5, 75), new Point(37.5, 75));
144                 new GUIWire(submodelModifiable, cpL1, cpL2, new Point[0]);
145                 new GUIWire(submodelModifiable, cpL2, cpL3, new Point[0]);
146                 new GUIWire(submodelModifiable, cpL1, alu1.getPin("L"), new Point[0]);
147                 new GUIWire(submodelModifiable, cpL2, alu2.getPin("L"), new Point[0]);
148                 new GUIWire(submodelModifiable, cpL3, alu3.getPin("L"), new Point[0]);
149                 new GUIWire(submodelModifiable, cpL3, alu4.getPin("L"), new Point(37.5, 465));
150                 new GUIWire(submodelModifiable, R1, alu1.getPin("R"), new Point(10, 180), new Point(10, 115));
151                 new GUIWire(submodelModifiable, R2, alu2.getPin("R"), new Point(10, 220), new Point(10, 215));
152                 new GUIWire(submodelModifiable, R3, alu3.getPin("R"), new Point(10, 260), new Point(10, 315));
153                 new GUIWire(submodelModifiable, R4, alu4.getPin("R"), new Point(20, 300), new Point(20, 415));
154                 new GUIWire(submodelModifiable, S1, alu1.getPin("S"), new Point(15, 340), new Point(15, 135));
155                 new GUIWire(submodelModifiable, S2, alu2.getPin("S"), new Point(5, 380), new Point(5, 235));
156                 new GUIWire(submodelModifiable, S3, alu3.getPin("S"), new Point(10, 420), new Point(10, 335));
157                 new GUIWire(submodelModifiable, S4, alu4.getPin("S"), new Point(10, 460), new Point(10, 435));
158                 new GUIWire(submodelModifiable, Cn, alu1.getPin("Cin"), new Point(5, 140), new Point(5, 85));
159                 new GUIWire(submodelModifiable, alu1.getPin("Cout"), alu2.getPin("Cin"), new Point(85, 85), new Point(85, 175), new Point(40, 175),
160                                 new Point(40, 185));
161                 new GUIWire(submodelModifiable, alu2.getPin("Cout"), alu3.getPin("Cin"), new Point(85, 185), new Point(85, 275), new Point(40, 275),
162                                 new Point(40, 285));
163                 new GUIWire(submodelModifiable, alu3.getPin("Cout"), cpCnplus3, new Point(85, 285));
164                 new GUIWire(submodelModifiable, cpCnplus3, alu4.getPin("Cin"), new Point(40, 375), new Point(40, 385));
165                 new GUIWire(submodelModifiable, alu4.getPin("Cout"), cpCnplus4, new Point[0]);
166                 new GUIWire(submodelModifiable, alu1.getPin("F"), F1, new Point(90, 95), new Point(90, 20));
167                 new GUIWire(submodelModifiable, alu2.getPin("F"), F2, new Point(95, 195), new Point(95, 60));
168                 new GUIWire(submodelModifiable, alu3.getPin("F"), F3, new Point(100, 295), new Point(100, 100));
169                 new GUIWire(submodelModifiable, alu4.getPin("F"), F4, new Point(105, 395), new Point(105, 140));
170                 new GUIWire(submodelModifiable, cpCnplus3, xorOVR.getPin("A"), new Point(90, 375), new Point(90, 405));
171                 new GUIWire(submodelModifiable, cpCnplus4, xorOVR.getPin("B"), new Point(85, 415));
172                 new GUIWire(submodelModifiable, cpCnplus4, Cnplus4, new Point(130, 385), new Point(130, 180));
173                 new GUIWire(submodelModifiable, xorOVR.getPin("Y"), OVR);
174         }
175
176         static
177         {
178                 IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUInclDecode.class.getCanonicalName(),
179                                 (m, p, n) -> new GUIAm2901ALUInclDecode(m, n));
180         }
181 }