Merge remote-tracking branch 'origin/development' into development
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 18 Aug 2019 16:36:36 +0000 (18:36 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 18 Aug 2019 16:36:36 +0000 (18:36 +0200)
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIdff4_finewe.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUImux4_12.java [deleted file]
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIsel4_12.java [new file with mode: 0644]
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2904/RegCTInstrDecode.java [new file with mode: 0644]
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/GUIComponentTestbench.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/GUIMerger.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/GUISplitter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/standardComponentIDMapping.json

index 758a945..fe55d7f 100644 (file)
@@ -28,7 +28,6 @@ public class GUIdff4_finewe extends SimpleRectangularHardcodedGUIComponent
                addPin(new Pin(this, "_WE2", 1, 0, 25), Usage.INPUT, Position.RIGHT);
                addPin(new Pin(this, "_WE3", 1, 0, 35), Usage.INPUT, Position.RIGHT);
                addPin(new Pin(this, "_WE4", 1, 0, 45), Usage.INPUT, Position.RIGHT);
-               addPin(new Pin(this, "_WE", 1, 0, 55), Usage.INPUT, Position.RIGHT);
                addPin(new Pin(this, "D1", 1, 0, 65), Usage.INPUT, Position.RIGHT);
                addPin(new Pin(this, "D2", 1, 0, 75), Usage.INPUT, Position.RIGHT);
                addPin(new Pin(this, "D3", 1, 0, 85), Usage.INPUT, Position.RIGHT);
@@ -48,7 +47,7 @@ public class GUIdff4_finewe extends SimpleRectangularHardcodedGUIComponent
 
                Bit CVal = readEnds.get("C").getValue();
 
-               if (QC[0] == ZERO && CVal == ONE && readEnds.get("_WE").getValue() == ZERO)
+               if (QC[0] == ZERO && CVal == ONE)
                        for (int i = 1; i < 5; i++)
                        {
                                Bit WEiVal = readEnds.get("_WE" + i).getValue();
diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUImux4_12.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUImux4_12.java
deleted file mode 100644 (file)
index e43888a..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-package net.mograsim.logic.model.am2900.components;
-
-import static net.mograsim.logic.core.types.Bit.ONE;
-import static net.mograsim.logic.core.types.Bit.U;
-import static net.mograsim.logic.core.types.Bit.X;
-import static net.mograsim.logic.core.types.Bit.Z;
-import static net.mograsim.logic.core.types.Bit.ZERO;
-
-import java.util.Map;
-
-import net.mograsim.logic.core.types.Bit;
-import net.mograsim.logic.core.types.BitVector;
-import net.mograsim.logic.core.wires.Wire.ReadEnd;
-import net.mograsim.logic.core.wires.Wire.ReadWriteEnd;
-import net.mograsim.logic.model.model.ViewModelModifiable;
-import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedGUIComponent;
-import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
-import net.mograsim.logic.model.snippets.symbolrenderers.PinNamesSymbolRenderer.PinNamesParams.Position;
-
-public class GUImux4_12 extends SimpleRectangularHardcodedGUIComponent
-{
-       public GUImux4_12(ViewModelModifiable model, String name)
-       {
-               super(model, name, "4-way MUX\n12 bit");
-               setSize(80, 40);
-               addPin(new Pin(this, "SA", 1, 0, 5), Usage.INPUT, Position.RIGHT);
-               addPin(new Pin(this, "SB", 1, 0, 15), Usage.INPUT, Position.RIGHT);
-               addPin(new Pin(this, "SC", 1, 0, 25), Usage.INPUT, Position.RIGHT);
-               addPin(new Pin(this, "SD", 1, 0, 35), Usage.INPUT, Position.RIGHT);
-               addPin(new Pin(this, "A", 12, 10, 0), Usage.INPUT, Position.BOTTOM);
-               addPin(new Pin(this, "B", 12, 30, 0), Usage.INPUT, Position.BOTTOM);
-               addPin(new Pin(this, "C", 12, 50, 0), Usage.INPUT, Position.BOTTOM);
-               addPin(new Pin(this, "D", 12, 70, 0), Usage.INPUT, Position.BOTTOM);
-               addPin(new Pin(this, "Y", 12, 40, 40), Usage.OUTPUT, Position.TOP);
-       }
-
-       @Override
-       protected Object recalculate(Object lastState, Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds)
-       {
-               Bit SAVal = readEnds.get("SA").getValue();
-               Bit SBVal = readEnds.get("SB").getValue();
-               Bit SCVal = readEnds.get("SC").getValue();
-               Bit SDVal = readEnds.get("SD").getValue();
-               BitVector YVal;
-               if (SAVal == X || SBVal == X || SCVal == X || SDVal == X)
-                       YVal = BitVector.of(X, 12);
-               else if (SAVal == U || SBVal == U || SCVal == U || SDVal == U)
-                       YVal = BitVector.of(U, 12);
-               else if (SAVal == Z || SBVal == Z || SCVal == Z || SDVal == Z)
-                       YVal = BitVector.of(X, 12);
-               else
-               {
-                       YVal = null;
-                       if (SAVal == ONE)
-                               YVal = readEnds.get("A").getValues();
-                       if (SBVal == ONE)
-                               if (YVal != null)
-                                       YVal = BitVector.of(X, 12);
-                               else
-                                       YVal = readEnds.get("B").getValues();
-                       if (SCVal == ONE)
-                               if (YVal != null)
-                                       YVal = BitVector.of(X, 12);
-                               else
-                                       YVal = readEnds.get("C").getValues();
-                       if (SDVal == ONE)
-                               if (YVal != null)
-                                       YVal = BitVector.of(X, 12);
-                               else
-                                       YVal = readEnds.get("D").getValues();
-                       if (YVal == null)
-                               YVal = BitVector.of(ZERO, 12);
-               }
-
-               readWriteEnds.get("Y").feedSignals(YVal);
-               return null;
-       }
-
-       static
-       {
-               IndirectGUIComponentCreator.setComponentSupplier(GUImux4_12.class.getCanonicalName(), (m, p, n) -> new GUImux4_12(m, n));
-       }
-}
\ No newline at end of file
diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIsel4_12.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIsel4_12.java
new file mode 100644 (file)
index 0000000..480a4b1
--- /dev/null
@@ -0,0 +1,84 @@
+package net.mograsim.logic.model.am2900.components;
+
+import static net.mograsim.logic.core.types.Bit.ONE;
+import static net.mograsim.logic.core.types.Bit.U;
+import static net.mograsim.logic.core.types.Bit.X;
+import static net.mograsim.logic.core.types.Bit.Z;
+import static net.mograsim.logic.core.types.Bit.ZERO;
+
+import java.util.Map;
+
+import net.mograsim.logic.core.types.Bit;
+import net.mograsim.logic.core.types.BitVector;
+import net.mograsim.logic.core.wires.Wire.ReadEnd;
+import net.mograsim.logic.core.wires.Wire.ReadWriteEnd;
+import net.mograsim.logic.model.model.ViewModelModifiable;
+import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedGUIComponent;
+import net.mograsim.logic.model.model.wires.Pin;
+import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
+import net.mograsim.logic.model.snippets.symbolrenderers.PinNamesSymbolRenderer.PinNamesParams.Position;
+
+public class GUIsel4_12 extends SimpleRectangularHardcodedGUIComponent
+{
+       public GUIsel4_12(ViewModelModifiable model, String name)
+       {
+               super(model, name, "4-way SEL\n12 bit");
+               setSize(80, 40);
+               addPin(new Pin(this, "SA", 1, 0, 5), Usage.INPUT, Position.RIGHT);
+               addPin(new Pin(this, "SB", 1, 0, 15), Usage.INPUT, Position.RIGHT);
+               addPin(new Pin(this, "SC", 1, 0, 25), Usage.INPUT, Position.RIGHT);
+               addPin(new Pin(this, "SD", 1, 0, 35), Usage.INPUT, Position.RIGHT);
+               addPin(new Pin(this, "A", 12, 10, 0), Usage.INPUT, Position.BOTTOM);
+               addPin(new Pin(this, "B", 12, 30, 0), Usage.INPUT, Position.BOTTOM);
+               addPin(new Pin(this, "C", 12, 50, 0), Usage.INPUT, Position.BOTTOM);
+               addPin(new Pin(this, "D", 12, 70, 0), Usage.INPUT, Position.BOTTOM);
+               addPin(new Pin(this, "Y", 12, 40, 40), Usage.OUTPUT, Position.TOP);
+       }
+
+       @Override
+       protected Object recalculate(Object lastState, Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds)
+       {
+               Bit SAVal = readEnds.get("SA").getValue();
+               Bit SBVal = readEnds.get("SB").getValue();
+               Bit SCVal = readEnds.get("SC").getValue();
+               Bit SDVal = readEnds.get("SD").getValue();
+               BitVector YVal;
+               if (SAVal == X || SBVal == X || SCVal == X || SDVal == X)
+                       YVal = BitVector.of(X, 12);
+               else if (SAVal == U || SBVal == U || SCVal == U || SDVal == U)
+                       YVal = BitVector.of(U, 12);
+               else if (SAVal == Z || SBVal == Z || SCVal == Z || SDVal == Z)
+                       YVal = BitVector.of(X, 12);
+               else
+               {
+                       YVal = null;
+                       if (SAVal == ONE)
+                               YVal = readEnds.get("A").getValues();
+                       if (SBVal == ONE)
+                               if (YVal != null)
+                                       YVal = BitVector.of(X, 12);
+                               else
+                                       YVal = readEnds.get("B").getValues();
+                       if (SCVal == ONE)
+                               if (YVal != null)
+                                       YVal = BitVector.of(X, 12);
+                               else
+                                       YVal = readEnds.get("C").getValues();
+                       if (SDVal == ONE)
+                               if (YVal != null)
+                                       YVal = BitVector.of(X, 12);
+                               else
+                                       YVal = readEnds.get("D").getValues();
+                       if (YVal == null)
+                               YVal = BitVector.of(ZERO, 12);
+               }
+
+               readWriteEnds.get("Y").feedSignals(YVal);
+               return null;
+       }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIsel4_12.class.getCanonicalName(), (m, p, n) -> new GUIsel4_12(m, n));
+       }
+}
\ No newline at end of file
diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2904/RegCTInstrDecode.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2904/RegCTInstrDecode.java
new file mode 100644 (file)
index 0000000..1419905
--- /dev/null
@@ -0,0 +1,279 @@
+package net.mograsim.logic.model.am2900.components.am2904;
+
+import static net.mograsim.logic.core.types.Bit.ONE;
+import static net.mograsim.logic.core.types.Bit.U;
+import static net.mograsim.logic.core.types.Bit.X;
+import static net.mograsim.logic.core.types.Bit.ZERO;
+
+import java.util.Map;
+
+import net.mograsim.logic.core.types.Bit;
+import net.mograsim.logic.core.wires.Wire.ReadEnd;
+import net.mograsim.logic.core.wires.Wire.ReadWriteEnd;
+import net.mograsim.logic.model.model.ViewModelModifiable;
+import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedGUIComponent;
+import net.mograsim.logic.model.model.wires.Pin;
+import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
+import net.mograsim.logic.model.snippets.symbolrenderers.PinNamesSymbolRenderer.PinNamesParams.Position;
+
+public class RegCTInstrDecode extends SimpleRectangularHardcodedGUIComponent
+{
+       public RegCTInstrDecode(ViewModelModifiable model, String name)
+       {
+               super(model, name, "Instruction\ndecode");
+               setSize(40, 40);
+               addPin(new Pin(this, "I", 6, 0, 20), Usage.INPUT, Position.RIGHT);
+               addPin(new Pin(this, "muSR_I1", 1, -1, -15), Usage.OUTPUT, null);
+               addPin(new Pin(this, "muSR_IM", 1, -1, -14), Usage.OUTPUT, null);
+               addPin(new Pin(this, "muSR_OVRRET", 1, -1, -13), Usage.OUTPUT, null);
+               addPin(new Pin(this, "muSR_CINV", 1, -1, -12), Usage.OUTPUT, null);
+               addPin(new Pin(this, "muSR__WEZ", 1, -1, -11), Usage.OUTPUT, null);
+               addPin(new Pin(this, "muSR__WEC", 1, -1, -10), Usage.OUTPUT, null);
+               addPin(new Pin(this, "muSR__WEN", 1, -1, -9), Usage.OUTPUT, null);
+               addPin(new Pin(this, "muSR__WEOVR", 1, -1, -8), Usage.OUTPUT, null);
+               addPin(new Pin(this, "MSR_1_Y_CINV__M", 1, -1, -7), Usage.OUTPUT, null);
+               addPin(new Pin(this, "MSR_mu_Y_SOC__M", 1, -1, -6), Usage.OUTPUT, null);
+               addPin(new Pin(this, "MSR_I_CINV_SOC__M", 1, -1, -5), Usage.OUTPUT, null);
+               addPin(new Pin(this, "CT_SRC", 2, -1, -4), Usage.OUTPUT, null);
+               addPin(new Pin(this, "CT_INV", 1, -1, -3), Usage.OUTPUT, null);
+               addPin(new Pin(this, "CT_MUX", 3, -1, -2), Usage.OUTPUT, null);
+               addPin(new Pin(this, "CT_EXP", 1, -1, -1), Usage.OUTPUT, null);
+       }
+
+       @Override
+       protected Object recalculate(Object lastState, Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds)
+       {
+               Bit[] IBits = readEnds.get("I").getValues().getBits();
+               int IAsInt = 0;
+               for (int i = 0; i < 6; i++)
+                       switch (IBits[5 - i])
+                       {
+                       case ONE:
+                               IAsInt |= 1 << i;
+                               break;
+                       case U:
+                               for (ReadWriteEnd e : readWriteEnds.values())
+                                       e.feedSignals(U);
+                               return null;
+                       case X:
+                       case Z:
+                               for (ReadWriteEnd e : readWriteEnds.values())
+                                       e.feedSignals(X);
+                               return null;
+                       case ZERO:
+                               break;
+                       default:
+                               throw new IllegalArgumentException("Unknown enum constant: " + IBits[i]);
+                       }
+               switch (IAsInt)
+               {
+               case 0:
+               case 2:
+                       readWriteEnds.get("muSR_I1").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_IM").feedSignals(ONE);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+                       break;
+               case 1:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+                       break;
+               case 3:
+                       readWriteEnds.get("muSR_I1").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+                       break;
+               case 6:
+               case 7:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ONE);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ONE);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+                       break;
+               case 8:
+                       readWriteEnds.get("muSR_I1").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
+                       break;
+               case 9:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
+                       break;
+               case 10:
+                       readWriteEnds.get("muSR_I1").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
+                       break;
+               case 11:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
+                       break;
+               case 12:
+                       readWriteEnds.get("muSR_I1").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
+                       break;
+               case 13:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
+                       break;
+               case 14:
+                       readWriteEnds.get("muSR_I1").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+                       break;
+               case 15:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+                       break;
+               case 24:
+               case 25:
+               case 40:
+               case 41:
+               case 56:
+               case 57:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ONE);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ONE);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+                       break;
+               default:
+                       readWriteEnds.get("muSR_I1").feedSignals(ONE);
+                       readWriteEnds.get("muSR_IM").feedSignals(ONE);
+                       readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
+                       readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
+                       readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
+               }
+               switch (IAsInt)
+               {
+               case 0:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ZERO);
+                       break;
+               case 1:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ZERO);
+                       break;
+               case 2:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ZERO);
+                       break;
+               case 3:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ZERO);
+                       break;
+               case 4:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ONE);
+                       break;
+               case 5:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ONE);
+                       break;
+               case 8:
+               case 9:
+               case 24:
+               case 25:
+               case 40:
+               case 41:
+               case 56:
+               case 57:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ONE);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ONE);
+                       break;
+               default:
+                       readWriteEnds.get("MSR_1_Y_CINV__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_mu_Y_SOC__M").feedSignals(ZERO);
+                       readWriteEnds.get("MSR_I_CINV_SOC__M").feedSignals(ONE);
+                       break;
+               }
+               readWriteEnds.get("CT_SRC").feedSignals(IBits[0], IBits[1]);
+               readWriteEnds.get("CT_INV").feedSignals(IBits[5]);
+               readWriteEnds.get("CT_MUX").feedSignals(IBits[2], IBits[3], IBits[4]);
+               readWriteEnds.get("CT_EXP").feedSignals((IAsInt & 0b1110) == 0b1110 ? ONE : ZERO);
+               return null;
+       }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(RegCTInstrDecode.class.getCanonicalName(),
+                               (m, p, n) -> new RegCTInstrDecode(m, n));
+       }
+}
\ No newline at end of file
index 4a16e53..5781322 100644 (file)
@@ -9,11 +9,11 @@ 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.GUIManualSwitch;
-import net.mograsim.logic.model.model.components.atomic.GUIMerger;
 import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedGUIComponent;
 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
 {
@@ -25,7 +25,8 @@ public class GUIComponentTestbench
        @SuppressWarnings("unused") // for GUIWires being created
        public static void createTestbench(ViewModelModifiable model)
        {
-               GUIComponent comp = new GUIMerger(model, 10, "");
+               GUIComponent comp = IndirectGUIComponentCreator.createComponent(model,
+                               "class:net.mograsim.logic.model.am2900.components.am2904.RegCTInstrDecode");
 
                // 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
index cee4b74..fc1743b 100644 (file)
@@ -1,5 +1,8 @@
 package net.mograsim.logic.model.model.components.atomic;
 
+import com.google.gson.JsonElement;
+import com.google.gson.JsonPrimitive;
+
 import net.haspamelodica.swt.helper.gcs.GeneralGC;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
 import net.mograsim.logic.core.types.BitVectorFormatter;
@@ -9,6 +12,8 @@ import net.mograsim.logic.model.model.components.GUIComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.MergerAdapter;
+import net.mograsim.logic.model.serializing.IdentifierGetter;
+import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
 import net.mograsim.preferences.ColorDefinition;
 import net.mograsim.preferences.ColorManager;
 import net.mograsim.preferences.Preferences;
@@ -56,6 +61,12 @@ public class GUIMerger extends GUIComponent
                gc.drawLine(posX + width / 2, posY + heightPerPin * logicWidth / 2, posX + width, posY + heightPerPin * logicWidth / 2);
        }
 
+       @Override
+       public JsonElement getParamsForSerializing(IdentifierGetter idGetter)
+       {
+               return new JsonPrimitive(logicWidth);
+       }
+
        public void setLogicModelBinding(ReadEnd[] inputEnds, ReadEnd outputEnd)
        {
                this.inputEnds = inputEnds;
@@ -65,5 +76,7 @@ public class GUIMerger extends GUIComponent
        static
        {
                ViewLogicModelAdapter.addComponentAdapter(new MergerAdapter());
+               IndirectGUIComponentCreator.setComponentSupplier(GUIMerger.class.getCanonicalName(),
+                               (m, p, n) -> new GUIMerger(m, p.getAsInt(), n));
        }
 }
\ No newline at end of file
index 1dc11d1..2211114 100644 (file)
@@ -1,5 +1,8 @@
 package net.mograsim.logic.model.model.components.atomic;
 
+import com.google.gson.JsonElement;
+import com.google.gson.JsonPrimitive;
+
 import net.haspamelodica.swt.helper.gcs.GeneralGC;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
 import net.mograsim.logic.core.types.BitVectorFormatter;
@@ -9,6 +12,8 @@ import net.mograsim.logic.model.model.components.GUIComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SplitterAdapter;
+import net.mograsim.logic.model.serializing.IdentifierGetter;
+import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
 import net.mograsim.preferences.ColorDefinition;
 import net.mograsim.preferences.ColorManager;
 import net.mograsim.preferences.Preferences;
@@ -56,6 +61,12 @@ public class GUISplitter extends GUIComponent
                }
        }
 
+       @Override
+       public JsonElement getParamsForSerializing(IdentifierGetter idGetter)
+       {
+               return new JsonPrimitive(logicWidth);
+       }
+
        public void setLogicModelBinding(ReadEnd inputEnd, ReadEnd[] outputEnds)
        {
                this.inputEnd = inputEnd;
@@ -65,5 +76,7 @@ public class GUISplitter extends GUIComponent
        static
        {
                ViewLogicModelAdapter.addComponentAdapter(new SplitterAdapter());
+               IndirectGUIComponentCreator.setComponentSupplier(GUISplitter.class.getCanonicalName(),
+                               (m, p, n) -> new GUISplitter(m, p.getAsInt(), n));
        }
 }
\ No newline at end of file
index 08a0a1c..92cd2f5 100644 (file)
@@ -32,7 +32,6 @@ mograsim version: 0.1.3
   "GUIinc12": "class:net.mograsim.logic.model.am2900.components.GUIinc12",
   "GUImux1": "file:components/GUImux1.json",
   "GUImux1_4": "file:components/GUImux1_4.json",
-  "GUImux4_12": "class:net.mograsim.logic.model.am2900.components.GUImux4_12",
   "GUInand3": "file:components/GUInand3.json",
   "GUInor12": "class:net.mograsim.logic.model.am2900.components.GUInor12",
   "GUInot4": "file:components/GUInot4.json",
@@ -43,6 +42,7 @@ mograsim version: 0.1.3
   "GUIram5_12": "class:net.mograsim.logic.model.am2900.components.GUIram5_12",
   "GUIsel2_4": "file:components/GUIsel2_4.json",
   "GUIsel3_4": "file:components/GUIsel3_4.json",
+  "GUIsel4_12": "class:net.mograsim.logic.model.am2900.components.GUImux4_12",
   "GUISplitter": "class:net.mograsim.logic.model.model.components.atomic.GUISplitter",
   "GUIxor": "file:components/GUIxor.json",
   "WireCrossPoint": "class:net.mograsim.logic.model.model.wires.WireCrossPoint"