X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2Fcomponents%2FMux.java;h=b7cb674436b38f4545ac3758b4308fb8ca6a9056;hb=b7ce41467a2cbd9f45554982730741810e99feaa;hp=aea7116629fcad2864891d430cbae7d440229df3;hpb=5606ceefa2c360772194c85ed884e5f8f06f36aa;p=Mograsim.git diff --git a/era.mi/src/era/mi/logic/components/Mux.java b/era.mi/src/era/mi/logic/components/Mux.java index aea71166..b7cb6744 100644 --- a/era.mi/src/era/mi/logic/components/Mux.java +++ b/era.mi/src/era/mi/logic/components/Mux.java @@ -6,7 +6,8 @@ import java.util.Collections; import java.util.List; import era.mi.logic.wires.Wire; -import era.mi.logic.wires.Wire.WireEnd; +import era.mi.logic.wires.Wire.ReadEnd; +import era.mi.logic.wires.Wire.ReadWriteEnd; /** * Models a multiplexer. Takes an arbitrary amount of input {@link Wire}s, one of which, as determined by select, is put through to the @@ -17,9 +18,9 @@ import era.mi.logic.wires.Wire.WireEnd; */ public class Mux extends BasicComponent { - private WireEnd select; - private WireEnd out; - private WireEnd[] inputs; + private ReadEnd select; + private ReadWriteEnd out; + private ReadEnd[] inputs; private final int outputSize; /** @@ -29,7 +30,7 @@ public class Mux extends BasicComponent * @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, WireEnd out, WireEnd select, WireEnd... inputs) + public Mux(int processTime, ReadWriteEnd out, ReadEnd select, ReadEnd... inputs) { super(processTime); outputSize = out.length(); @@ -53,12 +54,12 @@ public class Mux extends BasicComponent this.out = out; } - public WireEnd getOut() + public ReadEnd getOut() { return out; } - public WireEnd getSelect() + public ReadEnd getSelect() { return select; } @@ -73,20 +74,20 @@ public class Mux extends BasicComponent return; } - WireEnd active = inputs[selectValue]; + ReadEnd active = inputs[selectValue]; out.feedSignals(active.getValues()); } @Override - public List getAllInputs() + public List getAllInputs() { - ArrayList wires = new ArrayList(Arrays.asList(inputs)); + ArrayList wires = new ArrayList(Arrays.asList(inputs)); wires.add(select); return Collections.unmodifiableList(wires); } @Override - public List getAllOutputs() + public List getAllOutputs() { return List.of(out); }