Made hardcoded components slower to fix a timing bug in the Am2900
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Wed, 30 Oct 2019 18:17:21 +0000 (19:17 +0100)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Wed, 30 Oct 2019 18:17:21 +0000 (19:17 +0100)
plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/SimpleLogicUIStandalone.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SimpleRectangularHardcodedModelComponentAdapter.java
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java
tests/net.mograsim.logic.model.am2900.tests/src/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java

index cb57ab8..33c29f0 100644 (file)
@@ -54,6 +54,7 @@ public class Am2900Machine implements Machine
 
                CoreModelParameters params = new CoreModelParameters();
                params.gateProcessTime = 50;
+               params.hardcodedComponentProcessTime = params.gateProcessTime * 5;
                params.wireTravelTime = 10;
                mainMemory = new AssignableMainMemory(new WordAddressableMemory(am2900MachineDefinition.getMainMemoryDefinition()));
                instMemory = new AssignableMicroInstructionMemory(
index 03d0335..48f5cf5 100644 (file)
@@ -18,6 +18,7 @@ public class SimpleLogicUIStandalone
        {
                CoreModelParameters params = new CoreModelParameters();
                params.gateProcessTime = 50;
+               params.hardcodedComponentProcessTime = params.gateProcessTime * 5;
                params.wireTravelTime = 10;
                executeVisualisation(setupLogicModel, params, beforeRun);
        }
index db3b5ac..96be5c2 100644 (file)
@@ -4,4 +4,5 @@ public class CoreModelParameters
 {
        public int wireTravelTime;
        public int gateProcessTime;
+       public int hardcodedComponentProcessTime;
 }
\ No newline at end of file
index 716c306..57effc3 100644 (file)
@@ -43,7 +43,7 @@ public class SimpleRectangularHardcodedModelComponentAdapter implements Componen
                        if (pin.usage != PinUsage.INPUT)
                        {
                                // TODO do this prettier
-                               CoreWire pseudoWire = new CoreWire(timeline, wire.width, params.gateProcessTime);
+                               CoreWire pseudoWire = new CoreWire(timeline, wire.width, params.hardcodedComponentProcessTime);
                                CoreWire.fuse(wire, pseudoWire);
                                readWriteEnds.put(pin.name, pseudoWire.createReadWriteEnd());
                        }
index 92d45a5..746433b 100644 (file)
@@ -39,6 +39,7 @@ public class SimulationPreview implements IThemePreview
                LogicModelModifiable model = new LogicModelModifiable();
                CoreModelParameters params = new CoreModelParameters();
                params.gateProcessTime = 50;
+               params.hardcodedComponentProcessTime = params.gateProcessTime * 5;
                params.wireTravelTime = 10;
 
                ModelManualSwitch rIn = new ModelManualSwitch(model, 1);
index 4bae8ec..51833be 100644 (file)
@@ -90,6 +90,7 @@ public class TestEnvironmentHelper
                // Create core model
                CoreModelParameters params = new CoreModelParameters();
                params.gateProcessTime = 50;
+               params.hardcodedComponentProcessTime = params.gateProcessTime * 5;
                params.wireTravelTime = 10;
                timeline = LogicCoreAdapter.convert(logicModel, params);
                timelineField.ifPresent(f -> setField(f, timeline));