From 58c2b670f915c217fcdde1b874606a5550f4e5c7 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 30 Oct 2019 19:17:21 +0100 Subject: [PATCH] Made hardcoded components slower to fix a timing bug in the Am2900 --- .../net/mograsim/logic/model/am2900/machine/Am2900Machine.java | 1 + .../src/net/mograsim/logic/model/SimpleLogicUIStandalone.java | 1 + .../mograsim/logic/model/modeladapter/CoreModelParameters.java | 1 + .../SimpleRectangularHardcodedModelComponentAdapter.java | 2 +- .../src/net/mograsim/plugin/SimulationPreview.java | 1 + .../mograsim/logic/model/am2900/util/TestEnvironmentHelper.java | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java index cb57ab89..33c29f06 100644 --- a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java +++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java @@ -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( diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/SimpleLogicUIStandalone.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/SimpleLogicUIStandalone.java index 03d0335c..48f5cf5b 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/SimpleLogicUIStandalone.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/SimpleLogicUIStandalone.java @@ -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); } diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java index db3b5ac6..96be5c2a 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java @@ -4,4 +4,5 @@ public class CoreModelParameters { public int wireTravelTime; public int gateProcessTime; + public int hardcodedComponentProcessTime; } \ No newline at end of file diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SimpleRectangularHardcodedModelComponentAdapter.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SimpleRectangularHardcodedModelComponentAdapter.java index 716c306c..57effc32 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SimpleRectangularHardcodedModelComponentAdapter.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SimpleRectangularHardcodedModelComponentAdapter.java @@ -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()); } diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java index 92d45a5c..746433b1 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java @@ -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); diff --git a/tests/net.mograsim.logic.model.am2900.tests/src/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java b/tests/net.mograsim.logic.model.am2900.tests/src/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java index 4bae8ec5..51833be8 100644 --- a/tests/net.mograsim.logic.model.am2900.tests/src/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java +++ b/tests/net.mograsim.logic.model.am2900.tests/src/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java @@ -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)); -- 2.17.1