Implemented GUIAm2901DestDecode
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Wed, 12 Jun 2019 09:35:43 +0000 (11:35 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Wed, 12 Jun 2019 09:35:43 +0000 (11:35 +0200)
net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java
net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901DestDecode.java [new file with mode: 0644]

index 0b39b46..36f9c24 100644 (file)
@@ -5,7 +5,7 @@ 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.SimpleRectangularSubmodelComponent;
-import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901QReg;
+import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901DestDecode;
 import net.mograsim.logic.ui.model.wires.GUIWire;
 
 public class SubmodelComponentTestbench
@@ -18,7 +18,7 @@ public class SubmodelComponentTestbench
        @SuppressWarnings("unused") // for GUIWires being created
        public static void createTestbench(ViewModelModifiable model)
        {
-               SimpleRectangularSubmodelComponent comp = new GUIAm2901QReg(model);
+               SimpleRectangularSubmodelComponent comp = new GUIAm2901DestDecode(model);
 
                comp.moveTo(100, 0);
                for (int i = 0; i < comp.getInputPins().size(); i++)
diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901DestDecode.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901DestDecode.java
new file mode 100644 (file)
index 0000000..98c5782
--- /dev/null
@@ -0,0 +1,147 @@
+package net.mograsim.logic.ui.model.components.mi.nandbased.am2901;
+
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.mograsim.logic.ui.model.ViewModelModifiable;
+import net.mograsim.logic.ui.model.components.GUINandGate;
+import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent;
+import net.mograsim.logic.ui.model.wires.GUIWire;
+import net.mograsim.logic.ui.model.wires.Pin;
+import net.mograsim.logic.ui.model.wires.WireCrossPoint;
+
+public class GUIAm2901DestDecode extends SimpleRectangularSubmodelComponent
+{
+       public GUIAm2901DestDecode(ViewModelModifiable model)
+       {
+               super(model, 1, "GUIAm2901DestDecode");
+               setSubmodelScale(.25);
+               setInputCount(3);
+               setOutputCount(6);
+               initSubmodelComponents();
+       }
+
+       @SuppressWarnings("unused") // for GUIWires being created
+       private void initSubmodelComponents()
+       {
+               Pin I8 = getInputSubmodelPins().get(0);
+               Pin I7 = getInputSubmodelPins().get(1);
+               Pin I6 = getInputSubmodelPins().get(2);
+               Pin NSH = getOutputSubmodelPins().get(0);
+               Pin RSH = getOutputSubmodelPins().get(1);
+               Pin RAMWE = getOutputSubmodelPins().get(2);
+               Pin YF = getOutputSubmodelPins().get(3);
+               Pin LSH = getOutputSubmodelPins().get(4);
+               Pin QWE = getOutputSubmodelPins().get(5);
+
+               GUINandGate notI8 = new GUINandGate(submodelModifiable, 1);
+               GUINandGate notI7 = new GUINandGate(submodelModifiable, 1);
+               GUINandGate nandI8I7 = new GUINandGate(submodelModifiable, 1);
+               GUINandGate notI6 = new GUINandGate(submodelModifiable, 1);
+               GUINandGate nandRSH = new GUINandGate(submodelModifiable, 1);
+               GUINandGate nandRAMWE = new GUINandGate(submodelModifiable, 1);
+               GUINandGate nandI7NotI8 = new GUINandGate(submodelModifiable, 1);
+               GUINandGate nandLSH = new GUINandGate(submodelModifiable, 1);
+               GUINandGate notRSH = new GUINandGate(submodelModifiable, 1);
+               GUINandGate andI7NotI8 = new GUINandGate(submodelModifiable, 1);
+               GUINandGate nandQWE = new GUINandGate(submodelModifiable, 1);
+               GUINandGate nandYF = new GUINandGate(submodelModifiable, 1);
+               GUINandGate notQWE = new GUINandGate(submodelModifiable, 1);
+
+               WireCrossPoint cpI81 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpI82 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpI83 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpI71 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpI72 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpI73 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpI6 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNotI7 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNotI81 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNotI82 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNandI8I7 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNotRSH = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNandI7NotI81 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNandI7NotI82 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNotI6 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpNandQWE = new WireCrossPoint(submodelModifiable, 1);
+
+               notI8.moveTo(15, 10);
+               notI7.moveTo(15, 50);
+               nandI8I7.moveTo(15, 90);
+               notI6.moveTo(15, 150);
+               nandRSH.moveTo(50, 10);
+               nandRAMWE.moveTo(50, 50);
+               nandI7NotI8.moveTo(50, 90);
+               nandLSH.moveTo(50, 130);
+               notRSH.moveTo(80, 10);
+               andI7NotI8.moveTo(80, 90);
+               nandQWE.moveTo(80, 145);
+               nandYF.moveTo(110, 105);
+               notQWE.moveTo(115, 210);
+               cpI81.moveCenterTo(5, 20);
+               cpI82.moveCenterTo(5, 15);
+               cpI83.moveCenterTo(5, 25);
+               cpI71.moveCenterTo(10, 60);
+               cpI72.moveCenterTo(10, 65);
+               cpI73.moveCenterTo(10, 105);
+               cpI6.moveCenterTo(5, 155);
+               cpNotI7.moveCenterTo(40, 60);
+               cpNotI81.moveCenterTo(45, 20);
+               cpNotI82.moveCenterTo(45, 55);
+               cpNandI8I7.moveCenterTo(40, 135);
+               cpNotRSH.moveCenterTo(75, 20);
+               cpNandI7NotI81.moveCenterTo(75, 100);
+               cpNandI7NotI82.moveCenterTo(75, 105);
+               cpNotI6.moveCenterTo(75, 160);
+               cpNandQWE.moveCenterTo(110, 215);
+
+               new GUIWire(submodelModifiable, I8, cpI81, new Point[0]);
+               new GUIWire(submodelModifiable, cpI81, cpI82, new Point[0]);
+               new GUIWire(submodelModifiable, cpI81, cpI83, new Point[0]);
+               new GUIWire(submodelModifiable, cpI82, notI8.getInputPins().get(0), new Point[0]);
+               new GUIWire(submodelModifiable, cpI83, notI8.getInputPins().get(1), new Point[0]);
+               new GUIWire(submodelModifiable, I7, cpI71, new Point[0]);
+               new GUIWire(submodelModifiable, cpI71, notI7.getInputPins().get(0), new Point(10, 55));
+               new GUIWire(submodelModifiable, cpI71, cpI72, new Point[0]);
+               new GUIWire(submodelModifiable, cpI72, notI7.getInputPins().get(1), new Point[0]);
+               new GUIWire(submodelModifiable, cpI72, cpI73, new Point[0]);
+               new GUIWire(submodelModifiable, cpI73, nandI8I7.getInputPins().get(1), new Point[0]);
+               new GUIWire(submodelModifiable, cpI83, nandI8I7.getInputPins().get(0), new Point(5, 95));
+               new GUIWire(submodelModifiable, I6, cpI6, new Point(5, 100));
+               new GUIWire(submodelModifiable, cpI6, notI6.getInputPins().get(0), new Point[0]);
+               new GUIWire(submodelModifiable, cpI6, notI6.getInputPins().get(1), new Point(5, 165));
+               new GUIWire(submodelModifiable, cpI82, nandRSH.getInputPins().get(0), new Point(5, 5), new Point(40, 5), new Point(40, 15));
+               new GUIWire(submodelModifiable, notI7.getOutputPin(), cpNotI7, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI7, nandRSH.getInputPins().get(1), new Point(40, 25));
+               new GUIWire(submodelModifiable, cpNotI7, nandRAMWE.getInputPins().get(1), new Point(40, 65));
+               new GUIWire(submodelModifiable, notI8.getOutputPin(), cpNotI81, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI81, NSH, new Point(45, 5), new Point(135, 5), new Point(135, 20));
+               new GUIWire(submodelModifiable, cpNotI81, cpNotI82, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI82, nandRAMWE.getInputPins().get(0), new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI82, nandI7NotI8.getInputPins().get(0), new Point(45, 95));
+               new GUIWire(submodelModifiable, cpI73, nandI7NotI8.getInputPins().get(1), new Point(10, 115), new Point(45, 115),
+                               new Point(45, 105));
+               new GUIWire(submodelModifiable, nandI8I7.getOutputPin(), cpNandI8I7, new Point(40, 100));
+               new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getInputPins().get(0), new Point[0]);
+               new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getInputPins().get(1), new Point(40, 145));
+               new GUIWire(submodelModifiable, nandRSH.getOutputPin(), cpNotRSH, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotRSH, notRSH.getInputPins().get(0), new Point(75, 15));
+               new GUIWire(submodelModifiable, cpNotRSH, notRSH.getInputPins().get(1), new Point(75, 25));
+               new GUIWire(submodelModifiable, nandRAMWE.getOutputPin(), RAMWE, new Point(125, 60), new Point(125, 100));
+               new GUIWire(submodelModifiable, nandI7NotI8.getOutputPin(), cpNandI7NotI81, new Point[0]);
+               new GUIWire(submodelModifiable, cpNandI7NotI81, andI7NotI8.getInputPins().get(0), new Point(75, 95));
+               new GUIWire(submodelModifiable, cpNandI7NotI81, cpNandI7NotI82, new Point[0]);
+               new GUIWire(submodelModifiable, cpNandI7NotI82, andI7NotI8.getInputPins().get(1), new Point[0]);
+               new GUIWire(submodelModifiable, nandLSH.getOutputPin(), LSH, new Point(125, 140), new Point(125, 180));
+               new GUIWire(submodelModifiable, cpNandI7NotI82, nandQWE.getInputPins().get(0), new Point(75, 150));
+               new GUIWire(submodelModifiable, notI6.getOutputPin(), cpNotI6, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI6, nandQWE.getInputPins().get(1), new Point[0]);
+               new GUIWire(submodelModifiable, notRSH.getOutputPin(), RSH, new Point(130, 20), new Point(130, 60));
+               new GUIWire(submodelModifiable, andI7NotI8.getOutputPin(), nandYF.getInputPins().get(0));
+               new GUIWire(submodelModifiable, cpNotI6, nandYF.getInputPins().get(1), new Point(75, 170), new Point(105, 170),
+                               new Point(105, 120));
+               new GUIWire(submodelModifiable, nandQWE.getOutputPin(), cpNandQWE, new Point(110, 155));
+               new GUIWire(submodelModifiable, cpNandQWE, notQWE.getInputPins().get(0), new Point[0]);
+               new GUIWire(submodelModifiable, cpNandQWE, notQWE.getInputPins().get(1), new Point(110, 225));
+               new GUIWire(submodelModifiable, nandYF.getOutputPin(), YF);
+               new GUIWire(submodelModifiable, notQWE.getOutputPin(), QWE, new Point[0]);
+       }
+}
\ No newline at end of file