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);
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();
+++ /dev/null
-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
--- /dev/null
+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
--- /dev/null
+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
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
{
@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
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;
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;
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;
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
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;
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;
}
}
+ @Override
+ public JsonElement getParamsForSerializing(IdentifierGetter idGetter)
+ {
+ return new JsonPrimitive(logicWidth);
+ }
+
public void setLogicModelBinding(ReadEnd inputEnd, ReadEnd[] outputEnds)
{
this.inputEnd = inputEnd;
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
"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",
"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"