From: Daniel Kirschten Date: Sat, 11 Apr 2020 12:36:36 +0000 (+0200) Subject: Implemented a 4-bit sel4 X-Git-Url: https://mograsim.net/gitweb/?p=Mograsim.git;a=commitdiff_plain;h=7a03e04de8a8ee23c12e10ec43e46fb7c77f88f7 Implemented a 4-bit sel4 --- diff --git a/plugins/net.mograsim.logic.model.am2900/components/net/mograsim/logic/model/am2900/components/sel4_4.json b/plugins/net.mograsim.logic.model.am2900/components/net/mograsim/logic/model/am2900/components/sel4_4.json new file mode 100644 index 00000000..9aebc16f --- /dev/null +++ b/plugins/net.mograsim.logic.model.am2900/components/net/mograsim/logic/model/am2900/components/sel4_4.json @@ -0,0 +1,1172 @@ +{ + "width": 50.0, + "height": 55.0, + "interfacePins": [ + { + "location": { + "x": 10.0, + "y": 0.0 + }, + "name": "I1", + "logicWidth": 4, + "usage": "INPUT" + }, + { + "location": { + "x": 20.0, + "y": 0.0 + }, + "name": "I2", + "logicWidth": 4, + "usage": "INPUT" + }, + { + "location": { + "x": 30.0, + "y": 0.0 + }, + "name": "I3", + "logicWidth": 4, + "usage": "INPUT" + }, + { + "location": { + "x": 40.0, + "y": 0.0 + }, + "name": "I4", + "logicWidth": 4, + "usage": "INPUT" + }, + { + "location": { + "x": 0.0, + "y": 10.0 + }, + "name": "S1", + "logicWidth": 1, + "usage": "INPUT" + }, + { + "location": { + "x": 0.0, + "y": 20.0 + }, + "name": "S2", + "logicWidth": 1, + "usage": "INPUT" + }, + { + "location": { + "x": 0.0, + "y": 30.0 + }, + "name": "S3", + "logicWidth": 1, + "usage": "INPUT" + }, + { + "location": { + "x": 0.0, + "y": 40.0 + }, + "name": "S4", + "logicWidth": 1, + "usage": "INPUT" + }, + { + "location": { + "x": 50.0, + "y": 20.0 + }, + "name": "Y", + "logicWidth": 4, + "usage": "OUTPUT" + } + ], + "innerScale": 0.2, + "submodel": { + "components": [ + { + "id": "Splitter", + "name": "Splitter#0", + "pos": { + "x": 20.0, + "y": 15.0 + }, + "params": { + "logicWidth": 4, + "orientation": "DOWN" + } + }, + { + "id": "Splitter", + "name": "Splitter#1", + "pos": { + "x": 60.0, + "y": 15.0 + }, + "params": { + "logicWidth": 4, + "orientation": "DOWN" + } + }, + { + "id": "Splitter", + "name": "Splitter#2", + "pos": { + "x": 140.0, + "y": 15.0 + }, + "params": { + "logicWidth": 4, + "orientation": "DOWN" + } + }, + { + "id": "Splitter", + "name": "Splitter#3", + "pos": { + "x": 180.0, + "y": 15.0 + }, + "params": { + "logicWidth": 4, + "orientation": "DOWN" + } + }, + { + "id": "Splitter", + "name": "Splitter#4", + "pos": { + "x": 235.0, + "y": 85.0 + }, + "params": { + "logicWidth": 4, + "orientation": "LEFT" + } + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#0", + "pos": { + "x": 4.0, + "y": 49.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#1", + "pos": { + "x": 9.0, + "y": 99.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#2", + "pos": { + "x": 14.0, + "y": 149.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#3", + "pos": { + "x": 19.0, + "y": 199.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#4", + "pos": { + "x": 4.0, + "y": 109.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#5", + "pos": { + "x": 4.0, + "y": 169.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#6", + "pos": { + "x": 9.0, + "y": 119.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#7", + "pos": { + "x": 9.0, + "y": 179.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#8", + "pos": { + "x": 14.0, + "y": 129.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#9", + "pos": { + "x": 14.0, + "y": 189.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#10", + "pos": { + "x": 19.0, + "y": 139.0 + }, + "params": 1 + }, + { + "id": "sel4", + "name": "sel4#0", + "pos": { + "x": 95.0, + "y": 40.0 + } + }, + { + "id": "sel4", + "name": "sel4#1", + "pos": { + "x": 95.0, + "y": 100.0 + } + }, + { + "id": "sel4", + "name": "sel4#2", + "pos": { + "x": 95.0, + "y": 160.0 + } + }, + { + "id": "sel4", + "name": "sel4#3", + "pos": { + "x": 95.0, + "y": 220.0 + } + } + ], + "wires": [ + { + "pin1": { + "compName": "Splitter#0", + "pinName": "O3" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "I1" + }, + "name": "unnamedWire#0", + "path": [ + { + "x": 20.0, + "y": 35.0 + }, + { + "x": 105.0, + "y": 35.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#1", + "pinName": "O3" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "I2" + }, + "name": "unnamedWire#1", + "path": [ + { + "x": 60.0, + "y": 30.0 + }, + { + "x": 115.0, + "y": 30.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#2", + "pinName": "O3" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "I3" + }, + "name": "unnamedWire#2", + "path": [ + { + "x": 140.0, + "y": 30.0 + }, + { + "x": 125.0, + "y": 30.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#3", + "pinName": "O3" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "I4" + }, + "name": "unnamedWire#3", + "path": [ + { + "x": 180.0, + "y": 35.0 + }, + { + "x": 135.0, + "y": 35.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#0", + "pinName": "O2" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "I1" + }, + "name": "unnamedWire#4", + "path": [ + { + "x": 30.0, + "y": 95.0 + }, + { + "x": 105.0, + "y": 95.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#1", + "pinName": "O2" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "I2" + }, + "name": "unnamedWire#5", + "path": [ + { + "x": 70.0, + "y": 90.0 + }, + { + "x": 115.0, + "y": 90.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#2", + "pinName": "O2" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "I3" + }, + "name": "unnamedWire#6", + "path": [ + { + "x": 150.0, + "y": 90.0 + }, + { + "x": 125.0, + "y": 90.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#3", + "pinName": "O2" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "I4" + }, + "name": "unnamedWire#7", + "path": [ + { + "x": 190.0, + "y": 95.0 + }, + { + "x": 135.0, + "y": 95.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#0", + "pinName": "O1" + }, + "pin2": { + "compName": "sel4#2", + "pinName": "I1" + }, + "name": "unnamedWire#8", + "path": [ + { + "x": 40.0, + "y": 155.0 + }, + { + "x": 105.0, + "y": 155.0 + } + ] + }, + { + "pin1": { + "compName": "sel4#2", + "pinName": "I2" + }, + "pin2": { + "compName": "Splitter#1", + "pinName": "O1" + }, + "name": "unnamedWire#9", + "path": [ + { + "x": 115.0, + "y": 150.0 + }, + { + "x": 80.0, + "y": 150.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#2", + "pinName": "O1" + }, + "pin2": { + "compName": "sel4#2", + "pinName": "I3" + }, + "name": "unnamedWire#10", + "path": [ + { + "x": 160.0, + "y": 150.0 + }, + { + "x": 125.0, + "y": 150.0 + } + ] + }, + { + "pin1": { + "compName": "sel4#2", + "pinName": "I4" + }, + "pin2": { + "compName": "Splitter#3", + "pinName": "O1" + }, + "name": "unnamedWire#11", + "path": [ + { + "x": 135.0, + "y": 155.0 + }, + { + "x": 200.0, + "y": 155.0 + } + ] + }, + { + "pin1": { + "compName": "sel4#3", + "pinName": "I1" + }, + "pin2": { + "compName": "Splitter#0", + "pinName": "O0" + }, + "name": "unnamedWire#12", + "path": [ + { + "x": 105.0, + "y": 215.0 + }, + { + "x": 50.0, + "y": 215.0 + } + ] + }, + { + "pin1": { + "compName": "sel4#3", + "pinName": "I2" + }, + "pin2": { + "compName": "Splitter#1", + "pinName": "O0" + }, + "name": "unnamedWire#13", + "path": [ + { + "x": 115.0, + "y": 210.0 + }, + { + "x": 90.0, + "y": 210.0 + } + ] + }, + { + "pin1": { + "compName": "sel4#3", + "pinName": "I3" + }, + "pin2": { + "compName": "Splitter#2", + "pinName": "O0" + }, + "name": "unnamedWire#14", + "path": [ + { + "x": 125.0, + "y": 210.0 + }, + { + "x": 170.0, + "y": 210.0 + } + ] + }, + { + "pin1": { + "compName": "sel4#3", + "pinName": "I4" + }, + "pin2": { + "compName": "Splitter#3", + "pinName": "O0" + }, + "name": "unnamedWire#15", + "path": [ + { + "x": 135.0, + "y": 215.0 + }, + { + "x": 210.0, + "y": 215.0 + } + ] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "I1" + }, + "pin2": { + "compName": "Splitter#0", + "pinName": "I" + }, + "name": "unnamedWire#16", + "path": [ + { + "x": 50.0, + "y": 10.0 + }, + { + "x": 35.0, + "y": 10.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#1", + "pinName": "I" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "I2" + }, + "name": "unnamedWire#17", + "path": [ + { + "x": 75.0, + "y": 10.0 + }, + { + "x": 100.0, + "y": 10.0 + } + ] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "I3" + }, + "pin2": { + "compName": "Splitter#2", + "pinName": "I" + }, + "name": "unnamedWire#18", + "path": [ + { + "x": 150.0, + "y": 10.0 + }, + { + "x": 155.0, + "y": 10.0 + } + ] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "I4" + }, + "pin2": { + "compName": "Splitter#3", + "pinName": "I" + }, + "name": "unnamedWire#19", + "path": [ + { + "x": 200.0, + "y": 10.0 + }, + { + "x": 195.0, + "y": 10.0 + } + ] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "S4" + }, + "pin2": { + "compName": "WireCrossPoint#3", + "pinName": "" + }, + "name": "unnamedWire#20", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "S3" + }, + "pin2": { + "compName": "WireCrossPoint#2", + "pinName": "" + }, + "name": "unnamedWire#21", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "S2" + }, + "pin2": { + "compName": "WireCrossPoint#1", + "pinName": "" + }, + "name": "unnamedWire#22", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "S1" + }, + "pin2": { + "compName": "WireCrossPoint#0", + "pinName": "" + }, + "name": "unnamedWire#23", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#0", + "pinName": "" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "S1" + }, + "name": "unnamedWire#24", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#0", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#4", + "pinName": "" + }, + "name": "unnamedWire#25", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#4", + "pinName": "" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "S1" + }, + "name": "unnamedWire#26", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#4", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#5", + "pinName": "" + }, + "name": "unnamedWire#27", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#5", + "pinName": "" + }, + "pin2": { + "compName": "sel4#2", + "pinName": "S1" + }, + "name": "unnamedWire#28", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#5", + "pinName": "" + }, + "pin2": { + "compName": "sel4#3", + "pinName": "S1" + }, + "name": "unnamedWire#29", + "path": [ + { + "x": 5.0, + "y": 230.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#1", + "pinName": "" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "S2" + }, + "name": "unnamedWire#30", + "path": [ + { + "x": 10.0, + "y": 60.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#1", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#6", + "pinName": "" + }, + "name": "unnamedWire#31", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#6", + "pinName": "" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "S2" + }, + "name": "unnamedWire#32", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#6", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#7", + "pinName": "" + }, + "name": "unnamedWire#33", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#7", + "pinName": "" + }, + "pin2": { + "compName": "sel4#2", + "pinName": "S2" + }, + "name": "unnamedWire#34", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#7", + "pinName": "" + }, + "pin2": { + "compName": "sel4#3", + "pinName": "S2" + }, + "name": "unnamedWire#35", + "path": [ + { + "x": 10.0, + "y": 240.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#2", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#8", + "pinName": "" + }, + "name": "unnamedWire#36", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#8", + "pinName": "" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "S3" + }, + "name": "unnamedWire#37", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#8", + "pinName": "" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "S3" + }, + "name": "unnamedWire#38", + "path": [ + { + "x": 15.0, + "y": 70.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#2", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#9", + "pinName": "" + }, + "name": "unnamedWire#39", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#9", + "pinName": "" + }, + "pin2": { + "compName": "sel4#2", + "pinName": "S3" + }, + "name": "unnamedWire#40", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#9", + "pinName": "" + }, + "pin2": { + "compName": "sel4#3", + "pinName": "S3" + }, + "name": "unnamedWire#41", + "path": [ + { + "x": 15.0, + "y": 250.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#3", + "pinName": "" + }, + "pin2": { + "compName": "sel4#3", + "pinName": "S4" + }, + "name": "unnamedWire#42", + "path": [ + { + "x": 20.0, + "y": 260.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#3", + "pinName": "" + }, + "pin2": { + "compName": "sel4#2", + "pinName": "S4" + }, + "name": "unnamedWire#43", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#3", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#10", + "pinName": "" + }, + "name": "unnamedWire#44", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#10", + "pinName": "" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "S4" + }, + "name": "unnamedWire#45", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#10", + "pinName": "" + }, + "pin2": { + "compName": "sel4#0", + "pinName": "S4" + }, + "name": "unnamedWire#46", + "path": [ + { + "x": 20.0, + "y": 80.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#4", + "pinName": "I" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "Y" + }, + "name": "unnamedWire#47", + "path": [] + }, + { + "pin1": { + "compName": "sel4#0", + "pinName": "Y" + }, + "pin2": { + "compName": "Splitter#4", + "pinName": "O3" + }, + "name": "unnamedWire#48", + "path": [ + { + "x": 220.0, + "y": 60.0 + }, + { + "x": 220.0, + "y": 85.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#4", + "pinName": "O2" + }, + "pin2": { + "compName": "sel4#1", + "pinName": "Y" + }, + "name": "unnamedWire#49", + "path": [ + { + "x": 220.0, + "y": 95.0 + }, + { + "x": 220.0, + "y": 120.0 + } + ] + }, + { + "pin1": { + "compName": "sel4#2", + "pinName": "Y" + }, + "pin2": { + "compName": "Splitter#4", + "pinName": "O1" + }, + "name": "unnamedWire#50", + "path": [ + { + "x": 225.0, + "y": 180.0 + }, + { + "x": 225.0, + "y": 105.0 + } + ] + }, + { + "pin1": { + "compName": "Splitter#4", + "pinName": "O0" + }, + "pin2": { + "compName": "sel4#3", + "pinName": "Y" + }, + "name": "unnamedWire#51", + "path": [ + { + "x": 230.0, + "y": 115.0 + }, + { + "x": 230.0, + "y": 240.0 + } + ] + } + ], + "version": "0.1.1" + }, + "symbolRendererSnippetID": "simpleRectangularLike", + "symbolRendererParams": { + "centerText": "sel4_4", + "centerTextHeight": 5.0, + "horizontalComponentCenter": 25.0, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 + }, + "outlineRendererSnippetID": "default", + "highLevelStateHandlerSnippetID": "default", + "version": "0.1.5" +} \ No newline at end of file diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/standardComponentIDMapping.json b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/standardComponentIDMapping.json index dd6abffd..4445fe24 100644 --- a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/standardComponentIDMapping.json +++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/standardComponentIDMapping.json @@ -67,6 +67,7 @@ "sel2_4": "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/sel2_4.json", "sel3_4": "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/sel3_4.json", "sel4": "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/sel4.json", + "sel4_4": "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/sel4_4.json", "xnor": "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/xnor.json", "xor": "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/xor.json" } \ No newline at end of file diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java index 6b75e8d9..6a1a9b74 100644 --- a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java +++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/ModelComponentTestbench.java @@ -27,7 +27,7 @@ public class ModelComponentTestbench { Am2900Loader.setup(); // ModelComponent comp = new StrictAm2900MachineDefinition().createNew(model).getAm2900(); - ModelComponent comp = IndirectModelComponentCreator.createComponent(model, "sel4"); + ModelComponent comp = IndirectModelComponentCreator.createComponent(model, "sel4_4"); List inputPinNames = new ArrayList<>(); List outputPinNames = new ArrayList<>();