projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Timeline now passed via constructor
[Mograsim.git]
/
era.mi
/
src
/
era
/
mi
/
logic
/
components
/
gates
/
MultiInputGate.java
diff --git
a/era.mi/src/era/mi/logic/components/gates/MultiInputGate.java
b/era.mi/src/era/mi/logic/components/gates/MultiInputGate.java
index
0b4a5d0
..
038e227
100644
(file)
--- a/
era.mi/src/era/mi/logic/components/gates/MultiInputGate.java
+++ b/
era.mi/src/era/mi/logic/components/gates/MultiInputGate.java
@@
-3,26
+3,28
@@
package era.mi.logic.components.gates;
import java.util.List;
import era.mi.logic.components.BasicComponent;
import java.util.List;
import era.mi.logic.components.BasicComponent;
+import era.mi.logic.timeline.Timeline;
import era.mi.logic.types.BitVector.BitVectorMutator;
import era.mi.logic.types.MutationOperation;
import era.mi.logic.types.BitVector.BitVectorMutator;
import era.mi.logic.types.MutationOperation;
-import era.mi.logic.wires.Wire.WireEnd;
+import era.mi.logic.wires.Wire.ReadEnd;
+import era.mi.logic.wires.Wire.ReadWriteEnd;
public abstract class MultiInputGate extends BasicComponent
{
public abstract class MultiInputGate extends BasicComponent
{
- protected
Wire
End[] in;
- protected
Wir
eEnd out;
+ protected
Read
End[] in;
+ protected
ReadWrit
eEnd out;
protected final int length;
protected MutationOperation op;
protected final int length;
protected MutationOperation op;
- protected MultiInputGate(
int processTime, MutationOperation op, WireEnd out, Wire
End... in)
+ protected MultiInputGate(
Timeline timeline, int processTime, MutationOperation op, ReadWriteEnd out, Read
End... in)
{
{
- super(processTime);
+ super(
timeline,
processTime);
this.op = op;
length = out.length();
this.in = in.clone();
if (in.length < 1)
throw new IllegalArgumentException(String.format("Cannot create gate with %d wires.", in.length));
this.op = op;
length = out.length();
this.in = in.clone();
if (in.length < 1)
throw new IllegalArgumentException(String.format("Cannot create gate with %d wires.", in.length));
- for (
Wire
End w : in)
+ for (
Read
End w : in)
{
if (w.length() != length)
throw new IllegalArgumentException("All wires connected to the gate must be of uniform length.");
{
if (w.length() != length)
throw new IllegalArgumentException("All wires connected to the gate must be of uniform length.");
@@
-32,13
+34,13
@@
public abstract class MultiInputGate extends BasicComponent
}
@Override
}
@Override
- public List<
Wire
End> getAllInputs()
+ public List<
Read
End> getAllInputs()
{
return List.of(in);
}
@Override
{
return List.of(in);
}
@Override
- public List<
Wir
eEnd> getAllOutputs()
+ public List<
ReadWrit
eEnd> getAllOutputs()
{
return List.of(out);
}
{
return List.of(out);
}
@@
-47,7
+49,7
@@
public abstract class MultiInputGate extends BasicComponent
protected void compute()
{
BitVectorMutator mutator = BitVectorMutator.empty();
protected void compute()
{
BitVectorMutator mutator = BitVectorMutator.empty();
- for (
Wire
End w : in)
+ for (
Read
End w : in)
op.apply(mutator, w.getValues());
out.feedSignals(mutator.get());
}
op.apply(mutator, w.getValues());
out.feedSignals(mutator.get());
}