X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fexamples%2FSubmodelComponentTestbench.java;h=0b39b46ff4195b2c47ed8b48388be05c8073c88e;hb=efb72d6a77c6e8d71ad86c311f2c60c66219a468;hp=1898d0047e05f998d2da58cbef70f3ea2d6a6065;hpb=8cb74696d25006bba0a24954184a8c7214c07c11;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java index 1898d004..0b39b46f 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java @@ -4,8 +4,8 @@ import net.mograsim.logic.ui.SimpleLogicUIStandalone; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIBitDisplay; import net.mograsim.logic.ui.model.components.GUIManualSwitch; -import net.mograsim.logic.ui.model.components.SubmodelComponent; -import net.mograsim.logic.ui.model.components.mi.nandbased.GUInand3; +import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901QReg; import net.mograsim.logic.ui.model.wires.GUIWire; public class SubmodelComponentTestbench @@ -18,21 +18,20 @@ public class SubmodelComponentTestbench @SuppressWarnings("unused") // for GUIWires being created public static void createTestbench(ViewModelModifiable model) { - SubmodelComponent comp = new GUInand3(model); - int inputCount = 3; + SimpleRectangularSubmodelComponent comp = new GUIAm2901QReg(model); comp.moveTo(100, 0); - for (int i = 0; i < inputCount; i++) + for (int i = 0; i < comp.getInputPins().size(); i++) { GUIManualSwitch sw = new GUIManualSwitch(model); sw.moveTo(0, 20 * i); - new GUIWire(model, comp.getPins().get(i), sw.getOutputPin()); + new GUIWire(model, comp.getInputPins().get(i), sw.getOutputPin()); } - for (int i = inputCount; i < comp.getPins().size(); i++) + for (int i = 0; i < comp.getOutputPins().size(); i++) { GUIBitDisplay bd = new GUIBitDisplay(model); - bd.moveTo(200, 20 * (i - inputCount)); - new GUIWire(model, comp.getPins().get(i), bd.getInputPin()); + bd.moveTo(200, 20 * i); + new GUIWire(model, comp.getOutputPins().get(i), bd.getInputPin()); } } } \ No newline at end of file