Merge branch 'development' of
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / model / components / mi / nandbased / am2901 / GUIAm2901DestDecode.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.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 GUIAm2901DestDecode extends SimpleRectangularSubmodelComponent
13 {
14         public GUIAm2901DestDecode(ViewModelModifiable model)
15         {
16                 this(model, null);
17         }
18
19         public GUIAm2901DestDecode(ViewModelModifiable model, String name)
20         {
21                 super(model, 1, "GUIAm2901DestDecode", name);
22                 setSubmodelScale(.25);
23                 setInputPins("I8", "I7", "I6");
24                 setOutputPins("NSH", "RSH", "RAMWE", "YF", "LSH", "QWE");
25                 initSubmodelComponents();
26         }
27
28         @SuppressWarnings("unused") // for GUIWires being created
29         private void initSubmodelComponents()
30         {
31                 Pin I8 = getSubmodelPin("I8");
32                 Pin I7 = getSubmodelPin("I7");
33                 Pin I6 = getSubmodelPin("I6");
34                 Pin NSH = getSubmodelPin("NSH");
35                 Pin RSH = getSubmodelPin("RSH");
36                 Pin RAMWE = getSubmodelPin("RAMWE");
37                 Pin YF = getSubmodelPin("YF");
38                 Pin LSH = getSubmodelPin("LSH");
39                 Pin QWE = getSubmodelPin("QWE");
40
41                 GUINandGate notI8 = new GUINandGate(submodelModifiable, 1);
42                 GUINandGate notI7 = new GUINandGate(submodelModifiable, 1);
43                 GUINandGate nandI8I7 = new GUINandGate(submodelModifiable, 1);
44                 GUINandGate notI6 = new GUINandGate(submodelModifiable, 1);
45                 GUINandGate nandRSH = new GUINandGate(submodelModifiable, 1);
46                 GUINandGate nandRAMWE = new GUINandGate(submodelModifiable, 1);
47                 GUINandGate nandI7NotI8 = new GUINandGate(submodelModifiable, 1);
48                 GUINandGate nandLSH = new GUINandGate(submodelModifiable, 1);
49                 GUINandGate notRSH = new GUINandGate(submodelModifiable, 1);
50                 GUINandGate andI7NotI8 = new GUINandGate(submodelModifiable, 1);
51                 GUINandGate nandQWE = new GUINandGate(submodelModifiable, 1);
52                 GUINandGate nandYF = new GUINandGate(submodelModifiable, 1);
53                 GUINandGate notQWE = new GUINandGate(submodelModifiable, 1);
54
55                 WireCrossPoint cpI81 = new WireCrossPoint(submodelModifiable, 1);
56                 WireCrossPoint cpI82 = new WireCrossPoint(submodelModifiable, 1);
57                 WireCrossPoint cpI83 = new WireCrossPoint(submodelModifiable, 1);
58                 WireCrossPoint cpI71 = new WireCrossPoint(submodelModifiable, 1);
59                 WireCrossPoint cpI72 = new WireCrossPoint(submodelModifiable, 1);
60                 WireCrossPoint cpI73 = new WireCrossPoint(submodelModifiable, 1);
61                 WireCrossPoint cpI6 = new WireCrossPoint(submodelModifiable, 1);
62                 WireCrossPoint cpNotI7 = new WireCrossPoint(submodelModifiable, 1);
63                 WireCrossPoint cpNotI81 = new WireCrossPoint(submodelModifiable, 1);
64                 WireCrossPoint cpNotI82 = new WireCrossPoint(submodelModifiable, 1);
65                 WireCrossPoint cpNandI8I7 = new WireCrossPoint(submodelModifiable, 1);
66                 WireCrossPoint cpNotRSH = new WireCrossPoint(submodelModifiable, 1);
67                 WireCrossPoint cpNandI7NotI81 = new WireCrossPoint(submodelModifiable, 1);
68                 WireCrossPoint cpNandI7NotI82 = new WireCrossPoint(submodelModifiable, 1);
69                 WireCrossPoint cpNotI6 = new WireCrossPoint(submodelModifiable, 1);
70                 WireCrossPoint cpNandQWE = new WireCrossPoint(submodelModifiable, 1);
71
72                 notI8.moveTo(15, 10);
73                 notI7.moveTo(15, 50);
74                 nandI8I7.moveTo(15, 90);
75                 notI6.moveTo(15, 150);
76                 nandRSH.moveTo(50, 10);
77                 nandRAMWE.moveTo(50, 50);
78                 nandI7NotI8.moveTo(50, 90);
79                 nandLSH.moveTo(50, 130);
80                 notRSH.moveTo(80, 10);
81                 andI7NotI8.moveTo(80, 90);
82                 nandQWE.moveTo(80, 145);
83                 nandYF.moveTo(110, 105);
84                 notQWE.moveTo(115, 210);
85                 cpI81.moveCenterTo(5, 20);
86                 cpI82.moveCenterTo(5, 15);
87                 cpI83.moveCenterTo(5, 25);
88                 cpI71.moveCenterTo(10, 60);
89                 cpI72.moveCenterTo(10, 65);
90                 cpI73.moveCenterTo(10, 105);
91                 cpI6.moveCenterTo(5, 155);
92                 cpNotI7.moveCenterTo(40, 60);
93                 cpNotI81.moveCenterTo(45, 20);
94                 cpNotI82.moveCenterTo(45, 55);
95                 cpNandI8I7.moveCenterTo(40, 135);
96                 cpNotRSH.moveCenterTo(75, 20);
97                 cpNandI7NotI81.moveCenterTo(75, 100);
98                 cpNandI7NotI82.moveCenterTo(75, 105);
99                 cpNotI6.moveCenterTo(75, 160);
100                 cpNandQWE.moveCenterTo(110, 215);
101
102                 new GUIWire(submodelModifiable, I8, cpI81, new Point[0]);
103                 new GUIWire(submodelModifiable, cpI81, cpI82, new Point[0]);
104                 new GUIWire(submodelModifiable, cpI81, cpI83, new Point[0]);
105                 new GUIWire(submodelModifiable, cpI82, notI8.getPin("A"), new Point[0]);
106                 new GUIWire(submodelModifiable, cpI83, notI8.getPin("B"), new Point[0]);
107                 new GUIWire(submodelModifiable, I7, cpI71, new Point[0]);
108                 new GUIWire(submodelModifiable, cpI71, notI7.getPin("A"), new Point(10, 55));
109                 new GUIWire(submodelModifiable, cpI71, cpI72, new Point[0]);
110                 new GUIWire(submodelModifiable, cpI72, notI7.getPin("B"), new Point[0]);
111                 new GUIWire(submodelModifiable, cpI72, cpI73, new Point[0]);
112                 new GUIWire(submodelModifiable, cpI73, nandI8I7.getPin("B"), new Point[0]);
113                 new GUIWire(submodelModifiable, cpI83, nandI8I7.getPin("A"), new Point(5, 95));
114                 new GUIWire(submodelModifiable, I6, cpI6, new Point(5, 100));
115                 new GUIWire(submodelModifiable, cpI6, notI6.getPin("A"), new Point[0]);
116                 new GUIWire(submodelModifiable, cpI6, notI6.getPin("B"), new Point(5, 165));
117                 new GUIWire(submodelModifiable, cpI82, nandRSH.getPin("A"), new Point(5, 5), new Point(40, 5), new Point(40, 15));
118                 new GUIWire(submodelModifiable, notI7.getPin("Y"), cpNotI7, new Point[0]);
119                 new GUIWire(submodelModifiable, cpNotI7, nandRSH.getPin("B"), new Point(40, 25));
120                 new GUIWire(submodelModifiable, cpNotI7, nandRAMWE.getPin("B"), new Point(40, 65));
121                 new GUIWire(submodelModifiable, notI8.getPin("Y"), cpNotI81, new Point[0]);
122                 new GUIWire(submodelModifiable, cpNotI81, NSH, new Point(45, 5), new Point(135, 5), new Point(135, 20));
123                 new GUIWire(submodelModifiable, cpNotI81, cpNotI82, new Point[0]);
124                 new GUIWire(submodelModifiable, cpNotI82, nandRAMWE.getPin("A"), new Point[0]);
125                 new GUIWire(submodelModifiable, cpNotI82, nandI7NotI8.getPin("A"), new Point(45, 95));
126                 new GUIWire(submodelModifiable, cpI73, nandI7NotI8.getPin("B"), new Point(10, 115), new Point(45, 115), new Point(45, 105));
127                 new GUIWire(submodelModifiable, nandI8I7.getPin("Y"), cpNandI8I7, new Point(40, 100));
128                 new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getPin("A"), new Point[0]);
129                 new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getPin("B"), new Point(40, 145));
130                 new GUIWire(submodelModifiable, nandRSH.getPin("Y"), cpNotRSH, new Point[0]);
131                 new GUIWire(submodelModifiable, cpNotRSH, notRSH.getPin("A"), new Point(75, 15));
132                 new GUIWire(submodelModifiable, cpNotRSH, notRSH.getPin("B"), new Point(75, 25));
133                 new GUIWire(submodelModifiable, nandRAMWE.getPin("Y"), RAMWE, new Point(125, 60), new Point(125, 100));
134                 new GUIWire(submodelModifiable, nandI7NotI8.getPin("Y"), cpNandI7NotI81, new Point[0]);
135                 new GUIWire(submodelModifiable, cpNandI7NotI81, andI7NotI8.getPin("A"), new Point(75, 95));
136                 new GUIWire(submodelModifiable, cpNandI7NotI81, cpNandI7NotI82, new Point[0]);
137                 new GUIWire(submodelModifiable, cpNandI7NotI82, andI7NotI8.getPin("B"), new Point[0]);
138                 new GUIWire(submodelModifiable, nandLSH.getPin("Y"), LSH, new Point(125, 140), new Point(125, 180));
139                 new GUIWire(submodelModifiable, cpNandI7NotI82, nandQWE.getPin("A"), new Point(75, 150));
140                 new GUIWire(submodelModifiable, notI6.getPin("Y"), cpNotI6, new Point[0]);
141                 new GUIWire(submodelModifiable, cpNotI6, nandQWE.getPin("B"), new Point[0]);
142                 new GUIWire(submodelModifiable, notRSH.getPin("Y"), RSH, new Point(130, 20), new Point(130, 60));
143                 new GUIWire(submodelModifiable, andI7NotI8.getPin("Y"), nandYF.getPin("A"));
144                 new GUIWire(submodelModifiable, cpNotI6, nandYF.getPin("B"), new Point(75, 170), new Point(105, 170), new Point(105, 120));
145                 new GUIWire(submodelModifiable, nandQWE.getPin("Y"), cpNandQWE, new Point(110, 155));
146                 new GUIWire(submodelModifiable, cpNandQWE, notQWE.getPin("A"), new Point[0]);
147                 new GUIWire(submodelModifiable, cpNandQWE, notQWE.getPin("B"), new Point(110, 225));
148                 new GUIWire(submodelModifiable, nandYF.getPin("Y"), YF);
149                 new GUIWire(submodelModifiable, notQWE.getPin("Y"), QWE, new Point[0]);
150         }
151
152         static
153         {
154                 IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901DestDecode.class.getCanonicalName(),
155                                 (m, p, n) -> new GUIAm2901DestDecode(m, n));
156         }
157 }