X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.am2900%2Ftest%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fam2900%2Fam2901%2FAm2901Testbench.java;h=ef760f14a0ecf8117a2b64e2dbaf64eedf6e09ae;hb=3a52b6bffe52db5dd5ca907b4b3dfd368a58e14f;hp=4a8e389b3b7957762a8abaee5c3a4abfdfba1104;hpb=21ffb2a7f764069fb3c55b71647b43e8803e668c;p=Mograsim.git diff --git a/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2901/Am2901Testbench.java b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2901/Am2901Testbench.java index 4a8e389b..ef760f14 100644 --- a/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2901/Am2901Testbench.java +++ b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/am2901/Am2901Testbench.java @@ -8,40 +8,41 @@ 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.GUIAndGate; -import net.mograsim.logic.model.model.components.atomic.GUIBitDisplay; -import net.mograsim.logic.model.model.components.atomic.GUIManualSwitch; -import net.mograsim.logic.model.model.components.atomic.GUINotGate; -import net.mograsim.logic.model.model.components.atomic.TextComponent; -import net.mograsim.logic.model.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.model.am2900.Am2900Loader; +import net.mograsim.logic.model.model.LogicModelModifiable; +import net.mograsim.logic.model.model.components.ModelComponent; +import net.mograsim.logic.model.model.components.atomic.ModelAndGate; +import net.mograsim.logic.model.model.components.atomic.ModelBitDisplay; +import net.mograsim.logic.model.model.components.atomic.ModelManualSwitch; +import net.mograsim.logic.model.model.components.atomic.ModelNotGate; +import net.mograsim.logic.model.model.components.atomic.ModelTextComponent; import net.mograsim.logic.model.model.wires.Pin; import net.mograsim.logic.model.model.wires.PinUsage; -import net.mograsim.logic.model.model.wires.WireCrossPoint; -import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; +import net.mograsim.logic.model.model.wires.ModelWireCrossPoint; +import net.mograsim.logic.model.serializing.IndirectModelComponentCreator; import net.mograsim.logic.model.util.ModellingTool; public class Am2901Testbench { public static void main(String[] args) { + Am2900Loader.setup(); SimpleLogicUIStandalone.executeVisualisation(Am2901Testbench::createTestbench, Am2901Testbench::beforeRun); } - public static void createTestbench(ViewModelModifiable model) + public static void createTestbench(LogicModelModifiable model) { - GUIComponent comp = IndirectGUIComponentCreator.createComponent(model, "GUIAm2901"); + ModelComponent comp = IndirectModelComponentCreator.createComponent(model, "Am2901"); ModellingTool tool = ModellingTool.createFor(model); comp.moveTo(240, 0); - GUIManualSwitch enable = new GUIManualSwitch(model, 1); - WireCrossPoint wcp0 = new WireCrossPoint(model, 1); - GUINotGate not1 = new GUINotGate(model, 1); - GUINotGate not2 = new GUINotGate(model, 1); - GUINotGate not3 = new GUINotGate(model, 1); - GUIAndGate and = new GUIAndGate(model, 1); + ModelManualSwitch enable = new ModelManualSwitch(model, 1); + ModelWireCrossPoint wcp0 = new ModelWireCrossPoint(model, 1); + ModelNotGate not1 = new ModelNotGate(model, 1); + ModelNotGate not2 = new ModelNotGate(model, 1); + ModelNotGate not3 = new ModelNotGate(model, 1); + ModelAndGate and = new ModelAndGate(model, 1); tool.connect(wcp0, enable, ""); tool.connect(wcp0, and, "A"); tool.connect(wcp0, not1, "A"); @@ -72,9 +73,9 @@ public class Am2901Testbench double x = 55 + 70 * (i % 2); double y = 10 * i; - WireCrossPoint wcp = new WireCrossPoint(model, 1); - GUIComponent d_ff = IndirectGUIComponentCreator.createComponent(model, "GUIdff"); - GUIManualSwitch sw = new GUIManualSwitch(model, 1); + ModelWireCrossPoint wcp = new ModelWireCrossPoint(model, 1); + ModelComponent d_ff = IndirectModelComponentCreator.createComponent(model, "dff"); + ModelManualSwitch sw = new ModelManualSwitch(model, 1); tool.connect(last, wcp); tool.connect(wcp, d_ff, "C"); @@ -82,7 +83,7 @@ public class Am2901Testbench tool.connect(d_ff, comp, "Q", inputPinNames.get(i)); last = wcp.getPin(); - TextComponent label = new TextComponent(model, inputPinNames.get(i)); + ModelTextComponent label = new ModelTextComponent(model, inputPinNames.get(i)); sw.moveTo(x, y + 7.5); wcp.moveTo(160, y); @@ -94,22 +95,22 @@ public class Am2901Testbench { double x = 300 + 75 * (i % 2); double y = 10 * i - 2.5; - GUIBitDisplay bd = new GUIBitDisplay(model, 1); + ModelBitDisplay bd = new ModelBitDisplay(model, 1); bd.moveTo(x, y); tool.connect(bd.getInputPin(), comp, outputPinNames.get(i)); - TextComponent label = new TextComponent(model, outputPinNames.get(i)); + ModelTextComponent label = new ModelTextComponent(model, outputPinNames.get(i)); label.moveTo(x + 25, y); } } public static void beforeRun(VisualisationObjects vis) { - ((SubmodelComponent) vis.model.getComponentsByName().get("testbench")).submodel.getComponentsByName().values().forEach(c -> + vis.model.getComponentsByName().values().forEach(c -> { - if (c instanceof GUIManualSwitch) + if (c instanceof ModelManualSwitch) { - GUIManualSwitch cCasted = (GUIManualSwitch) c; + ModelManualSwitch cCasted = (ModelManualSwitch) c; cCasted.setHighLevelState("out", BitVector.of(Bit.ZERO, cCasted.logicWidth)); } });