X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fexamples%2FSubmodelComponentTestbench.java;h=7218fecc2414e8e8eb90d5f04d16a53bc51b0a0d;hb=19ee1a7fdb06a1df65cd7df78fed935124496707;hp=d51a1f8604e72c2e45bbff080d2b063d91b231dd;hpb=7b0da7328f81fd64f3f674e33ea030e896759a58;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 d51a1f86..7218fecc 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,39 +4,34 @@ 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.GUIAm2901ALUInclDecode; import net.mograsim.logic.ui.model.wires.GUIWire; -import net.mograsim.logic.ui.modeladapter.LogicModelParameters; public class SubmodelComponentTestbench { public static void main(String[] args) { - LogicModelParameters params = new LogicModelParameters(); - params.gateProcessTime = 1; - params.wireTravelTime = 1; - SimpleLogicUIStandalone.executeVisualisation(SubmodelComponentTestbench::createTestbench, params); + SimpleLogicUIStandalone.executeVisualisation(SubmodelComponentTestbench::createTestbench); } @SuppressWarnings("unused") // for GUIWires being created public static void createTestbench(ViewModelModifiable model) { - SubmodelComponent comp = new GUInand3(model); - int inputCount = 3; + SimpleRectangularSubmodelComponent comp = new GUIAm2901ALUInclDecode(model); comp.moveTo(100, 0); - for (int i = 0; i < inputCount; i++) + for (int i = 0; i < comp.getInputPinNames().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.getPin(comp.getInputPinNames().get(i)), sw.getOutputPin()); } - for (int i = inputCount; i < comp.getPins().size(); i++) + for (int i = 0; i < comp.getOutputPinNames().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.getPin(comp.getOutputPinNames().get(i)), bd.getInputPin()); } } } \ No newline at end of file