/**
* Models a multiplexer. Takes an arbitrary amount of input {@link WireArray}s, one of which, as determined by select, is put through to the
/**
* Models a multiplexer. Takes an arbitrary amount of input {@link WireArray}s, one of which, as determined by select, is put through to the
* @param select Indexes the input array which is to be mapped to the output. Must have enough bits to index all inputs.
* @param inputs One of these inputs is mapped to the output, depending on the select bits
*/
* @param select Indexes the input array which is to be mapped to the output. Must have enough bits to index all inputs.
* @param inputs One of these inputs is mapped to the output, depending on the select bits
*/
- public Mux(int processTime, WireArray out, WireArray select, WireArray... inputs) {
+ public Mux(int processTime, WireArray out, WireArray select, WireArray... inputs)
+ {
if (inputs[i].length != outputSize)
throw new IllegalArgumentException("All MUX wire arrays must be of uniform length!");
inputs[i].addObserver(this);
if (inputs[i].length != outputSize)
throw new IllegalArgumentException("All MUX wire arrays must be of uniform length!");
inputs[i].addObserver(this);
ArrayList<WireArray> wires = new ArrayList<WireArray>(Arrays.asList(inputs));
wires.add(select);
return Collections.unmodifiableList(wires);
}
@Override
ArrayList<WireArray> wires = new ArrayList<WireArray>(Arrays.asList(inputs));
wires.add(select);
return Collections.unmodifiableList(wires);
}
@Override