X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2Fcomponents%2FTriStateBuffer.java;h=920c2ec03b777fb43f6a5c1a50387e25eaf33011;hb=b1e7855af2dfc15b4d6c1253dd77db02925162f3;hp=0a7133f2e0db4cbf508585363ad95b7c64aaae4b;hpb=c18c04011cab0040c2287608eeefc9c3cc4536c2;p=Mograsim.git diff --git a/era.mi/src/era/mi/logic/components/TriStateBuffer.java b/era.mi/src/era/mi/logic/components/TriStateBuffer.java index 0a7133f2..920c2ec0 100644 --- a/era.mi/src/era/mi/logic/components/TriStateBuffer.java +++ b/era.mi/src/era/mi/logic/components/TriStateBuffer.java @@ -3,48 +3,47 @@ package era.mi.logic.components; import java.util.List; import era.mi.logic.Bit; -import era.mi.logic.wires.WireArray; -import era.mi.logic.wires.WireArray.WireArrayEnd; +import era.mi.logic.wires.Wire.WireEnd; public class TriStateBuffer extends BasicComponent { - WireArray in, enable; - WireArrayEnd outI; + WireEnd in, enable; + WireEnd out; - public TriStateBuffer(int processTime, WireArray in, WireArray out, WireArray enable) + public TriStateBuffer(int processTime, WireEnd in, WireEnd out, WireEnd enable) { super(processTime); - if (in.length != out.length) + if (in.length() != out.length()) throw new IllegalArgumentException( - "Tri-state output must have the same amount of bits as the input. Input: " + in.length + " Output: " + out.length); - if (enable.length != 1) - throw new IllegalArgumentException("Tri-state enable must have exactly one bit, not " + enable.length + "."); + "Tri-state output must have the same amount of bits as the input. Input: " + in.length() + " Output: " + out.length()); + if (enable.length() != 1) + throw new IllegalArgumentException("Tri-state enable must have exactly one bit, not " + enable.length() + "."); this.in = in; in.addObserver(this); this.enable = enable; enable.addObserver(this); - outI = out.createInput(); + this.out = out; } @Override protected void compute() { if (enable.getValue() == Bit.ONE) - outI.feedSignals(in.getValues()); + out.feedSignals(in.getValues()); else - outI.clearSignals(); + out.clearSignals(); } @Override - public List getAllInputs() + public List getAllInputs() { return List.of(in, enable); } @Override - public List getAllOutputs() + public List getAllOutputs() { - return List.of(outI.owner); + return List.of(out); } }