From d281af0202743ee4bca62597ec38e981e9711031 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Tue, 27 Aug 2019 21:57:05 +0200 Subject: [PATCH] Implemented C0 logic (but didn't test it yet) --- .../components/am2904/GUIAm2904.json | 298 +++++++++++++++++- .../am2904/GUIAm2904RegCTInstrDecode.java | 33 +- 2 files changed, 314 insertions(+), 17 deletions(-) diff --git a/net.mograsim.logic.model.am2900/components/am2904/GUIAm2904.json b/net.mograsim.logic.model.am2900/components/am2904/GUIAm2904.json index 33bdddab..a1959d98 100644 --- a/net.mograsim.logic.model.am2900/components/am2904/GUIAm2904.json +++ b/net.mograsim.logic.model.am2900/components/am2904/GUIAm2904.json @@ -1,7 +1,7 @@ mograsim version: 0.1.3 { "width": 120.0, - "height": 94.0, + "height": 139.0, "interfacePins": [ { "location": { @@ -69,8 +69,8 @@ mograsim version: 0.1.3 }, { "location": { - "x": -24.6, - "y": 24.400000000000002 + "x": 120.0, + "y": 108.0 }, "name": "C0", "logicWidth": 1 @@ -93,8 +93,8 @@ mograsim version: 0.1.3 }, { "location": { - "x": -14.600000000000001, - "y": 14.4 + "x": 0.0, + "y": 110.0 }, "name": "Cx", "logicWidth": 1 @@ -267,6 +267,15 @@ mograsim version: 0.1.3 }, "params": 4 }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#17", + "pos": { + "x": 360.0, + "y": 495.0 + }, + "params": 1 + }, { "id": "class:net.mograsim.logic.model.model.wires.WireCrossPoint", "name": "WireCrossPoint#1", @@ -444,6 +453,15 @@ mograsim version: 0.1.3 "y": 40.0 } }, + { + "id": "class:net.mograsim.logic.model.model.components.atomic.GUIMerger", + "name": "GUIMerger#4", + "pos": { + "x": 25.0, + "y": 355.0 + }, + "params": 2 + }, { "id": "class:net.mograsim.logic.model.model.components.atomic.GUIMerger", "name": "GUIMerger#3", @@ -512,6 +530,38 @@ mograsim version: 0.1.3 "y": 295.0 } }, + { + "id": "GUImux1", + "name": "DeserializedSubmodelComponent#14", + "pos": { + "x": 415.0, + "y": 465.0 + } + }, + { + "id": "GUImux1", + "name": "DeserializedSubmodelComponent#13", + "pos": { + "x": 365.0, + "y": 485.0 + } + }, + { + "id": "GUIxor", + "name": "DeserializedSubmodelComponent#12", + "pos": { + "x": 315.0, + "y": 505.0 + } + }, + { + "id": "GUImux1", + "name": "DeserializedSubmodelComponent#11", + "pos": { + "x": 265.0, + "y": 515.0 + } + }, { "id": "GUIxor", "name": "DeserializedSubmodelComponent#10", @@ -619,6 +669,15 @@ mograsim version: 0.1.3 }, "params": 1 }, + { + "id": "class:net.mograsim.logic.model.model.components.atomic.GUISplitter", + "name": "GUISplitter#9", + "pos": { + "x": 240.0, + "y": 475.0 + }, + "params": 4 + }, { "id": "class:net.mograsim.logic.model.model.components.atomic.GUISplitter", "name": "GUISplitter#4", @@ -705,9 +764,18 @@ mograsim version: 0.1.3 "name": "GUIAm2904RegCTInstrDecode#0", "pos": { "x": 50.0, - "y": 230.0 + "y": 240.0 } }, + { + "id": "class:net.mograsim.logic.model.model.components.atomic.GUISplitter", + "name": "GUISplitter#10", + "pos": { + "x": 445.0, + "y": 410.0 + }, + "params": 4 + }, { "id": "class:net.mograsim.logic.model.am2900.components.am2904.GUIAm2904ShiftInstrDecode", "name": "GUIAm2904ShiftInstrDecode#0", @@ -1274,7 +1342,7 @@ mograsim version: 0.1.3 }, "pin2": { "compName": "GUIAm2904RegCTInstrDecode#0", - "pinName": "I" + "pinName": "I5-0" }, "name": "unnamedWire#15", "path": [] @@ -1534,6 +1602,78 @@ mograsim version: 0.1.3 "name": "unnamedWire#79", "path": [] }, + { + "pin1": { + "compName": "WireCrossPoint#17", + "pinName": "" + }, + "pin2": { + "compName": "DeserializedSubmodelComponent#13", + "pinName": "S0" + }, + "name": "unnamedWire#150", + "path": [] + }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#12", + "pinName": "Y" + }, + "pin2": { + "compName": "DeserializedSubmodelComponent#13", + "pinName": "I1" + }, + "name": "unnamedWire#151", + "path": [] + }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#14", + "pinName": "I0" + }, + "pin2": { + "compName": "WireCrossPoint#17", + "pinName": "" + }, + "name": "unnamedWire#154", + "path": [] + }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#14", + "pinName": "S0" + }, + "pin2": { + "compName": "GUISplitter#9", + "pinName": "O3" + }, + "name": "unnamedWire#155", + "path": [] + }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#13", + "pinName": "I0" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "Cx" + }, + "name": "unnamedWire#152", + "path": [] + }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#13", + "pinName": "Y" + }, + "pin2": { + "compName": "DeserializedSubmodelComponent#14", + "pinName": "I1" + }, + "name": "unnamedWire#153", + "path": [] + }, { "pin1": { "compName": "GUINandGate#10", @@ -1546,6 +1686,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#81", "path": [] }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#14", + "pinName": "Y" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "C0" + }, + "name": "unnamedWire#156", + "path": [] + }, { "pin1": { "compName": "WireCrossPoint#13", @@ -1654,6 +1806,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#88", "path": [] }, + { + "pin1": { + "compName": "GUIMerger#4", + "pinName": "I1" + }, + "pin2": { + "compName": "GUISplitter#0", + "pinName": "O12" + }, + "name": "unnamedWire#140", + "path": [] + }, { "pin1": { "compName": "GUIMerger#0", @@ -1666,6 +1830,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#9", "path": [] }, + { + "pin1": { + "compName": "GUISplitter#8", + "pinName": "O1" + }, + "pin2": { + "compName": "DeserializedSubmodelComponent#11", + "pinName": "I1" + }, + "name": "unnamedWire#143", + "path": [] + }, { "pin1": { "compName": "GUISplitter#0", @@ -1678,6 +1854,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#8", "path": [] }, + { + "pin1": { + "compName": "GUISplitter#10", + "pinName": "I" + }, + "pin2": { + "compName": "WireCrossPoint#3", + "pinName": "" + }, + "name": "unnamedWire#144", + "path": [] + }, { "pin1": { "compName": "GUIMerger#0", @@ -1690,6 +1878,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#7", "path": [] }, + { + "pin1": { + "compName": "GUIMerger#4", + "pinName": "O" + }, + "pin2": { + "compName": "GUIAm2904RegCTInstrDecode#0", + "pinName": "I12-11" + }, + "name": "unnamedWire#141", + "path": [] + }, { "pin1": { "compName": "GUISplitter#0", @@ -1702,6 +1902,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#6", "path": [] }, + { + "pin1": { + "compName": "GUIAm2904RegCTInstrDecode#0", + "pinName": "C0_MUX" + }, + "pin2": { + "compName": "GUISplitter#9", + "pinName": "I" + }, + "name": "unnamedWire#142", + "path": [] + }, { "pin1": { "compName": "GUIMerger#3", @@ -1714,6 +1926,30 @@ mograsim version: 0.1.3 "name": "unnamedWire#90", "path": [] }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#11", + "pinName": "Y" + }, + "pin2": { + "compName": "DeserializedSubmodelComponent#12", + "pinName": "B" + }, + "name": "unnamedWire#147", + "path": [] + }, + { + "pin1": { + "compName": "DeserializedSubmodelComponent#12", + "pinName": "A" + }, + "pin2": { + "compName": "GUISplitter#9", + "pinName": "O0" + }, + "name": "unnamedWire#148", + "path": [] + }, { "pin1": { "compName": "GUIMerger#3", @@ -1726,6 +1962,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#92", "path": [] }, + { + "pin1": { + "compName": "GUISplitter#10", + "pinName": "O1" + }, + "pin2": { + "compName": "DeserializedSubmodelComponent#11", + "pinName": "I0" + }, + "name": "unnamedWire#145", + "path": [] + }, { "pin1": { "compName": "DeserializedSubmodelComponent#3", @@ -1738,6 +1986,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#91", "path": [] }, + { + "pin1": { + "compName": "GUISplitter#9", + "pinName": "O1" + }, + "pin2": { + "compName": "DeserializedSubmodelComponent#11", + "pinName": "S0" + }, + "name": "unnamedWire#146", + "path": [] + }, { "pin1": { "compName": "GUIAm2904RegCTInstrDecode#0", @@ -1807,6 +2067,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#96", "path": [] }, + { + "pin1": { + "compName": "GUISplitter#9", + "pinName": "O2" + }, + "pin2": { + "compName": "WireCrossPoint#17", + "pinName": "" + }, + "name": "unnamedWire#149", + "path": [] + }, { "pin1": { "compName": "GUISplitter#2", @@ -2131,6 +2403,18 @@ mograsim version: 0.1.3 "name": "unnamedWire#62", "path": [] }, + { + "pin1": { + "compName": "GUISplitter#0", + "pinName": "O11" + }, + "pin2": { + "compName": "GUIMerger#4", + "pinName": "I0" + }, + "name": "unnamedWire#139", + "path": [] + }, { "pin1": { "compName": "WireCrossPoint#12", diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2904/GUIAm2904RegCTInstrDecode.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2904/GUIAm2904RegCTInstrDecode.java index bea1a75f..f0f1818d 100644 --- a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2904/GUIAm2904RegCTInstrDecode.java +++ b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/components/am2904/GUIAm2904RegCTInstrDecode.java @@ -23,7 +23,8 @@ public class GUIAm2904RegCTInstrDecode extends SimpleRectangularHardcodedGUIComp { super(model, name, "Instruction\ndecode"); setSize(80, 80); - addPin(new Pin(this, "I", 6, 0, 40), Usage.INPUT, Position.RIGHT); + addPin(new Pin(this, "I5-0", 6, 0, 30), Usage.INPUT, Position.RIGHT); + addPin(new Pin(this, "I12-11", 2, 0, 50), Usage.INPUT, Position.RIGHT); // muSR MUX: // 00: 0 // 01: 1 @@ -48,7 +49,7 @@ public class GUIAm2904RegCTInstrDecode extends SimpleRectangularHardcodedGUIComp addPin(new Pin(this, "MSR_MUX", 3, 20, 0), Usage.OUTPUT, Position.BOTTOM); // TODO when is this HIGH? addPin(new Pin(this, "OEN", 1, 60, 0), Usage.OUTPUT, Position.BOTTOM); - // CT SRC MUX: + // Y MUX: // 00: mu // 01: mu // 10: M @@ -57,17 +58,27 @@ public class GUIAm2904RegCTInstrDecode extends SimpleRectangularHardcodedGUIComp // CT MUX: // see Am2900 Family Data Book, Am2904, Table 4 (CT_MUX2-0 = I3-1) addPin(new Pin(this, "CT_MUX", 3, 30, 80), Usage.OUTPUT, Position.TOP); - addPin(new Pin(this, "CT_INV", 1, 50, 80), Usage.OUTPUT, Position.TOP); - addPin(new Pin(this, "CT_EXP", 1, 70, 80), Usage.OUTPUT, Position.TOP); + addPin(new Pin(this, "CT_INV", 1, 40, 80), Usage.OUTPUT, Position.TOP); + addPin(new Pin(this, "CT_EXP", 1, 50, 80), Usage.OUTPUT, Position.TOP); + // C0 MUX: + // 00xx: 0 + // 01xx: 1 + // 10xx: CX + // 1100: muC + // 1101: _muC + // 1110: MC + // 1111: _MC + addPin(new Pin(this, "C0_MUX", 4, 70, 80), Usage.OUTPUT, Position.TOP); } @Override protected Object recalculate(Object lastState, Map readEnds, Map readWriteEnds) { - Bit[] IBits = readEnds.get("I").getValues().getBits(); + Bit[] I5_0Bits = readEnds.get("I5-0").getValues().getBits(); + Bit[] I12_11Bits = readEnds.get("I12-11").getValues().getBits(); int IAsInt = 0; for (int i = 0; i < 6; i++) - switch (IBits[5 - i]) + switch (I5_0Bits[5 - i]) { case ONE: IAsInt |= 1 << i; @@ -84,7 +95,7 @@ public class GUIAm2904RegCTInstrDecode extends SimpleRectangularHardcodedGUIComp case ZERO: break; default: - throw new IllegalArgumentException("Unknown enum constant: " + IBits[i]); + throw new IllegalArgumentException("Unknown enum constant: " + I5_0Bits[i]); } switch (IAsInt) { @@ -255,10 +266,12 @@ public class GUIAm2904RegCTInstrDecode extends SimpleRectangularHardcodedGUIComp readWriteEnds.get("MSR_MUX").feedSignals(ZERO, ZERO, ONE); break; } - readWriteEnds.get("Y_MUX").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("Y_MUX").feedSignals(I5_0Bits[0], I5_0Bits[1]); + readWriteEnds.get("CT_INV").feedSignals(I5_0Bits[5]); + readWriteEnds.get("CT_MUX").feedSignals(I5_0Bits[2], I5_0Bits[3], I5_0Bits[4]); readWriteEnds.get("CT_EXP").feedSignals((IAsInt & 0b1110) == 0b1110 ? ONE : ZERO); + readWriteEnds.get("C0_MUX").feedSignals(I12_11Bits[0], I12_11Bits[1], I5_0Bits[0], + I5_0Bits[2].and(I5_0Bits[3].not()).and(I5_0Bits[4].not())); return null; } -- 2.17.1