From a54978a4cdb094920a65c93007250cfa74926262 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Sun, 11 Aug 2019 09:57:05 +0200 Subject: [PATCH] Created Am2910Testbench --- .../logic/model/examples/Am2910Testbench.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2910Testbench.java diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2910Testbench.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2910Testbench.java new file mode 100644 index 00000000..e7b7e8c8 --- /dev/null +++ b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2910Testbench.java @@ -0,0 +1,62 @@ +package net.mograsim.logic.model.examples; + +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.mograsim.logic.model.SimpleLogicUIStandalone; +import net.mograsim.logic.model.model.ViewModelModifiable; +import net.mograsim.logic.model.model.components.GUIComponent; +import net.mograsim.logic.model.model.components.atomic.GUIBitDisplay; +import net.mograsim.logic.model.model.components.atomic.GUIManualSwitch; +import net.mograsim.logic.model.model.wires.GUIWire; +import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; + +public class Am2910Testbench +{ + public static void main(String[] args) + { + SimpleLogicUIStandalone.executeVisualisation(Am2910Testbench::create); + } + + @SuppressWarnings("unused") // for GUIWires being created + public static void create(ViewModelModifiable model) + { + GUIComponent am2910 = IndirectGUIComponentCreator.createComponent(model, "file:components/am2910/GUIAm2910.json", "Am2910"); + GUIManualSwitch C = new GUIManualSwitch(model, 1, "C"); + GUIManualSwitch D = new GUIManualSwitch(model, 12, "D"); + GUIManualSwitch _RLD = new GUIManualSwitch(model, 1, "_RLD"); + GUIManualSwitch _CC = new GUIManualSwitch(model, 1, "_CC"); + GUIManualSwitch _CCEN = new GUIManualSwitch(model, 1, "_CCEN"); + GUIManualSwitch I = new GUIManualSwitch(model, 4, "I"); + GUIManualSwitch CI = new GUIManualSwitch(model, 1, "CI"); + GUIBitDisplay _FULL = new GUIBitDisplay(model, 1, "_FULL"); + GUIBitDisplay _PL = new GUIBitDisplay(model, 1, "_PL"); + GUIBitDisplay _MAP = new GUIBitDisplay(model, 1, "_MAP"); + GUIBitDisplay _VECT = new GUIBitDisplay(model, 1, "_VECT"); + GUIBitDisplay Y = new GUIBitDisplay(model, 12, "Y"); + + C.moveTo(35, -35); + D.moveTo(10, -20); + _RLD.moveTo(-30, -1.5); + _CC.moveTo(-30, 20); + _CCEN.moveTo(-30, 40); + I.moveTo(-30, 60); + CI.moveTo(75, 45); + _FULL.moveTo(80, 6.5); + _PL.moveTo(30, 85); + _MAP.moveTo(30, 105); + _VECT.moveTo(30, 125); + Y.moveTo(40, 65); + + new GUIWire(model, C.getOutputPin(), am2910.getPin("C"), new Point(60, -27.5)); + new GUIWire(model, D.getOutputPin(), am2910.getPin("D"), new Point(36, -12.5)); + new GUIWire(model, _RLD.getOutputPin(), am2910.getPin("_RLD"), new Point[0]); + new GUIWire(model, _CC.getOutputPin(), am2910.getPin("_CC")); + new GUIWire(model, _CCEN.getOutputPin(), am2910.getPin("_CCEN")); + new GUIWire(model, I.getOutputPin(), am2910.getPin("I")); + new GUIWire(model, CI.getOutputPin(), am2910.getPin("CI"), new Point(100, 52.5), new Point(100, 40)); + new GUIWire(model, am2910.getPin("_FULL"), _FULL.getInputPin(), new Point[0]); + new GUIWire(model, am2910.getPin("_PL"), _PL.getInputPin(), new Point(13, 92.5)); + new GUIWire(model, am2910.getPin("_MAP"), _MAP.getInputPin(), new Point(19, 112.5)); + new GUIWire(model, am2910.getPin("_VECT"), _VECT.getInputPin(), new Point(25, 132.5)); + new GUIWire(model, am2910.getPin("Y"), Y.getInputPin(), new Point(38, 72.5)); + } +} \ No newline at end of file -- 2.17.1