package net.mograsim.logic.model.examples;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import net.mograsim.logic.model.SimpleLogicUIStandalone;
-import net.mograsim.logic.model.am2900.components.GUInor12;
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.SimpleRectangularHardcodedGUIComponent.Usage;
import net.mograsim.logic.model.model.wires.GUIWire;
import net.mograsim.logic.model.model.wires.Pin;
+import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
public class GUIComponentTestbench
{
@SuppressWarnings("unused") // for GUIWires being created
public static void createTestbench(ViewModelModifiable model)
{
-// GUIComponent comp = IndirectGUIComponentCreator.createComponent(model, "GUIAm2901", "Am2901");
- GUIComponent comp = new GUInor12(model, "or12");
+ GUIComponent comp = IndirectGUIComponentCreator.createComponent(model, "file:components/am2910/GUIAm2910.json", "Am2910");
+// GUIComponent comp = new GUImux4_12(model, "c");
// guess which pins are outputs and which are inputs
// TODO this code exists four times... but it seems too "hacky" to put it in a helper class
inputPinNames.sort(Comparator.comparing(comp::getPin, Comparator.comparing(Pin::getRelY)));
outputPinNames.sort(Comparator.comparing(comp::getPin, Comparator.comparing(Pin::getRelY)));
+ inputPinNames = Arrays.asList("C", "D", "_RLD", "_CC", "_CCEN", "I", "CI");
+ outputPinNames = Arrays.asList("_FULL", "_PL", "_MAP", "_VECT", "Y");
+
comp.moveTo(100, 0);
for (int i = 0; i < inputPinNames.size(); i++)
{
String pinName = inputPinNames.get(i);
- if (comp.getPin(pinName).logicWidth == 1)
- {
- GUIManualSwitch sw = new GUIManualSwitch(model);
- sw.moveTo(0, 20 * i);
- new GUIWire(model, comp.getPin(pinName), sw.getOutputPin());
- }
+ GUIManualSwitch sw = new GUIManualSwitch(model, comp.getPin(pinName).logicWidth);
+ sw.moveTo(0, 20 * i);
+ new GUIWire(model, comp.getPin(pinName), sw.getOutputPin());
}
for (int i = 0; i < outputPinNames.size(); i++)
{
String pinName = outputPinNames.get(i);
- if (comp.getPin(pinName).logicWidth == 1)
- {
- GUIBitDisplay bd = new GUIBitDisplay(model);
- bd.moveTo(200, 20 * i);
- new GUIWire(model, comp.getPin(pinName), bd.getInputPin());
- }
+ GUIBitDisplay bd = new GUIBitDisplay(model, comp.getPin(pinName).logicWidth);
+ bd.moveTo(200, 20 * i);
+ new GUIWire(model, comp.getPin(pinName), bd.getInputPin());
}
}
}
\ No newline at end of file