Renamed logic.ui to logic.model
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / model / components / mi / nandbased / am2901 / GUIAm2901ALUFuncDecode.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.atomic.GUINandGate;
6 import net.mograsim.logic.model.model.components.mi.nandbased.GUIand;
7 import net.mograsim.logic.model.model.components.mi.nandbased.GUInand3;
8 import net.mograsim.logic.model.model.components.submodels.SimpleRectangularSubmodelComponent;
9 import net.mograsim.logic.model.model.wires.GUIWire;
10 import net.mograsim.logic.model.model.wires.Pin;
11 import net.mograsim.logic.model.model.wires.WireCrossPoint;
12 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
13
14 public class GUIAm2901ALUFuncDecode extends SimpleRectangularSubmodelComponent
15 {
16         public GUIAm2901ALUFuncDecode(ViewModelModifiable model)
17         {
18                 this(model, null);
19         }
20
21         public GUIAm2901ALUFuncDecode(ViewModelModifiable model, String name)
22         {
23                 super(model, 1, "GUIAm2901ALUFuncDecode", name);
24                 setSubmodelScale(.25);
25                 setInputPins("I5", "I4", "I3");
26                 setOutputPins("CinE", "L", "SN", "SBE", "FN", "RN");
27                 initSubmodelComponents();
28         }
29
30         @SuppressWarnings("unused") // for GUIWires being created
31         private void initSubmodelComponents()
32         {
33                 Pin I5 = getSubmodelPin("I5");
34                 Pin I4 = getSubmodelPin("I4");
35                 Pin I3 = getSubmodelPin("I3");
36                 Pin CinE = getSubmodelPin("CinE");
37                 Pin L = getSubmodelPin("L");
38                 Pin SN = getSubmodelPin("SN");
39                 Pin SBE = getSubmodelPin("SBE");
40                 Pin FN = getSubmodelPin("FN");
41                 Pin RN = getSubmodelPin("RN");
42
43                 GUINandGate notI5 = new GUINandGate(submodelModifiable, 1);
44                 GUINandGate notI4 = new GUINandGate(submodelModifiable, 1);
45                 GUInand3 nandI4I3NotI5 = new GUInand3(submodelModifiable);
46                 GUINandGate nandI5NotI4 = new GUINandGate(submodelModifiable, 1);
47                 GUINandGate nandI3I4 = new GUINandGate(submodelModifiable, 1);
48                 GUINandGate nandL = new GUINandGate(submodelModifiable, 1);
49                 GUIand andSBE = new GUIand(submodelModifiable);
50
51                 WireCrossPoint cpI51 = new WireCrossPoint(submodelModifiable, 1);
52                 WireCrossPoint cpI52 = new WireCrossPoint(submodelModifiable, 1);
53                 WireCrossPoint cpI53 = new WireCrossPoint(submodelModifiable, 1);
54                 WireCrossPoint cpI41 = new WireCrossPoint(submodelModifiable, 1);
55                 WireCrossPoint cpI42 = new WireCrossPoint(submodelModifiable, 1);
56                 WireCrossPoint cpI43 = new WireCrossPoint(submodelModifiable, 1);
57                 WireCrossPoint cpI44 = new WireCrossPoint(submodelModifiable, 1);
58                 WireCrossPoint cpI31 = new WireCrossPoint(submodelModifiable, 1);
59                 WireCrossPoint cpI32 = new WireCrossPoint(submodelModifiable, 1);
60                 WireCrossPoint cpNotI51 = new WireCrossPoint(submodelModifiable, 1);
61                 WireCrossPoint cpNotI52 = new WireCrossPoint(submodelModifiable, 1);
62
63                 notI5.moveTo(15, 10);
64                 notI4.moveTo(15, 50);
65                 nandI4I3NotI5.moveTo(55, 10);
66                 nandI5NotI4.moveTo(55, 45);
67                 nandI3I4.moveTo(55, 70);
68                 nandL.moveTo(100, 50);
69                 andSBE.moveTo(100, 135);
70                 cpI51.moveCenterTo(5, 20);
71                 cpI52.moveCenterTo(5, 25);
72                 cpI53.moveCenterTo(5, 45);
73                 cpI41.moveCenterTo(10, 60);
74                 cpI42.moveCenterTo(10, 55);
75                 cpI43.moveCenterTo(10, 65);
76                 cpI44.moveCenterTo(10, 85);
77                 cpI31.moveCenterTo(50, 100);
78                 cpI32.moveCenterTo(50, 75);
79                 cpNotI51.moveCenterTo(40, 20);
80                 cpNotI52.moveCenterTo(40, 35);
81
82                 new GUIWire(submodelModifiable, I5, cpI51, new Point[0]);
83                 new GUIWire(submodelModifiable, cpI51, notI5.getPin("A"), new Point(5, 15));
84                 new GUIWire(submodelModifiable, cpI51, cpI52, new Point[0]);
85                 new GUIWire(submodelModifiable, cpI52, notI5.getPin("B"), new Point[0]);
86                 new GUIWire(submodelModifiable, cpI52, cpI53, new Point[0]);
87                 new GUIWire(submodelModifiable, cpI53, nandI5NotI4.getPin("A"), new Point(45, 45), new Point(45, 50));
88                 new GUIWire(submodelModifiable, cpI53, FN, new Point(5, 180));
89                 new GUIWire(submodelModifiable, I4, cpI41, new Point[0]);
90                 new GUIWire(submodelModifiable, cpI41, cpI42, new Point[0]);
91                 new GUIWire(submodelModifiable, cpI42, nandI4I3NotI5.getPin("A"), new Point(10, 40), new Point(45, 40), new Point(45, 15));
92                 new GUIWire(submodelModifiable, cpI42, notI4.getPin("A"), new Point[0]);
93                 new GUIWire(submodelModifiable, cpI41, cpI43, new Point[0]);
94                 new GUIWire(submodelModifiable, cpI43, notI4.getPin("B"), new Point[0]);
95                 new GUIWire(submodelModifiable, cpI43, cpI44, new Point[0]);
96                 new GUIWire(submodelModifiable, cpI44, nandI3I4.getPin("B"), new Point[0]);
97                 new GUIWire(submodelModifiable, cpI44, SN, new Point(10, 105), new Point(135, 105), new Point(135, 100));
98                 new GUIWire(submodelModifiable, I3, cpI31, new Point(50, 100));
99                 new GUIWire(submodelModifiable, cpI31, RN, new Point(50, 220));
100                 new GUIWire(submodelModifiable, cpI31, cpI32, new Point[0]);
101                 new GUIWire(submodelModifiable, cpI32, nandI4I3NotI5.getPin("B"), new Point(50, 25));
102                 new GUIWire(submodelModifiable, cpI32, nandI3I4.getPin("A"), new Point[0]);
103                 new GUIWire(submodelModifiable, notI5.getPin("Y"), cpNotI51, new Point[0]);
104                 new GUIWire(submodelModifiable, cpNotI51, CinE, new Point(40, 5), new Point(115, 5), new Point(115, 20));
105                 new GUIWire(submodelModifiable, cpNotI51, cpNotI52, new Point[0]);
106                 new GUIWire(submodelModifiable, cpNotI52, nandI4I3NotI5.getPin("C"), new Point[0]);
107                 new GUIWire(submodelModifiable, cpNotI52, andSBE.getPin("B"), new Point(40, 150));
108                 new GUIWire(submodelModifiable, notI4.getPin("Y"), nandI5NotI4.getPin("B"), new Point[0]);
109                 new GUIWire(submodelModifiable, nandI4I3NotI5.getPin("Y"), nandL.getPin("A"));
110                 new GUIWire(submodelModifiable, nandI5NotI4.getPin("Y"), nandL.getPin("B"));
111                 new GUIWire(submodelModifiable, nandI3I4.getPin("Y"), andSBE.getPin("A"));
112                 new GUIWire(submodelModifiable, nandL.getPin("Y"), L, new Point[0]);
113                 new GUIWire(submodelModifiable, andSBE.getPin("Y"), SBE, new Point[0]);
114         }
115
116         static
117         {
118                 IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUFuncDecode.class.getCanonicalName(),
119                                 (m, p, n) -> new GUIAm2901ALUFuncDecode(m, n));
120         }
121 }