From: Daniel Kirschten Date: Wed, 25 Sep 2019 16:42:18 +0000 (+0200) Subject: Fixed two small bugs in the two Delegating...Handlers: X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=3274bf1091e8c29cc3bff7f909bdd8b29220848d;p=Mograsim.git Fixed two small bugs in the two Delegating...Handlers: 1. DelegatingSubcomponentHighLevelStateHandler#getParamsForSerializing now throws a meaningful exception when the delegate target was destroyed 2. Both now support serializing delegating to the parent --- diff --git a/plugins/net.mograsim.logic.model.am2900/components/net/mograsim/logic/model/am2900/components/Am2900.json b/plugins/net.mograsim.logic.model.am2900/components/net/mograsim/logic/model/am2900/components/Am2900.json index 8b2c9cf4..74c0beb8 100644 --- a/plugins/net.mograsim.logic.model.am2900/components/net/mograsim/logic/model/am2900/components/Am2900.json +++ b/plugins/net.mograsim.logic.model.am2900/components/net/mograsim/logic/model/am2900/components/Am2900.json @@ -100,7 +100,7 @@ "id": "Clock", "name": "Clock#0", "pos": { - "x": 75.0, + "x": 70.0, "y": 365.0 }, "params": { @@ -216,7 +216,7 @@ "id": "ManualSwitch", "name": "ManualSwitch#0", "pos": { - "x": 75.0, + "x": 70.0, "y": 347.5 }, "params": 1 @@ -225,7 +225,7 @@ "id": "ManualSwitch", "name": "ManualSwitch#1", "pos": { - "x": 75.0, + "x": 70.0, "y": 387.5 }, "params": 1 @@ -279,7 +279,7 @@ "id": "NandGate", "name": "NandGate#5", "pos": { - "x": 60.0, + "x": 105.0, "y": 235.0 }, "params": 1 @@ -288,7 +288,7 @@ "id": "NandGate", "name": "NandGate#6", "pos": { - "x": 150.0, + "x": 145.0, "y": 375.0 }, "params": 1 @@ -297,7 +297,7 @@ "id": "NandGate", "name": "NandGate#7", "pos": { - "x": 65.0, + "x": 110.0, "y": 270.0 }, "params": 1 @@ -1275,7 +1275,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#38", "pos": { - "x": 174.0, + "x": 169.0, "y": 384.0 }, "params": 1 @@ -1284,7 +1284,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#39", "pos": { - "x": 179.0, + "x": 174.0, "y": 364.0 }, "params": 1 @@ -1293,7 +1293,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#40", "pos": { - "x": 144.0, + "x": 139.0, "y": 364.0 }, "params": 1 @@ -1302,7 +1302,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#41", "pos": { - "x": 144.0, + "x": 139.0, "y": 379.0 }, "params": 1 @@ -1312,7 +1312,7 @@ "name": "WireCrossPoint#42", "pos": { "x": 364.0, - "y": 289.0 + "y": 314.0 }, "params": 1 }, @@ -1330,7 +1330,7 @@ "name": "WireCrossPoint#44", "pos": { "x": 174.0, - "y": 289.0 + "y": 254.0 }, "params": 1 }, @@ -1338,7 +1338,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#45", "pos": { - "x": 129.0, + "x": 174.0, "y": 304.0 }, "params": 1 @@ -1347,7 +1347,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#46", "pos": { - "x": 129.0, + "x": 174.0, "y": 279.0 }, "params": 1 @@ -1356,7 +1356,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#47", "pos": { - "x": 59.0, + "x": 104.0, "y": 294.0 }, "params": 1 @@ -1365,7 +1365,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#48", "pos": { - "x": 84.0, + "x": 129.0, "y": 244.0 }, "params": 1 @@ -1374,7 +1374,7 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#49", "pos": { - "x": 59.0, + "x": 104.0, "y": 274.0 }, "params": 1 @@ -1401,20 +1401,11 @@ "id": "WireCrossPoint", "name": "WireCrossPoint#52", "pos": { - "x": 59.0, + "x": 104.0, "y": 284.0 }, "params": 1 }, - { - "id": "WireCrossPoint", - "name": "WireCrossPoint#53", - "pos": { - "x": 174.0, - "y": 314.0 - }, - "params": 1 - }, { "id": "and", "name": "and#0", @@ -1443,7 +1434,7 @@ "id": "and", "name": "and#3", "pos": { - "x": 90.0, + "x": 135.0, "y": 240.0 } }, @@ -1451,18 +1442,10 @@ "id": "and", "name": "and#4", "pos": { - "x": 90.0, + "x": 135.0, "y": 265.0 } }, - { - "id": "and", - "name": "and#5", - "pos": { - "x": 185.0, - "y": 240.0 - } - }, { "id": "dff16", "name": "dff16#0", @@ -1491,7 +1474,7 @@ "id": "dff", "name": "dff#0", "pos": { - "x": 135.0, + "x": 180.0, "y": 265.0 } }, @@ -1499,7 +1482,7 @@ "id": "dff", "name": "dff#1", "pos": { - "x": 135.0, + "x": 180.0, "y": 240.0 } }, @@ -1507,7 +1490,7 @@ "id": "dff", "name": "dff#2", "pos": { - "x": 135.0, + "x": 180.0, "y": 290.0 } }, @@ -1540,7 +1523,7 @@ "id": "mux1", "name": "mux1#0", "pos": { - "x": 105.0, + "x": 100.0, "y": 360.0 } }, @@ -3220,7 +3203,7 @@ "name": "unnamedWire#96", "path": [ { - "x": 145.0, + "x": 140.0, "y": 390.0 } ] @@ -3261,7 +3244,7 @@ "name": "unnamedWire#99", "path": [ { - "x": 175.0, + "x": 170.0, "y": 485.0 }, { @@ -3319,7 +3302,7 @@ "name": "unnamedWire#102", "path": [ { - "x": 180.0, + "x": 175.0, "y": 480.0 }, { @@ -3658,11 +3641,11 @@ "y": 325.0 }, { - "x": 55.0, + "x": 100.0, "y": 325.0 }, { - "x": 55.0, + "x": 100.0, "y": 250.0 } ] @@ -5354,7 +5337,7 @@ "y": 320.0 }, { - "x": 60.0, + "x": 105.0, "y": 320.0 } ] @@ -6826,11 +6809,11 @@ "name": "unnamedWire#335", "path": [ { - "x": 55.0, + "x": 100.0, "y": 230.0 }, { - "x": 55.0, + "x": 100.0, "y": 240.0 } ] @@ -6975,11 +6958,16 @@ "pinName": "" }, "pin2": { - "compName": "WireCrossPoint#53", + "compName": "WireCrossPoint#42", "pinName": "" }, "name": "unnamedWire#346", - "path": [] + "path": [ + { + "x": 170.0, + "y": 315.0 + } + ] }, { "pin1": { @@ -7011,7 +6999,7 @@ "path": [ { "x": 480.0, - "y": 290.0 + "y": 315.0 }, { "x": 480.0, @@ -7079,11 +7067,11 @@ }, { "pin1": { - "compName": "WireCrossPoint#44", + "compName": "WireCrossPoint#46", "pinName": "" }, "pin2": { - "compName": "WireCrossPoint#42", + "compName": "WireCrossPoint#44", "pinName": "" }, "name": "unnamedWire#352", @@ -7091,11 +7079,11 @@ }, { "pin1": { - "compName": "WireCrossPoint#53", + "compName": "WireCrossPoint#39", "pinName": "" }, "pin2": { - "compName": "WireCrossPoint#44", + "compName": "WireCrossPoint#45", "pinName": "" }, "name": "unnamedWire#353", @@ -7103,18 +7091,18 @@ }, { "pin1": { - "compName": "WireCrossPoint#53", + "compName": "WireCrossPoint#44", "pinName": "" }, "pin2": { - "compName": "WireCrossPoint#45", - "pinName": "" + "compName": "dff16#1", + "pinName": "C" }, "name": "unnamedWire#354", "path": [ { - "x": 130.0, - "y": 315.0 + "x": 175.0, + "y": 70.0 } ] }, @@ -7124,16 +7112,11 @@ "pinName": "" }, "pin2": { - "compName": "dff16#1", + "compName": "dff#1", "pinName": "C" }, "name": "unnamedWire#355", - "path": [ - { - "x": 175.0, - "y": 70.0 - } - ] + "path": [] }, { "pin1": { @@ -7161,8 +7144,8 @@ }, { "pin1": { - "compName": "and#5", - "pinName": "Y" + "compName": "dff#1", + "pinName": "Q" }, "pin2": { "compName": "TriStateBuffer#4", @@ -7171,11 +7154,11 @@ "name": "unnamedWire#358", "path": [ { - "x": 225.0, + "x": 220.0, "y": 245.0 }, { - "x": 225.0, + "x": 220.0, "y": 200.0 }, { @@ -7196,11 +7179,11 @@ "name": "unnamedWire#359", "path": [ { - "x": 230.0, + "x": 225.0, "y": 270.0 }, { - "x": 230.0, + "x": 225.0, "y": 170.0 }, { @@ -7269,15 +7252,15 @@ "name": "unnamedWire#364", "path": [ { - "x": 60.0, + "x": 105.0, "y": 260.0 }, { - "x": 80.0, + "x": 125.0, "y": 260.0 }, { - "x": 80.0, + "x": 125.0, "y": 255.0 } ] @@ -7294,7 +7277,7 @@ "name": "unnamedWire#365", "path": [ { - "x": 85.0, + "x": 130.0, "y": 270.0 } ] @@ -7429,23 +7412,6 @@ "name": "unnamedWire#375", "path": [] }, - { - "pin1": { - "compName": "WireCrossPoint#46", - "pinName": "" - }, - "pin2": { - "compName": "dff#1", - "pinName": "C" - }, - "name": "unnamedWire#376", - "path": [ - { - "x": 130.0, - "y": 255.0 - } - ] - }, { "pin1": { "compName": "dff#2", @@ -7455,14 +7421,14 @@ "compName": "Am2900MainMemory#0", "pinName": "RW" }, - "name": "unnamedWire#377", + "name": "unnamedWire#376", "path": [ { - "x": 235.0, + "x": 230.0, "y": 295.0 }, { - "x": 235.0, + "x": 230.0, "y": 210.0 }, { @@ -7475,35 +7441,6 @@ } ] }, - { - "pin1": { - "compName": "dff#1", - "pinName": "Q" - }, - "pin2": { - "compName": "and#5", - "pinName": "A" - }, - "name": "unnamedWire#378", - "path": [] - }, - { - "pin1": { - "compName": "WireCrossPoint#39", - "pinName": "" - }, - "pin2": { - "compName": "and#5", - "pinName": "B" - }, - "name": "unnamedWire#379", - "path": [ - { - "x": 180.0, - "y": 255.0 - } - ] - }, { "pin1": { "compName": "ManualSwitch#0", @@ -7513,14 +7450,14 @@ "compName": "mux1#0", "pinName": "S0" }, - "name": "unnamedWire#380", + "name": "unnamedWire#377", "path": [ { - "x": 100.0, + "x": 95.0, "y": 355.0 }, { - "x": 100.0, + "x": 95.0, "y": 365.0 } ] @@ -7534,14 +7471,14 @@ "compName": "mux1#0", "pinName": "I1" }, - "name": "unnamedWire#381", + "name": "unnamedWire#378", "path": [ { - "x": 100.0, + "x": 95.0, "y": 395.0 }, { - "x": 100.0, + "x": 95.0, "y": 385.0 } ] @@ -7555,7 +7492,7 @@ "compName": "mux1#0", "pinName": "I0" }, - "name": "unnamedWire#382", + "name": "unnamedWire#379", "path": [] } ], diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java index 9d2645d7..cdc7e4a2 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java @@ -100,7 +100,7 @@ public class DelegatingAtomicHighLevelStateHandler implements AtomicHighLevelSta if (delegateTarget == null) throw new IllegalStateException("Delegating to a component that was destroyed"); DelegatingAtomicHighLevelStateHandlerParams params = new DelegatingAtomicHighLevelStateHandlerParams(); - params.delegateTarget = delegateTarget.getName(); + params.delegateTarget = delegateTarget == parentComponent ? null : delegateTarget.getName(); params.subStateID = subStateID; return params; } diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java index 12a98887..104cb142 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java @@ -103,8 +103,10 @@ public class DelegatingSubcomponentHighLevelStateHandler implements Subcomponent @Override public DelegatingSubcomponentHighLevelStateHandlerParams getParamsForSerializing(IdentifyParams idParams) { + if (delegateTarget == null) + throw new IllegalStateException("Delegating to a component that was destroyed"); DelegatingSubcomponentHighLevelStateHandlerParams params = new DelegatingSubcomponentHighLevelStateHandlerParams(); - params.delegateTarget = delegateTarget.getName(); + params.delegateTarget = delegateTarget == parentComponent ? null : delegateTarget.getName(); params.prefix = prefix; return params; }