From: Daniel Kirschten Date: Wed, 30 Oct 2019 18:16:52 +0000 (+0100) Subject: Fixed a timing bug in SimpleRectangularHardcodedModelComponentAdapter X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=c2cee7997ab0954ea9255d0858b1ea10d41b7478;p=Mograsim.git Fixed a timing bug in SimpleRectangularHardcodedModelComponentAdapter --- 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 e4bd59dc..716c306c 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 @@ -32,7 +32,7 @@ public class SimpleRectangularHardcodedModelComponentAdapter implements Componen ObservableAtomicReference state = new ObservableAtomicReference<>(); Runnable recalculate = () -> state.updateAndGet(s -> modelComponent.recalculate(s, readEnds, readWriteEnds)); - LogicObserver logicObs = c -> timeline.addEvent(e -> recalculate.run(), params.gateProcessTime); + LogicObserver logicObs = c -> recalculate.run(); modelComponent.setCoreModelBindingAndResetState(state, recalculate); @@ -42,11 +42,12 @@ public class SimpleRectangularHardcodedModelComponentAdapter implements Componen ReadEnd end; if (pin.usage != PinUsage.INPUT) { - ReadWriteEnd rwEnd = wire.createReadWriteEnd(); - readWriteEnds.put(pin.name, rwEnd); - end = rwEnd; - } else - end = wire.createReadOnlyEnd(); + // TODO do this prettier + CoreWire pseudoWire = new CoreWire(timeline, wire.width, params.gateProcessTime); + CoreWire.fuse(wire, pseudoWire); + readWriteEnds.put(pin.name, pseudoWire.createReadWriteEnd()); + } + end = wire.createReadOnlyEnd(); readEnds.put(pin.name, end); if (pin.usage != PinUsage.OUTPUT) end.registerObserver(logicObs);