X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2Fcomponents%2FMux.java;h=5391e655c4c678937c222f0643707cac963fd4dd;hb=6c67a9ff8361cd9fc082f40e2676f2c8b5911fe4;hp=aea7116629fcad2864891d430cbae7d440229df3;hpb=b1e7855af2dfc15b4d6c1253dd77db02925162f3;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..5391e655 100644 --- a/era.mi/src/era/mi/logic/components/Mux.java +++ b/era.mi/src/era/mi/logic/components/Mux.java @@ -5,8 +5,10 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import era.mi.logic.timeline.Timeline; 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 +19,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,9 +31,9 @@ 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(Timeline timeline, int processTime, ReadWriteEnd out, ReadEnd select, ReadEnd... inputs) { - super(processTime); + super(timeline, processTime); outputSize = out.length(); this.inputs = inputs.clone(); @@ -53,12 +55,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 +75,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); }