1 package era.mi.logic.components;
3 import era.mi.logic.Bit;
4 import era.mi.logic.wires.WireArray;
5 import era.mi.logic.wires.WireArray.WireArrayInput;
7 public class TriState extends BasicComponent{
11 public TriState(int processTime, WireArray in, WireArray out, WireArray enable) {
13 if(in.length != out.length)
14 throw new IllegalArgumentException("Tri-state output must have the same amount of bits as the input. Input: " + in.length + " Output: " + out.length);
15 if(enable.length != 1)
16 throw new IllegalArgumentException("Tri-state enable must have exactly one bit, not " + enable.length + ".");
20 enable.addObserver(this);
21 outI = out.createInput();
25 protected void compute()
27 if(enable.getValue() == Bit.ONE)
28 outI.feedSignals(in.getValues());