Wire concept was changed to accommodate multiple inputs. Not all
[Mograsim.git] / era.mi / src / era / mi / logic / components / Clock.java
index 3efde15..9f2ecca 100644 (file)
@@ -2,30 +2,31 @@ package era.mi.logic.components;
 
 import era.mi.logic.Bit;
 import era.mi.logic.Simulation;
-import era.mi.logic.WireArray;
 import era.mi.logic.timeline.TimelineEvent;
 import era.mi.logic.timeline.TimelineEventHandler;
+import era.mi.logic.wires.WireArray;
+import era.mi.logic.wires.WireArray.WireArrayInput;
 
 public class Clock implements TimelineEventHandler
 {
        private boolean toggle = false;
-       private WireArray w;
+       private WireArrayInput outI;
        
-       public Clock(WireArray w)
+       public Clock(WireArray out)
        {
-               this.w = w;
+               this.outI = out.createInput();
        }
 
        @Override
        public void handle(TimelineEvent e)
        {
                Simulation.TIMELINE.addEvent(this, 50);
-               w.feedSignals(new Bit[] { toggle ? Bit.ONE : Bit.ZERO });
+               outI.feedSignals(new Bit[] { toggle ? Bit.ONE : Bit.ZERO });
                toggle = !toggle;
        }
 
-       public WireArray getW()
+       public WireArray getOut()
        {
-               return w;
+               return outI.owner;
        }
 }