X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2Ftests%2FConnector.java;h=9a8d3fc004f1088f010736778229642f447ec96c;hb=9c5575eb465fefb5a32c854b79dc175ce582bc94;hp=d59ee8c0f59a2001643e87f87c20a7f9642956b3;hpb=d31f9734d6aa233682ef80d7e9322dd500123bfd;p=Mograsim.git diff --git a/era.mi/src/era/mi/logic/tests/Connector.java b/era.mi/src/era/mi/logic/tests/Connector.java index d59ee8c0..9a8d3fc0 100644 --- a/era.mi/src/era/mi/logic/tests/Connector.java +++ b/era.mi/src/era/mi/logic/tests/Connector.java @@ -1,23 +1,24 @@ package era.mi.logic.tests; +import era.mi.logic.Bit; import era.mi.logic.Simulation; import era.mi.logic.wires.WireArray; -import era.mi.logic.wires.WireArray.WireArrayInput; +import era.mi.logic.wires.WireArray.WireArrayEnd; import era.mi.logic.wires.WireArrayObserver; public class Connector implements WireArrayObserver { private final WireArray a; - private final WireArray b; - private final WireArrayInput aI; - private final WireArrayInput bI; +// private final WireArray b; + private final WireArrayEnd aI; + private final WireArrayEnd bI; public Connector(WireArray a, WireArray b) { if (a.length != b.length) - throw new IllegalArgumentException("WireArray width does not match: " + a.length + ", " + b.length); + throw new IllegalArgumentException(String.format("WireArray width does not match: %d, %d", a.length, b.length)); this.a = a; - this.b = b; +// this.b = b; a.addObserver(this); b.addObserver(this); aI = a.createInput(); @@ -25,14 +26,14 @@ public class Connector implements WireArrayObserver } @Override - public void update(WireArray initiator) + public void update(WireArray initiator, Bit[] oldValues) { Simulation.TIMELINE.addEvent((e) -> { if (initiator == a) - bI.feedSignals(a.getValues()); + bI.feedSignals(aI.wireValuesExcludingMe()); else - aI.feedSignals(b.getValues()); + aI.feedSignals(bI.wireValuesExcludingMe()); }, 1); } }