X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fexamples%2FModelComponentTestbench.java;h=7a009d971e30826b7dbe4eaa22db8fe7d2e01381;hb=13befb68923c540a13cfe5b5b28bf0f7ddf5c41b;hp=297075a8daf6728f23a9a19ee8a7bb8cca2d35eb;hpb=8715b7b869a0786adb2a853770d23fa9352d9072;p=Mograsim.git diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java index 297075a8..7a009d97 100644 --- a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java +++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java @@ -6,14 +6,15 @@ import java.util.List; import net.mograsim.logic.model.SimpleLogicUIStandalone; import net.mograsim.logic.model.am2900.Am2900Loader; -import net.mograsim.logic.model.am2900.machine.Am2900MachineDefinition; import net.mograsim.logic.model.model.LogicModelModifiable; import net.mograsim.logic.model.model.components.ModelComponent; 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.ModelTextComponent; import net.mograsim.logic.model.model.wires.ModelWire; import net.mograsim.logic.model.model.wires.Pin; import net.mograsim.logic.model.model.wires.PinUsage; +import net.mograsim.logic.model.serializing.IndirectModelComponentCreator; public class ModelComponentTestbench { @@ -26,7 +27,8 @@ public class ModelComponentTestbench public static void createTestbench(LogicModelModifiable model) { Am2900Loader.setup(); - ModelComponent comp = new Am2900MachineDefinition().createNew(model).getAm2900(); +// ModelComponent comp = new Am2900ExpertMachineDefinition().createNew(model).getAm2900(); + ModelComponent comp = IndirectModelComponentCreator.createComponent(model, "ram5_12"); List inputPinNames = new ArrayList<>(); List outputPinNames = new ArrayList<>(); @@ -34,6 +36,7 @@ public class ModelComponentTestbench if (p.usage == PinUsage.INPUT) inputPinNames.add(p.name); else + // TODO handle TRISTATE pins outputPinNames.add(p.name); inputPinNames.sort(Comparator.comparing(comp::getPin, Comparator.comparing(Pin::getRelY))); @@ -43,15 +46,17 @@ public class ModelComponentTestbench for (int i = 0; i < inputPinNames.size(); i++) { String pinName = inputPinNames.get(i); - ModelManualSwitch sw = new ModelManualSwitch(model, comp.getPin(pinName).logicWidth); + ModelManualSwitch sw = new ModelManualSwitch(model, comp.getPin(pinName).logicWidth, pinName); sw.moveTo(0, 20 * i); + new ModelTextComponent(model, pinName).moveTo(20, 20 * i); new ModelWire(model, comp.getPin(pinName), sw.getOutputPin()); } for (int i = 0; i < outputPinNames.size(); i++) { String pinName = outputPinNames.get(i); - ModelBitDisplay bd = new ModelBitDisplay(model, comp.getPin(pinName).logicWidth); + ModelBitDisplay bd = new ModelBitDisplay(model, comp.getPin(pinName).logicWidth, pinName); bd.moveTo(200, 20 * i); + new ModelTextComponent(model, pinName).moveTo(220, 20 * i); new ModelWire(model, comp.getPin(pinName), bd.getInputPin()); } }