e7b7e8c85ff78f68e67c4c3924e894de3dea1b73
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / examples / Am2910Testbench.java
1 package net.mograsim.logic.model.examples;
2
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.model.SimpleLogicUIStandalone;
5 import net.mograsim.logic.model.model.ViewModelModifiable;
6 import net.mograsim.logic.model.model.components.GUIComponent;
7 import net.mograsim.logic.model.model.components.atomic.GUIBitDisplay;
8 import net.mograsim.logic.model.model.components.atomic.GUIManualSwitch;
9 import net.mograsim.logic.model.model.wires.GUIWire;
10 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
11
12 public class Am2910Testbench
13 {
14         public static void main(String[] args)
15         {
16                 SimpleLogicUIStandalone.executeVisualisation(Am2910Testbench::create);
17         }
18
19         @SuppressWarnings("unused") // for GUIWires being created
20         public static void create(ViewModelModifiable model)
21         {
22                 GUIComponent am2910 = IndirectGUIComponentCreator.createComponent(model, "file:components/am2910/GUIAm2910.json", "Am2910");
23                 GUIManualSwitch C = new GUIManualSwitch(model, 1, "C");
24                 GUIManualSwitch D = new GUIManualSwitch(model, 12, "D");
25                 GUIManualSwitch _RLD = new GUIManualSwitch(model, 1, "_RLD");
26                 GUIManualSwitch _CC = new GUIManualSwitch(model, 1, "_CC");
27                 GUIManualSwitch _CCEN = new GUIManualSwitch(model, 1, "_CCEN");
28                 GUIManualSwitch I = new GUIManualSwitch(model, 4, "I");
29                 GUIManualSwitch CI = new GUIManualSwitch(model, 1, "CI");
30                 GUIBitDisplay _FULL = new GUIBitDisplay(model, 1, "_FULL");
31                 GUIBitDisplay _PL = new GUIBitDisplay(model, 1, "_PL");
32                 GUIBitDisplay _MAP = new GUIBitDisplay(model, 1, "_MAP");
33                 GUIBitDisplay _VECT = new GUIBitDisplay(model, 1, "_VECT");
34                 GUIBitDisplay Y = new GUIBitDisplay(model, 12, "Y");
35
36                 C.moveTo(35, -35);
37                 D.moveTo(10, -20);
38                 _RLD.moveTo(-30, -1.5);
39                 _CC.moveTo(-30, 20);
40                 _CCEN.moveTo(-30, 40);
41                 I.moveTo(-30, 60);
42                 CI.moveTo(75, 45);
43                 _FULL.moveTo(80, 6.5);
44                 _PL.moveTo(30, 85);
45                 _MAP.moveTo(30, 105);
46                 _VECT.moveTo(30, 125);
47                 Y.moveTo(40, 65);
48
49                 new GUIWire(model, C.getOutputPin(), am2910.getPin("C"), new Point(60, -27.5));
50                 new GUIWire(model, D.getOutputPin(), am2910.getPin("D"), new Point(36, -12.5));
51                 new GUIWire(model, _RLD.getOutputPin(), am2910.getPin("_RLD"), new Point[0]);
52                 new GUIWire(model, _CC.getOutputPin(), am2910.getPin("_CC"));
53                 new GUIWire(model, _CCEN.getOutputPin(), am2910.getPin("_CCEN"));
54                 new GUIWire(model, I.getOutputPin(), am2910.getPin("I"));
55                 new GUIWire(model, CI.getOutputPin(), am2910.getPin("CI"), new Point(100, 52.5), new Point(100, 40));
56                 new GUIWire(model, am2910.getPin("_FULL"), _FULL.getInputPin(), new Point[0]);
57                 new GUIWire(model, am2910.getPin("_PL"), _PL.getInputPin(), new Point(13, 92.5));
58                 new GUIWire(model, am2910.getPin("_MAP"), _MAP.getInputPin(), new Point(19, 112.5));
59                 new GUIWire(model, am2910.getPin("_VECT"), _VECT.getInputPin(), new Point(25, 132.5));
60                 new GUIWire(model, am2910.getPin("Y"), Y.getInputPin(), new Point(38, 72.5));
61         }
62 }