added demux; added getAllInputs() and getAllOutputs() for all components
[Mograsim.git] / era.mi / src / era / mi / logic / tests / Connector.java
index d59ee8c..7887ff2 100644 (file)
@@ -1,5 +1,6 @@
 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;
@@ -15,7 +16,7 @@ public class Connector implements WireArrayObserver
        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: %o, %o", a.length, b.length));
                this.a = a;
                this.b = b;
                a.addObserver(this);
@@ -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);
        }
 }