--- /dev/null
+{
+ "width": 45.0,
+ "height": 30.0,
+ "interfacePins": [
+ {
+ "location": {
+ "x": 0.0,
+ "y": 15.0
+ },
+ "name": "D",
+ "logicWidth": 12,
+ "usage": "INPUT"
+ },
+ {
+ "location": {
+ "x": 45.0,
+ "y": 15.0
+ },
+ "name": "Y",
+ "logicWidth": 1,
+ "usage": "OUTPUT"
+ }
+ ],
+ "innerScale": 0.2,
+ "submodel": {
+ "components": [
+ {
+ "id": "NandGate",
+ "name": "NandGate#0",
+ "pos": {
+ "x": 135.0,
+ "y": 65.0
+ },
+ "params": 1
+ },
+ {
+ "id": "NandGate",
+ "name": "NandGate#1",
+ "pos": {
+ "x": 70.0,
+ "y": 55.0
+ },
+ "params": 1
+ },
+ {
+ "id": "NandGate",
+ "name": "NandGate#2",
+ "pos": {
+ "x": 70.0,
+ "y": 90.0
+ },
+ "params": 1
+ },
+ {
+ "id": "NandGate",
+ "name": "NandGate#3",
+ "pos": {
+ "x": 100.0,
+ "y": 65.0
+ },
+ "params": 1
+ },
+ {
+ "id": "NandGate",
+ "name": "NandGate#4",
+ "pos": {
+ "x": 135.0,
+ "y": 10.0
+ },
+ "params": 1
+ },
+ {
+ "id": "NandGate",
+ "name": "NandGate#5",
+ "pos": {
+ "x": 165.0,
+ "y": 65.0
+ },
+ "params": 1
+ },
+ {
+ "id": "NandGate",
+ "name": "NandGate#6",
+ "pos": {
+ "x": 200.0,
+ "y": 65.0
+ },
+ "params": 1
+ },
+ {
+ "id": "Splitter",
+ "name": "Splitter#0",
+ "pos": {
+ "x": 5.0,
+ "y": 20.0
+ },
+ "params": {
+ "logicWidth": 12,
+ "orientation": "RIGHT"
+ }
+ },
+ {
+ "id": "WireCrossPoint",
+ "name": "WireCrossPoint#0",
+ "pos": {
+ "x": 129.0,
+ "y": 74.0
+ },
+ "params": 1
+ },
+ {
+ "id": "WireCrossPoint",
+ "name": "WireCrossPoint#1",
+ "pos": {
+ "x": 64.0,
+ "y": 59.0
+ },
+ "params": 1
+ },
+ {
+ "id": "WireCrossPoint",
+ "name": "WireCrossPoint#2",
+ "pos": {
+ "x": 64.0,
+ "y": 104.0
+ },
+ "params": 1
+ },
+ {
+ "id": "WireCrossPoint",
+ "name": "WireCrossPoint#3",
+ "pos": {
+ "x": 129.0,
+ "y": 14.0
+ },
+ "params": 1
+ },
+ {
+ "id": "WireCrossPoint",
+ "name": "WireCrossPoint#4",
+ "pos": {
+ "x": 194.0,
+ "y": 74.0
+ },
+ "params": 1
+ },
+ {
+ "id": "or4",
+ "name": "or4#0",
+ "pos": {
+ "x": 25.0,
+ "y": 10.0
+ }
+ },
+ {
+ "id": "or4",
+ "name": "or4#1",
+ "pos": {
+ "x": 25.0,
+ "y": 55.0
+ }
+ },
+ {
+ "id": "or4",
+ "name": "or4#2",
+ "pos": {
+ "x": 25.0,
+ "y": 100.0
+ }
+ }
+ ],
+ "wires": [
+ {
+ "pin1": {
+ "compName": "_submodelinterface",
+ "pinName": "D"
+ },
+ "pin2": {
+ "compName": "Splitter#0",
+ "pinName": "I"
+ },
+ "name": "unnamedWire#0",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O11"
+ },
+ "pin2": {
+ "compName": "or4#0",
+ "pinName": "A1"
+ },
+ "name": "unnamedWire#1",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 20.0
+ },
+ {
+ "x": 20.0,
+ "y": 15.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "or4#0",
+ "pinName": "A2"
+ },
+ "pin2": {
+ "compName": "Splitter#0",
+ "pinName": "O10"
+ },
+ "name": "unnamedWire#2",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 25.0
+ },
+ {
+ "x": 20.0,
+ "y": 30.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "or4#0",
+ "pinName": "A3"
+ },
+ "pin2": {
+ "compName": "Splitter#0",
+ "pinName": "O9"
+ },
+ "name": "unnamedWire#3",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 35.0
+ },
+ {
+ "x": 20.0,
+ "y": 40.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O8"
+ },
+ "pin2": {
+ "compName": "or4#0",
+ "pinName": "A4"
+ },
+ "name": "unnamedWire#4",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 50.0
+ },
+ {
+ "x": 20.0,
+ "y": 45.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O7"
+ },
+ "pin2": {
+ "compName": "or4#1",
+ "pinName": "A1"
+ },
+ "name": "unnamedWire#5",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "or4#1",
+ "pinName": "A2"
+ },
+ "pin2": {
+ "compName": "Splitter#0",
+ "pinName": "O6"
+ },
+ "name": "unnamedWire#6",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O5"
+ },
+ "pin2": {
+ "compName": "or4#1",
+ "pinName": "A3"
+ },
+ "name": "unnamedWire#7",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "or4#1",
+ "pinName": "A4"
+ },
+ "pin2": {
+ "compName": "Splitter#0",
+ "pinName": "O4"
+ },
+ "name": "unnamedWire#8",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O3"
+ },
+ "pin2": {
+ "compName": "or4#2",
+ "pinName": "A1"
+ },
+ "name": "unnamedWire#9",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 100.0
+ },
+ {
+ "x": 20.0,
+ "y": 105.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O2"
+ },
+ "pin2": {
+ "compName": "or4#2",
+ "pinName": "A2"
+ },
+ "name": "unnamedWire#10",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 110.0
+ },
+ {
+ "x": 20.0,
+ "y": 115.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O1"
+ },
+ "pin2": {
+ "compName": "or4#2",
+ "pinName": "A3"
+ },
+ "name": "unnamedWire#11",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 120.0
+ },
+ {
+ "x": 20.0,
+ "y": 125.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "Splitter#0",
+ "pinName": "O0"
+ },
+ "pin2": {
+ "compName": "or4#2",
+ "pinName": "A4"
+ },
+ "name": "unnamedWire#12",
+ "path": [
+ {
+ "x": 20.0,
+ "y": 130.0
+ },
+ {
+ "x": 20.0,
+ "y": 135.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "NandGate#3",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "WireCrossPoint#0",
+ "pinName": ""
+ },
+ "name": "unnamedWire#13",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#0",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#0",
+ "pinName": "B"
+ },
+ "name": "unnamedWire#14",
+ "path": [
+ {
+ "x": 130.0,
+ "y": 80.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#0",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#0",
+ "pinName": "A"
+ },
+ "name": "unnamedWire#15",
+ "path": [
+ {
+ "x": 130.0,
+ "y": 70.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "or4#1",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "WireCrossPoint#1",
+ "pinName": ""
+ },
+ "name": "unnamedWire#16",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#1",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#1",
+ "pinName": "A"
+ },
+ "name": "unnamedWire#17",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#1",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#1",
+ "pinName": "B"
+ },
+ "name": "unnamedWire#18",
+ "path": [
+ {
+ "x": 65.0,
+ "y": 70.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "or4#2",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "WireCrossPoint#2",
+ "pinName": ""
+ },
+ "name": "unnamedWire#19",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#2",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#2",
+ "pinName": "A"
+ },
+ "name": "unnamedWire#20",
+ "path": [
+ {
+ "x": 65.0,
+ "y": 95.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#2",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#2",
+ "pinName": "B"
+ },
+ "name": "unnamedWire#21",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "NandGate#1",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "NandGate#3",
+ "pinName": "A"
+ },
+ "name": "unnamedWire#22",
+ "path": [
+ {
+ "x": 95.0,
+ "y": 65.0
+ },
+ {
+ "x": 95.0,
+ "y": 70.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "NandGate#2",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "NandGate#3",
+ "pinName": "B"
+ },
+ "name": "unnamedWire#23",
+ "path": [
+ {
+ "x": 95.0,
+ "y": 100.0
+ },
+ {
+ "x": 95.0,
+ "y": 80.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "NandGate#0",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "NandGate#5",
+ "pinName": "B"
+ },
+ "name": "unnamedWire#24",
+ "path": [
+ {
+ "x": 160.0,
+ "y": 75.0
+ },
+ {
+ "x": 160.0,
+ "y": 80.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "or4#0",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "WireCrossPoint#3",
+ "pinName": ""
+ },
+ "name": "unnamedWire#25",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#3",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#4",
+ "pinName": "A"
+ },
+ "name": "unnamedWire#26",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#3",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#4",
+ "pinName": "B"
+ },
+ "name": "unnamedWire#27",
+ "path": [
+ {
+ "x": 130.0,
+ "y": 25.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "NandGate#4",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "NandGate#5",
+ "pinName": "A"
+ },
+ "name": "unnamedWire#28",
+ "path": [
+ {
+ "x": 160.0,
+ "y": 20.0
+ },
+ {
+ "x": 160.0,
+ "y": 70.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "NandGate#5",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "WireCrossPoint#4",
+ "pinName": ""
+ },
+ "name": "unnamedWire#29",
+ "path": []
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#4",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#6",
+ "pinName": "A"
+ },
+ "name": "unnamedWire#30",
+ "path": [
+ {
+ "x": 195.0,
+ "y": 70.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "WireCrossPoint#4",
+ "pinName": ""
+ },
+ "pin2": {
+ "compName": "NandGate#6",
+ "pinName": "B"
+ },
+ "name": "unnamedWire#31",
+ "path": [
+ {
+ "x": 195.0,
+ "y": 80.0
+ }
+ ]
+ },
+ {
+ "pin1": {
+ "compName": "NandGate#6",
+ "pinName": "Y"
+ },
+ "pin2": {
+ "compName": "_submodelinterface",
+ "pinName": "Y"
+ },
+ "name": "unnamedWire#32",
+ "path": []
+ }
+ ],
+ "version": "0.1.1"
+ },
+ "symbolRendererSnippetID": "simpleRectangularLike",
+ "symbolRendererParams": {
+ "centerText": "nor12",
+ "centerTextHeight": 5.0,
+ "horizontalComponentCenter": 15.0,
+ "pinLabelHeight": 3.5,
+ "pinLabelMargin": 0.5
+ },
+ "outlineRendererSnippetID": "default",
+ "highLevelStateHandlerSnippetID": "default",
+ "version": "0.1.5"
+}
\ 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.wires.CoreWire.ReadEnd;
-import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
-import net.mograsim.logic.model.model.LogicModelModifiable;
-import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedModelComponent;
-import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
-import net.mograsim.logic.model.snippets.symbolrenderers.PinNamesSymbolRenderer.PinNamesParams.Position;
-
-public class Modelnor12 extends SimpleRectangularHardcodedModelComponent
-{
- public Modelnor12(LogicModelModifiable model, String name)
- {
- super(model, "nor12", name, "=0", false);
- setSize(35, 20);
- addPin(new Pin(model, this, "D", 12, PinUsage.INPUT, 0, 10), Position.RIGHT);
- addPin(new Pin(model, this, "Y", 1, PinUsage.OUTPUT, 35, 10), Position.LEFT);
-
- init();
- }
-
- @Override
- public Object recalculate(Object lastState, Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds)
- {
- readWriteEnds.get("Y").feedSignals(getResult(readEnds.get("D").getValues().getBits()));
- return null;
- }
-
- private static Bit getResult(Bit[] DValArr)
- {
- for (int i = 0; i < 12; i++)
- if (DValArr[i] == X)
- return X;
- for (int i = 0; i < 12; i++)
- if (DValArr[i] == U)
- return U;
- for (int i = 0; i < 12; i++)
- if (DValArr[i] == ONE)
- return ZERO;
- for (int i = 0; i < 12; i++)
- if (DValArr[i] == Z)
- return X;
- return ONE;
- }
-
- static
- {
- IndirectModelComponentCreator.setComponentSupplier(Modelnor12.class.getCanonicalName(), (m, p, n) -> new Modelnor12(m, n));
- }
-}
\ No newline at end of file