From: Daniel Kirschten Date: Sat, 31 Aug 2019 15:32:02 +0000 (+0200) Subject: Moved Am2904/Am2910Testbenches to test source folder X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=500d5825bb557014eed80819f59a58b43ff71b05;p=Mograsim.git Moved Am2904/Am2910Testbenches to test source folder --- diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2904Testbench.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2904Testbench.java deleted file mode 100644 index a4c4290a..00000000 --- a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2904Testbench.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.mograsim.logic.model.examples; - -import net.haspamelodica.swt.helper.gcs.GeneralGC; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; -import net.mograsim.logic.core.types.Bit; -import net.mograsim.logic.core.types.BitVector; -import net.mograsim.logic.model.SimpleLogicUIStandalone; -import net.mograsim.logic.model.SimpleLogicUIStandalone.VisualisationObjects; -import net.mograsim.logic.model.model.ViewModelModifiable; -import net.mograsim.logic.model.model.components.atomic.GUIManualSwitch; -import net.mograsim.logic.model.model.components.submodels.SubmodelComponent; -import net.mograsim.logic.model.serializing.DeserializedSubmodelComponent; -import net.mograsim.logic.model.serializing.IdentifierGetter; -import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; -import net.mograsim.logic.model.snippets.Renderer; - -public class Am2904Testbench -{ - public static void main(String[] args) - { - SimpleLogicUIStandalone.executeVisualisation(Am2904Testbench::create, Am2904Testbench::beforeRun); - } - - public static void create(ViewModelModifiable model) - { - // TODO use _SE in GUIAm2904.json - // TODO replace with proper ViewModel deserialization - DeserializedSubmodelComponent testbench = (DeserializedSubmodelComponent) IndirectGUIComponentCreator.createComponent(model, - "file:GUIAm2904Testbench.json", "testbench"); - testbench.setSize(1000, 1000); - testbench.setOutlineRenderer(new Renderer() - { - @Override - public Object getParamsForSerializing(IdentifierGetter idGetter) - { - return null; - } - - @Override - public void render(GeneralGC gc, Rectangle visibleRegion) - { - // do nothing - } - }); - } - - public static void beforeRun(VisualisationObjects vis) - { - ((SubmodelComponent) vis.model.getComponentsByName().get("testbench")).submodel.getComponentsByName().values().forEach(c -> - { - if (c instanceof GUIManualSwitch) - { - GUIManualSwitch cCasted = (GUIManualSwitch) c; - cCasted.setHighLevelState("out", BitVector.of(Bit.ZERO, cCasted.logicWidth)); - } - }); - } -} \ No newline at end of file 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 deleted file mode 100644 index 132b9135..00000000 --- a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/Am2910Testbench.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.mograsim.logic.model.examples; - -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.mograsim.logic.core.types.Bit; -import net.mograsim.logic.core.types.BitVector; -import net.mograsim.logic.model.SimpleLogicUIStandalone; -import net.mograsim.logic.model.SimpleLogicUIStandalone.VisualisationObjects; -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, Am2910Testbench::beforeRun); - } - - @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"); - GUIManualSwitch _OE = new GUIManualSwitch(model, 1, "_OE"); - 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); - _OE.moveTo(60, 85); - - 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)); - new GUIWire(model, am2910.getPin("_OE"), _OE.getOutputPin()); - } - - public static void beforeRun(VisualisationObjects vis) - { - vis.model.getComponentsByName().values().forEach(c -> - { - if (c instanceof GUIManualSwitch) - { - GUIManualSwitch cCasted = (GUIManualSwitch) c; - cCasted.setHighLevelState("out", BitVector.of(Bit.ZERO, cCasted.logicWidth)); - } - }); - } -} \ No newline at end of file diff --git a/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2904/Am2904Testbench.java b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2904/Am2904Testbench.java new file mode 100644 index 00000000..a09de95b --- /dev/null +++ b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2904/Am2904Testbench.java @@ -0,0 +1,58 @@ +package net.mograsim.logic.model.am2900.am2904; + +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.core.types.Bit; +import net.mograsim.logic.core.types.BitVector; +import net.mograsim.logic.model.SimpleLogicUIStandalone; +import net.mograsim.logic.model.SimpleLogicUIStandalone.VisualisationObjects; +import net.mograsim.logic.model.model.ViewModelModifiable; +import net.mograsim.logic.model.model.components.atomic.GUIManualSwitch; +import net.mograsim.logic.model.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.model.serializing.DeserializedSubmodelComponent; +import net.mograsim.logic.model.serializing.IdentifierGetter; +import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; +import net.mograsim.logic.model.snippets.Renderer; + +public class Am2904Testbench +{ + public static void main(String[] args) + { + SimpleLogicUIStandalone.executeVisualisation(Am2904Testbench::create, Am2904Testbench::beforeRun); + } + + public static void create(ViewModelModifiable model) + { + // TODO use _SE in GUIAm2904.json + // TODO replace with proper ViewModel deserialization + DeserializedSubmodelComponent testbench = (DeserializedSubmodelComponent) IndirectGUIComponentCreator.createComponent(model, + "file:GUIAm2904Testbench.json", "testbench"); + testbench.setSize(1000, 1000); + testbench.setOutlineRenderer(new Renderer() + { + @Override + public Object getParamsForSerializing(IdentifierGetter idGetter) + { + return null; + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + // do nothing + } + }); + } + + public static void beforeRun(VisualisationObjects vis) + { + ((SubmodelComponent) vis.model.getComponentsByName().get("testbench")).submodel.getComponentsByName().values().forEach(c -> + { + if (c instanceof GUIManualSwitch) + { + GUIManualSwitch cCasted = (GUIManualSwitch) c; + cCasted.setHighLevelState("out", BitVector.of(Bit.ZERO, cCasted.logicWidth)); + } + }); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2910/Am2910Testbench.java b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2910/Am2910Testbench.java new file mode 100644 index 00000000..028de6ea --- /dev/null +++ b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2910/Am2910Testbench.java @@ -0,0 +1,80 @@ +package net.mograsim.logic.model.am2900.am2910; + +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.mograsim.logic.core.types.Bit; +import net.mograsim.logic.core.types.BitVector; +import net.mograsim.logic.model.SimpleLogicUIStandalone; +import net.mograsim.logic.model.SimpleLogicUIStandalone.VisualisationObjects; +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, Am2910Testbench::beforeRun); + } + + @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"); + GUIManualSwitch _OE = new GUIManualSwitch(model, 1, "_OE"); + 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); + _OE.moveTo(60, 85); + + 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)); + new GUIWire(model, am2910.getPin("_OE"), _OE.getOutputPin()); + } + + public static void beforeRun(VisualisationObjects vis) + { + vis.model.getComponentsByName().values().forEach(c -> + { + if (c instanceof GUIManualSwitch) + { + GUIManualSwitch cCasted = (GUIManualSwitch) c; + cCasted.setHighLevelState("out", BitVector.of(Bit.ZERO, cCasted.logicWidth)); + } + }); + } +} \ No newline at end of file