Hardcoded GUImux1_4 coordinates
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUImux1_4.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 /**
11  * @formatter:off
12  * Inputs:
13  * 0: select
14  * 1: I0_0
15  * 2: I0_1
16  * 3: I0_2
17  * 4: I0_3
18  * 5: I1_0
19  * 6: I1_1
20  * 7: I1_2
21  * 8: I1_3
22  * Outputs:
23  * 0: Y0
24  * 1: Y1
25  * 2: Y2
26  * 3: Y3
27  * @formatter:on
28  */
29 public class GUImux1_4 extends SimpleRectangularSubmodelComponent
30 {
31         public GUImux1_4(ViewModelModifiable model)
32         {
33                 super(model, 1, "GUImux1_4");
34                 setSubmodelScale(.4);
35                 setInputCount(9);
36                 setOutputCount(4);
37                 initSubmodelComponents();
38         }
39
40         @SuppressWarnings("unused")
41         private void initSubmodelComponents()
42         {
43                 Pin S0 = getInputSubmodelPins().get(0);
44                 Pin I0_1 = getInputSubmodelPins().get(1);
45                 Pin I0_2 = getInputSubmodelPins().get(2);
46                 Pin I0_3 = getInputSubmodelPins().get(3);
47                 Pin I0_4 = getInputSubmodelPins().get(4);
48                 Pin I1_1 = getInputSubmodelPins().get(5);
49                 Pin I1_2 = getInputSubmodelPins().get(6);
50                 Pin I1_3 = getInputSubmodelPins().get(7);
51                 Pin I1_4 = getInputSubmodelPins().get(8);
52                 Pin Y1 = getOutputSubmodelPins().get(0);
53                 Pin Y2 = getOutputSubmodelPins().get(1);
54                 Pin Y3 = getOutputSubmodelPins().get(2);
55                 Pin Y4 = getOutputSubmodelPins().get(3);
56
57                 GUImux1 mux1 = new GUImux1(submodelModifiable);
58                 GUImux1 mux2 = new GUImux1(submodelModifiable);
59                 GUImux1 mux3 = new GUImux1(submodelModifiable);
60                 GUImux1 mux4 = new GUImux1(submodelModifiable);
61
62                 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
63                 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
64                 WireCrossPoint cp3 = new WireCrossPoint(submodelModifiable, 1);
65
66                 mux1.moveTo(30, 7.5);
67                 mux2.moveTo(30, 42.5);
68                 mux3.moveTo(30, 77.5);
69                 mux4.moveTo(30, 112.5);
70                 cp1.moveTo(25, 12.5);
71                 cp2.moveTo(25, 47.5);
72                 cp3.moveTo(25, 82.5);
73
74                 new GUIWire(submodelModifiable, S0, cp1, new Point[0]);
75                 new GUIWire(submodelModifiable, cp1, mux1.getInputPins().get(0), new Point[0]);
76                 new GUIWire(submodelModifiable, I0_1, mux1.getInputPins().get(1), new Point(5, 37.5), new Point(5, 22.5));
77                 new GUIWire(submodelModifiable, I1_1, mux1.getInputPins().get(2), new Point(10, 137.5), new Point(10, 32.5));
78                 new GUIWire(submodelModifiable, mux1.getOutputPins().get(0), Y1, new Point[0]);
79                 new GUIWire(submodelModifiable, cp1, cp2, new Point[0]);
80                 new GUIWire(submodelModifiable, cp2, mux2.getInputPins().get(0), new Point[0]);
81                 new GUIWire(submodelModifiable, I0_2, mux2.getInputPins().get(1), new Point(5, 62.5), new Point(5, 57.5));
82                 new GUIWire(submodelModifiable, I1_2, mux2.getInputPins().get(2), new Point(15, 162.5), new Point(15, 67.5));
83                 new GUIWire(submodelModifiable, mux2.getOutputPins().get(0), Y2);
84                 new GUIWire(submodelModifiable, cp2, cp3, new Point[0]);
85                 new GUIWire(submodelModifiable, cp3, mux3.getInputPins().get(0), new Point[0]);
86                 new GUIWire(submodelModifiable, I0_3, mux3.getInputPins().get(1), new Point(5, 87.5), new Point(5, 92.5));
87                 new GUIWire(submodelModifiable, I1_3, mux3.getInputPins().get(2), new Point(20, 187.5), new Point(20, 102.5));
88                 new GUIWire(submodelModifiable, mux3.getOutputPins().get(0), Y3);
89                 new GUIWire(submodelModifiable, cp3, mux4.getInputPins().get(0), new Point(25, 117.5));
90                 new GUIWire(submodelModifiable, I0_4, mux4.getInputPins().get(1), new Point(5, 112.5), new Point(5, 127.5));
91                 new GUIWire(submodelModifiable, I1_4, mux4.getInputPins().get(2), new Point(25, 212.5), new Point(25, 137.5));
92                 new GUIWire(submodelModifiable, mux4.getOutputPins().get(0), Y4);
93
94         }
95 }