From: Daniel Kirschten Date: Sat, 31 Aug 2019 13:42:02 +0000 (+0200) Subject: Found a bug in logic.core X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=bf6ca666751678667bae09e7b6b34460271a41ae;p=Mograsim.git Found a bug in logic.core --- diff --git a/net.mograsim.logic.model.am2900/FusionNotWorkingTest.json b/net.mograsim.logic.model.am2900/FusionNotWorkingTest.json new file mode 100644 index 00000000..da84908c --- /dev/null +++ b/net.mograsim.logic.model.am2900/FusionNotWorkingTest.json @@ -0,0 +1,648 @@ +{ + "width": 0.0, + "height": 0.0, + "interfacePins": [], + "innerScale": 1.0, + "submodel": { + "components": [ + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#2", + "pos": { + "x": 185.0, + "y": 170.0 + }, + "params": 1 + }, + { + "id": "GUIBitDisplay", + "name": "GUIBitDisplay#0", + "pos": { + "x": 391.0, + "y": 150.0 + }, + "params": 1 + }, + { + "id": "GUIBitDisplay", + "name": "GUIBitDisplay#3", + "pos": { + "x": 391.0, + "y": 195.0 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#4", + "pos": { + "x": 185.0, + "y": 190.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#12", + "pos": { + "x": 380.0, + "y": 205.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#10", + "pos": { + "x": 370.0, + "y": 175.0 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#5", + "pos": { + "x": 185.0, + "y": 210.0 + }, + "params": 1 + }, + { + "id": "GUITriStateBuffer", + "name": "GUITriStateBuffer#7", + "pos": { + "x": 335.0, + "y": 135.0 + }, + "params": { + "logicWidth": 1, + "orientation": "RIGHT" + } + }, + { + "id": "GUITriStateBuffer", + "name": "GUITriStateBuffer#4", + "pos": { + "x": 335.0, + "y": 105.0 + }, + "params": { + "logicWidth": 1, + "orientation": "RIGHT" + } + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#7", + "pos": { + "x": 360.0, + "y": 110.0 + }, + "params": 1 + }, + { + "id": "GUIBitDisplay", + "name": "GUIBitDisplay#2", + "pos": { + "x": 391.0, + "y": 180.0 + }, + "params": 1 + }, + { + "id": "file:FusionNotWorkingTestInner.json", + "name": "inner", + "pos": { + "x": 220.0, + "y": 175.0 + } + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#32", + "pos": { + "x": 300.0, + "y": 107.5 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#33", + "pos": { + "x": 300.0, + "y": 137.5 + }, + "params": 1 + }, + { + "id": "GUIBitDisplay", + "name": "GUIBitDisplay#1", + "pos": { + "x": 391.0, + "y": 165.0 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#0", + "pos": { + "x": 240.0, + "y": 150.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#11", + "pos": { + "x": 375.0, + "y": 190.0 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#35", + "pos": { + "x": 300.0, + "y": 122.5 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#34", + "pos": { + "x": 300.0, + "y": 92.5 + }, + "params": 1 + }, + { + "id": "GUITriStateBuffer", + "name": "GUITriStateBuffer#5", + "pos": { + "x": 335.0, + "y": 90.0 + }, + "params": { + "logicWidth": 1, + "orientation": "RIGHT" + } + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#6", + "pos": { + "x": 345.0, + "y": 85.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#9", + "pos": { + "x": 365.0, + "y": 160.0 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#36", + "pos": { + "x": 300.0, + "y": 77.5 + }, + "params": 1 + }, + { + "id": "GUIManualSwitch", + "name": "GUIManualSwitch#6", + "pos": { + "x": 185.0, + "y": 230.0 + }, + "params": 1 + }, + { + "id": "WireCrossPoint", + "name": "WireCrossPoint#8", + "pos": { + "x": 360.0, + "y": 125.0 + }, + "params": 1 + }, + { + "id": "GUITriStateBuffer", + "name": "GUITriStateBuffer#6", + "pos": { + "x": 335.0, + "y": 120.0 + }, + "params": { + "logicWidth": 1, + "orientation": "RIGHT" + } + } + ], + "wires": [ + { + "pin1": { + "compName": "WireCrossPoint#11", + "pinName": "" + }, + "pin2": { + "compName": "inner", + "pinName": "YN" + }, + "name": "unnamedWire#15", + "path": [ + { + "x": 375.0, + "y": 210.0 + } + ] + }, + { + "pin1": { + "compName": "GUIManualSwitch#35", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#6", + "pinName": "IN" + }, + "name": "unnamedWire#56", + "path": [] + }, + { + "pin1": { + "compName": "inner", + "pinName": "YOVR" + }, + "pin2": { + "compName": "WireCrossPoint#12", + "pinName": "" + }, + "name": "unnamedWire#14", + "path": [ + { + "x": 380.0, + "y": 220.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#8", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#6", + "pinName": "EN" + }, + "name": "unnamedWire#64", + "path": [] + }, + { + "pin1": { + "compName": "inner", + "pinName": "YC" + }, + "pin2": { + "compName": "WireCrossPoint#10", + "pinName": "" + }, + "name": "unnamedWire#68", + "path": [ + { + "x": 370.0, + "y": 200.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#6", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#7", + "pinName": "" + }, + "name": "unnamedWire#61", + "path": [ + { + "x": 360.0, + "y": 85.0 + } + ] + }, + { + "pin1": { + "compName": "GUIManualSwitch#0", + "pinName": "" + }, + "pin2": { + "compName": "inner", + "pinName": "_OEY" + }, + "name": "unnamedWire#0", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#12", + "pinName": "" + }, + "pin2": { + "compName": "GUIBitDisplay#3", + "pinName": "" + }, + "name": "unnamedWire#72", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#6", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#5", + "pinName": "EN" + }, + "name": "unnamedWire#59", + "path": [] + }, + { + "pin1": { + "compName": "inner", + "pinName": "YZ" + }, + "pin2": { + "compName": "WireCrossPoint#9", + "pinName": "" + }, + "name": "unnamedWire#17", + "path": [ + { + "x": 365.0, + "y": 190.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#6", + "pinName": "" + }, + "pin2": { + "compName": "GUIManualSwitch#36", + "pinName": "" + }, + "name": "unnamedWire#60", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#11", + "pinName": "" + }, + "pin2": { + "compName": "GUIBitDisplay#2", + "pinName": "" + }, + "name": "unnamedWire#71", + "path": [] + }, + { + "pin1": { + "compName": "GUIManualSwitch#6", + "pinName": "" + }, + "pin2": { + "compName": "inner", + "pinName": "IOVR" + }, + "name": "unnamedWire#1", + "path": [] + }, + { + "pin1": { + "compName": "inner", + "pinName": "IZ" + }, + "pin2": { + "compName": "GUIManualSwitch#2", + "pinName": "" + }, + "name": "unnamedWire#4", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#9", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#5", + "pinName": "OUT" + }, + "name": "unnamedWire#67", + "path": [ + { + "x": 365.0, + "y": 100.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#7", + "pinName": "" + }, + "pin2": { + "compName": "WireCrossPoint#8", + "pinName": "" + }, + "name": "unnamedWire#63", + "path": [] + }, + { + "pin1": { + "compName": "GUITriStateBuffer#7", + "pinName": "IN" + }, + "pin2": { + "compName": "GUIManualSwitch#33", + "pinName": "" + }, + "name": "unnamedWire#55", + "path": [] + }, + { + "pin1": { + "compName": "inner", + "pinName": "IN" + }, + "pin2": { + "compName": "GUIManualSwitch#5", + "pinName": "" + }, + "name": "unnamedWire#2", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#10", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#4", + "pinName": "OUT" + }, + "name": "unnamedWire#69", + "path": [ + { + "x": 370.0, + "y": 115.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#11", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#6", + "pinName": "OUT" + }, + "name": "unnamedWire#70", + "path": [ + { + "x": 375.0, + "y": 130.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#7", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#4", + "pinName": "EN" + }, + "name": "unnamedWire#62", + "path": [] + }, + { + "pin1": { + "compName": "GUIManualSwitch#4", + "pinName": "" + }, + "pin2": { + "compName": "inner", + "pinName": "IC" + }, + "name": "unnamedWire#3", + "path": [] + }, + { + "pin1": { + "compName": "GUITriStateBuffer#7", + "pinName": "EN" + }, + "pin2": { + "compName": "WireCrossPoint#8", + "pinName": "" + }, + "name": "unnamedWire#65", + "path": [ + { + "x": 360.0, + "y": 140.0 + } + ] + }, + { + "pin1": { + "compName": "WireCrossPoint#9", + "pinName": "" + }, + "pin2": { + "compName": "GUIBitDisplay#0", + "pinName": "" + }, + "name": "unnamedWire#66", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#12", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#7", + "pinName": "OUT" + }, + "name": "unnamedWire#73", + "path": [ + { + "x": 380.0, + "y": 145.0 + } + ] + }, + { + "pin1": { + "compName": "GUITriStateBuffer#4", + "pinName": "IN" + }, + "pin2": { + "compName": "GUIManualSwitch#32", + "pinName": "" + }, + "name": "unnamedWire#57", + "path": [] + }, + { + "pin1": { + "compName": "GUIManualSwitch#34", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#5", + "pinName": "IN" + }, + "name": "unnamedWire#58", + "path": [] + }, + { + "pin1": { + "compName": "WireCrossPoint#10", + "pinName": "" + }, + "pin2": { + "compName": "GUIBitDisplay#1", + "pinName": "" + }, + "name": "unnamedWire#16", + "path": [] + } + ], + "version": "0.1.1" + }, + "symbolRendererSnippetID": "default", + "outlineRendererSnippetID": "default", + "highLevelStateHandlerSnippetID": "default", + "version": "0.1.4" +} \ No newline at end of file diff --git a/net.mograsim.logic.model.am2900/FusionNotWorkingTestInner.json b/net.mograsim.logic.model.am2900/FusionNotWorkingTestInner.json new file mode 100644 index 00000000..3218cfc9 --- /dev/null +++ b/net.mograsim.logic.model.am2900/FusionNotWorkingTestInner.json @@ -0,0 +1,320 @@ +{ + "width": 115.0, + "height": 70.0, + "interfacePins": [ + { + "location": { + "x": 0.0, + "y": 45.0 + }, + "name": "IOVR", + "logicWidth": 1 + }, + { + "location": { + "x": 115.0, + "y": 15.0 + }, + "name": "YZ", + "logicWidth": 1 + }, + { + "location": { + "x": 0.0, + "y": 15.0 + }, + "name": "IZ", + "logicWidth": 1 + }, + { + "location": { + "x": 115.0, + "y": 35.0 + }, + "name": "YN", + "logicWidth": 1 + }, + { + "location": { + "x": 0.0, + "y": 35.0 + }, + "name": "IN", + "logicWidth": 1 + }, + { + "location": { + "x": 55.0, + "y": 0.0 + }, + "name": "_OEY", + "logicWidth": 1 + }, + { + "location": { + "x": 115.0, + "y": 25.0 + }, + "name": "YC", + "logicWidth": 1 + }, + { + "location": { + "x": 0.0, + "y": 25.0 + }, + "name": "IC", + "logicWidth": 1 + }, + { + "location": { + "x": 115.0, + "y": 45.0 + }, + "name": "YOVR", + "logicWidth": 1 + } + ], + "innerScale": 1.0, + "submodel": { + "components": [ + { + "id": "GUITriStateBuffer", + "name": "GUITriStateBuffer#0", + "pos": { + "x": 45.0, + "y": 20.0 + }, + "params": { + "logicWidth": 4, + "orientation": "RIGHT" + } + }, + { + "id": "GUIBitDisplay", + "name": "GUIBitDisplay#2", + "pos": { + "x": 35.0, + "y": 45.0 + }, + "params": 4 + }, + { + "id": "GUIMerger", + "name": "GUIMerger#2", + "pos": { + "x": 17.0, + "y": 15.0 + }, + "params": 4 + }, + { + "id": "GUIBitDisplay", + "name": "GUIBitDisplay#1", + "pos": { + "x": 75.0, + "y": 35.0 + }, + "params": 4 + }, + { + "id": "GUISplitter", + "name": "GUISplitter#1", + "pos": { + "x": 100.0, + "y": 15.0 + }, + "params": 4 + }, + { + "id": "GUIBitDisplay", + "name": "GUIBitDisplay#3", + "pos": { + "x": 65.0, + "y": 5.0 + }, + "params": 1 + } + ], + "wires": [ + { + "pin1": { + "compName": "GUITriStateBuffer#0", + "pinName": "IN" + }, + "pin2": { + "compName": "GUIMerger#2", + "pinName": "O" + }, + "name": "unnamedWire#1", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "YOVR" + }, + "pin2": { + "compName": "GUISplitter#1", + "pinName": "O3" + }, + "name": "unnamedWire#52", + "path": [] + }, + { + "pin1": { + "compName": "GUISplitter#1", + "pinName": "O0" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "YZ" + }, + "name": "unnamedWire#49", + "path": [] + }, + { + "pin1": { + "compName": "GUITriStateBuffer#0", + "pinName": "EN" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "_OEY" + }, + "name": "unnamedWire#0", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "IOVR" + }, + "pin2": { + "compName": "GUIMerger#2", + "pinName": "I3" + }, + "name": "unnamedWire#17", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "IN" + }, + "pin2": { + "compName": "GUIMerger#2", + "pinName": "I2" + }, + "name": "unnamedWire#18", + "path": [] + }, + { + "pin1": { + "compName": "GUIBitDisplay#2", + "pinName": "" + }, + "pin2": { + "compName": "GUITriStateBuffer#0", + "pinName": "IN" + }, + "name": "unnamedWire#3", + "path": [ + { + "x": 30.0, + "y": 40.0 + } + ] + }, + { + "pin1": { + "compName": "GUIMerger#2", + "pinName": "I0" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "IZ" + }, + "name": "unnamedWire#4", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "IC" + }, + "pin2": { + "compName": "GUIMerger#2", + "pinName": "I1" + }, + "name": "unnamedWire#19", + "path": [] + }, + { + "pin1": { + "compName": "GUITriStateBuffer#0", + "pinName": "EN" + }, + "pin2": { + "compName": "GUIBitDisplay#3", + "pinName": "" + }, + "name": "unnamedWire#232", + "path": [] + }, + { + "pin1": { + "compName": "_submodelinterface", + "pinName": "YC" + }, + "pin2": { + "compName": "GUISplitter#1", + "pinName": "O1" + }, + "name": "unnamedWire#50", + "path": [] + }, + { + "pin1": { + "compName": "GUITriStateBuffer#0", + "pinName": "OUT" + }, + "pin2": { + "compName": "GUIBitDisplay#1", + "pinName": "" + }, + "name": "unnamedWire#230", + "path": [] + }, + { + "pin1": { + "compName": "GUISplitter#1", + "pinName": "O2" + }, + "pin2": { + "compName": "_submodelinterface", + "pinName": "YN" + }, + "name": "unnamedWire#51", + "path": [] + }, + { + "pin1": { + "compName": "GUITriStateBuffer#0", + "pinName": "OUT" + }, + "pin2": { + "compName": "GUISplitter#1", + "pinName": "I" + }, + "name": "unnamedWire#2", + "path": [] + } + ], + "version": "0.1.1" + }, + "symbolRendererSnippetID": "default", + "outlineRendererSnippetID": "default", + "highLevelStateHandlerSnippetID": "default", + "version": "0.1.4" +} \ No newline at end of file diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/FusionNotWorkingTest.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/FusionNotWorkingTest.java new file mode 100644 index 00000000..eb8165f5 --- /dev/null +++ b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/FusionNotWorkingTest.java @@ -0,0 +1,41 @@ +package net.mograsim.logic.model.examples; + +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.model.SimpleLogicUIStandalone; +import net.mograsim.logic.model.model.ViewModelModifiable; +import net.mograsim.logic.model.serializing.DeserializedSubmodelComponent; +import net.mograsim.logic.model.serializing.IdentifierGetter; +import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; +import net.mograsim.logic.model.snippets.Renderer; + +public class FusionNotWorkingTest +{ + public static void main(String[] args) + { + SimpleLogicUIStandalone.executeVisualisation(FusionNotWorkingTest::create); + } + + public static void create(ViewModelModifiable model) + { + // TODO use _SE in GUIAm2904.json + // TODO replace with proper ViewModel deserialization + DeserializedSubmodelComponent testbench = (DeserializedSubmodelComponent) IndirectGUIComponentCreator.createComponent(model, + "file:FusionNotWorkingTest.json", "testbench"); + testbench.setSize(1000, 1000); + testbench.setOutlineRenderer(new Renderer() + { + @Override + public Object getParamsForSerializing(IdentifierGetter idGetter) + { + return null; + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + // do nothing + } + }); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/submodels/SubmodelComponent.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/submodels/SubmodelComponent.java index 9cdbabbb..1818dc6e 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/submodels/SubmodelComponent.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/submodels/SubmodelComponent.java @@ -106,8 +106,8 @@ public abstract class SubmodelComponent extends GUIComponent this.submodelInterface = new SubmodelInterface(submodelModifiable, SUBMODEL_INTERFACE_NAME); this.submodelScale = 1; - this.maxVisibleRegionFillRatioForAlpha0 = 0.8; - this.minVisibleRegionFillRatioForAlpha1 = 0.9; + this.maxVisibleRegionFillRatioForAlpha0 = 0.0; + this.minVisibleRegionFillRatioForAlpha1 = 0.0; this.renderer = new LogicUIRenderer(submodelModifiable); submodelModifiable.setRedrawHandler(model.getRedrawHandler()); diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/TriStateBufferAdapter.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/TriStateBufferAdapter.java index bb26b03b..ba8c4843 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/TriStateBufferAdapter.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/TriStateBufferAdapter.java @@ -2,6 +2,7 @@ package net.mograsim.logic.model.modeladapter.componentadapters; import java.util.Map; +import net.mograsim.logic.core.LogicObserver; import net.mograsim.logic.core.components.TriStateBuffer; import net.mograsim.logic.core.timeline.Timeline; import net.mograsim.logic.core.wires.Wire; @@ -13,7 +14,6 @@ import net.mograsim.logic.model.modeladapter.LogicModelParameters; public class TriStateBufferAdapter implements ComponentAdapter { - @Override public Class getSupportedClass() { @@ -29,6 +29,17 @@ public class TriStateBufferAdapter implements ComponentAdapter: "; + LogicObserver obs = c -> + { + System.out.println(msgHeader + "wire states:"); + System.out.println(msgHeader + " in : " + in.getValues()); + System.out.println(msgHeader + " enable: " + enable.getValues()); + System.out.println(msgHeader + " out : " + out.getValues()); + }; + in.registerObserver(obs); + enable.registerObserver(obs); + out.registerObserver(obs); } - }