X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2Fcomponents%2Fgates%2FAndGate.java;h=edd34d701c905e62dee43bc989e0cb7f2fe59479;hb=80bfbd8ebf0ad8a7ad98584544a0c73f43e6f3b6;hp=762eeef8b553aa0901a5c91ab47c5f9f525e796a;hpb=a4c5cfb856026771dfcf31eb22434b8b6ff20ad4;p=Mograsim.git diff --git a/era.mi/src/era/mi/logic/components/gates/AndGate.java b/era.mi/src/era/mi/logic/components/gates/AndGate.java index 762eeef8..edd34d70 100644 --- a/era.mi/src/era/mi/logic/components/gates/AndGate.java +++ b/era.mi/src/era/mi/logic/components/gates/AndGate.java @@ -1,40 +1,14 @@ package era.mi.logic.components.gates; -import era.mi.logic.Util; -import era.mi.logic.WireArray; -import era.mi.logic.components.BasicComponent; +import era.mi.logic.timeline.Timeline; +import era.mi.logic.types.BitVector.BitVectorMutator; +import era.mi.logic.wires.Wire.ReadEnd; +import era.mi.logic.wires.Wire.ReadWriteEnd; -public class AndGate extends BasicComponent +public class AndGate extends MultiInputGate { - private WireArray a, b, out; - - public AndGate(int processTime, WireArray a, WireArray b, WireArray out) + public AndGate(Timeline timeline, int processTime, ReadWriteEnd out, ReadEnd... in) { - super(processTime); - this.a = a; - a.addObserver(this); - this.b = b; - b.addObserver(this); - this.out = out; - } - - protected void compute() - { - out.feedSignals(Util.and(a.getValues(), b.getValues())); - } - - public WireArray getA() - { - return a; - } - - public WireArray getB() - { - return b; - } - - public WireArray getOut() - { - return out; + super(timeline, processTime, BitVectorMutator::and, out, in); } }