Made Am2910 components usable in Editor
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 10 Aug 2019 18:04:31 +0000 (20:04 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 10 Aug 2019 18:04:31 +0000 (20:04 +0200)
12 files changed:
net.mograsim.logic.model.am2900/components/am2910/GUIAm2910.json [new file with mode: 0644]
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIdff12.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIinc12.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUImux4_12.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUInor12.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/GUIram5_12.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2910/GUIAm2910InstrPLA.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2910/GUIAm2910RegCntr.java
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2910/GUIAm2910SP.java
net.mograsim.logic.model.editor/META-INF/MANIFEST.MF
net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectGUIComponentCreator.java
net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/standardComponentIDMapping.json

diff --git a/net.mograsim.logic.model.am2900/components/am2910/GUIAm2910.json b/net.mograsim.logic.model.am2900/components/am2910/GUIAm2910.json
new file mode 100644 (file)
index 0000000..0c24615
--- /dev/null
@@ -0,0 +1,122 @@
+mograsim version: 0.1.3
+{
+  "width": 35.0,
+  "height": 270.0,
+  "interfacePins": [
+    {
+      "location": {
+        "x": 0.0,
+        "y": 45.0
+      },
+      "name": "_MAP",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 255.0
+      },
+      "name": "_CCEN",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 265.0
+      },
+      "name": "C",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 95.0
+      },
+      "name": "D",
+      "logicWidth": 12
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 55.0
+      },
+      "name": "_CI",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 65.0
+      },
+      "name": "_FULL",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 35.0,
+        "y": 85.0
+      },
+      "name": "_RLD",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 75.0
+      },
+      "name": "I",
+      "logicWidth": 4
+    },
+    {
+      "location": {
+        "x": 35.0,
+        "y": 115.0
+      },
+      "name": "Y",
+      "logicWidth": 12
+    },
+    {
+      "location": {
+        "x": 35.0,
+        "y": 65.0
+      },
+      "name": "_PL",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 105.0
+      },
+      "name": "_VECT",
+      "logicWidth": 1
+    },
+    {
+      "location": {
+        "x": 0.0,
+        "y": 85.0
+      },
+      "name": "_CC",
+      "logicWidth": 1
+    }
+  ],
+  "submodel": {
+    "innerScale": 0.2,
+    "subComps": [],
+    "innerWires": []
+  },
+  "symbolRendererSnippetID": "class:net.mograsim.logic.model.snippets.symbolrenderers.SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererParams": {
+    "centerText": "GUIAm2901",
+    "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
+    "pinLabelHeight": 3.5,
+    "pinLabelMargin": 0.5
+  },
+  "outlineRendererSnippetID": "class:net.mograsim.logic.model.snippets.outlinerenderers.DefaultOutlineRenderer",
+  "highLevelStateHandlerSnippetID": "class:net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.StandardHighLevelStateHandler",
+  "highLevelStateHandlerParams": {
+    "subcomponentHighLevelStates": {},
+    "atomicHighLevelStates": {}
+  }
+}
\ No newline at end of file
index 9cf4d97..5dd2f96 100644 (file)
@@ -13,6 +13,7 @@ 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 GUIdff12 extends SimpleRectangularHardcodedGUIComponent
@@ -46,4 +47,9 @@ public class GUIdff12 extends SimpleRectangularHardcodedGUIComponent
 
                return QC;
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIdff12.class.getCanonicalName(), (m, p, n) -> new GUIdff12(m, n));
+       }
 }
\ No newline at end of file
index 2092544..0b94583 100644 (file)
@@ -15,6 +15,7 @@ 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 GUIinc12 extends SimpleRectangularHardcodedGUIComponent
@@ -69,4 +70,8 @@ public class GUIinc12 extends SimpleRectangularHardcodedGUIComponent
                return null;
        }
 
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIinc12.class.getCanonicalName(), (m, p, n) -> new GUIinc12(m, n));
+       }
 }
\ No newline at end of file
index af227da..e43888a 100644 (file)
@@ -1,16 +1,21 @@
 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 static 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 GUImux4_12 extends SimpleRectangularHardcodedGUIComponent
@@ -71,4 +76,9 @@ public class GUImux4_12 extends SimpleRectangularHardcodedGUIComponent
                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
index 22800a3..6149994 100644 (file)
@@ -14,6 +14,7 @@ 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 GUInor12 extends SimpleRectangularHardcodedGUIComponent
@@ -49,4 +50,9 @@ public class GUInor12 extends SimpleRectangularHardcodedGUIComponent
                                return X;
                return ONE;
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUInor12.class.getCanonicalName(), (m, p, n) -> new GUInor12(m, n));
+       }
 }
\ No newline at end of file
index 7dcea02..1bf80c8 100644 (file)
@@ -1,6 +1,10 @@
 package net.mograsim.logic.model.am2900.components;
 
-import static net.mograsim.logic.core.types.Bit.*;
+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.Arrays;
 import java.util.Map;
@@ -12,6 +16,7 @@ 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 GUIram5_12 extends SimpleRectangularHardcodedGUIComponent
@@ -76,4 +81,9 @@ public class GUIram5_12 extends SimpleRectangularHardcodedGUIComponent
                // TODO maybe this is the wrong way around
                return (bits[0] == ONE ? 4 : 0) + (bits[1] == ONE ? 2 : 0) + (bits[2] == ONE ? 1 : 0);
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIram5_12.class.getCanonicalName(), (m, p, n) -> new GUIram5_12(m, n));
+       }
 }
\ No newline at end of file
index b112d03..ebd69f6 100644 (file)
@@ -13,6 +13,7 @@ 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 GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
@@ -260,4 +261,10 @@ public class GUIAm2910InstrPLA extends SimpleRectangularHardcodedGUIComponent
                }
                return null;
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIAm2910InstrPLA.class.getCanonicalName(),
+                               (m, p, n) -> new GUIAm2910InstrPLA(m, n));
+       }
 }
\ No newline at end of file
index 3db7b9d..3c1ca2e 100644 (file)
@@ -13,6 +13,7 @@ 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 GUIAm2910RegCntr extends SimpleRectangularHardcodedGUIComponent
@@ -83,4 +84,10 @@ public class GUIAm2910RegCntr extends SimpleRectangularHardcodedGUIComponent
 
                return QC;
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIAm2910RegCntr.class.getCanonicalName(),
+                               (m, p, n) -> new GUIAm2910RegCntr(m, n));
+       }
 }
\ No newline at end of file
index b19e3bb..c4b44f3 100644 (file)
@@ -1,7 +1,11 @@
 package net.mograsim.logic.model.am2900.components.am2910;
 
+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 static net.mograsim.logic.core.types.Bit.*;
 
 import net.mograsim.logic.core.types.Bit;
 import net.mograsim.logic.core.types.BitVector;
@@ -10,6 +14,7 @@ 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 GUIAm2910SP extends SimpleRectangularHardcodedGUIComponent
@@ -84,4 +89,9 @@ public class GUIAm2910SP extends SimpleRectangularHardcodedGUIComponent
                // TODO maybe this is the wrong way around
                return BitVector.of((i & 0b100) > 0 ? ONE : ZERO, (i & 0b10) > 0 ? ONE : ZERO, (i & 0b1) > 0 ? ONE : ZERO);
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIAm2910SP.class.getCanonicalName(), (m, p, n) -> new GUIAm2910SP(m, n));
+       }
 }
\ No newline at end of file
index 728aa67..d522281 100644 (file)
@@ -8,7 +8,8 @@ Export-Package: net.mograsim.logic.model.editor,
  net.mograsim.logic.model.editor.states,
  net.mograsim.logic.model.editor.ui
 Require-Bundle: net.mograsim.logic.model;bundle-version="0.1.0",
- net.mograsim.preferences;bundle-version="0.1.0"
+ net.mograsim.preferences;bundle-version="0.1.0",
+ net.mograsim.logic.model.am2900;bundle-version="0.1.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-11
 Automatic-Module-Name: net.mograsim.logic.model.editor
 Bundle-Vendor: Mograsim Team
index 884e3ba..090ca86 100644 (file)
@@ -99,6 +99,7 @@ public class IndirectGUIComponentCreator
                                        ComponentSupplier componentSupplier = componentSuppliers.get(className);
                                        if (componentSupplier != null)
                                                return componentSupplier.create(model, params, name);
+                                       throw new IllegalArgumentException("Component supplier not found for ID " + id + " (resolved: " + resolvedID + ")");
                                } else
                                // we know id has to start with "file:" here
                                // because standardComponentIDs only contains strings starting with "class:" or "file:"
index d599c2f..4b036cc 100644 (file)
@@ -34,5 +34,13 @@ mograsim version: 0.1.3
   "GUIsel2_4": "file:components/GUIsel2_4.json",
   "GUIsel3_4": "file:components/GUIsel3_4.json",
   "GUIxor": "file:components/GUIxor.json",
+  "GUIAm2910InstrPLA": "class:net.mograsim.logic.model.am2900.components.am2910.GUIAm2910InstrPLA",
+  "GUIAm2910RegCntr": "class:net.mograsim.logic.model.am2900.components.am2910.GUIAm2910RegCntr",
+  "GUIAm2910SP": "class:net.mograsim.logic.model.am2900.components.am2910.GUIAm2910SP",
+  "GUIdff12": "class:net.mograsim.logic.model.am2900.components.GUIdff12",
+  "GUIinc12": "class:net.mograsim.logic.model.am2900.components.GUIinc12",
+  "GUImux4_12": "class:net.mograsim.logic.model.am2900.components.GUImux4_12",
+  "GUInor12": "class:net.mograsim.logic.model.am2900.components.GUInor12",
+  "GUIram5_12": "class:net.mograsim.logic.model.am2900.components.GUIram5_12",
   "WireCrossPoint": "class:net.mograsim.logic.model.model.wires.WireCrossPoint"
 }
\ No newline at end of file