projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added demux; added getAllInputs() and getAllOutputs() for all components
[Mograsim.git]
/
era.mi
/
src
/
era
/
mi
/
logic
/
components
/
gates
/
AndGate.java
diff --git
a/era.mi/src/era/mi/logic/components/gates/AndGate.java
b/era.mi/src/era/mi/logic/components/gates/AndGate.java
index
762eeef
..
5c81406
100644
(file)
--- a/
era.mi/src/era/mi/logic/components/gates/AndGate.java
+++ b/
era.mi/src/era/mi/logic/components/gates/AndGate.java
@@
-1,12
+1,18
@@
package era.mi.logic.components.gates;
package era.mi.logic.components.gates;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
import era.mi.logic.Util;
import era.mi.logic.Util;
-import era.mi.logic.WireArray;
import era.mi.logic.components.BasicComponent;
import era.mi.logic.components.BasicComponent;
+import era.mi.logic.wires.WireArray;
+import era.mi.logic.wires.WireArray.WireArrayInput;
public class AndGate extends BasicComponent
{
private WireArray a, b, out;
public class AndGate extends BasicComponent
{
private WireArray a, b, out;
+ private WireArrayInput outI;
public AndGate(int processTime, WireArray a, WireArray b, WireArray out)
{
public AndGate(int processTime, WireArray a, WireArray b, WireArray out)
{
@@
-16,11
+22,12
@@
public class AndGate extends BasicComponent
this.b = b;
b.addObserver(this);
this.out = out;
this.b = b;
b.addObserver(this);
this.out = out;
+ outI = out.createInput();
}
protected void compute()
{
}
protected void compute()
{
- out.feedSignals(Util.and(a.getValues(), b.getValues()));
+ out
I
.feedSignals(Util.and(a.getValues(), b.getValues()));
}
public WireArray getA()
}
public WireArray getA()
@@
-37,4
+44,16
@@
public class AndGate extends BasicComponent
{
return out;
}
{
return out;
}
+
+ @Override
+ public List<WireArray> getAllInputs()
+ {
+ return Collections.unmodifiableList(Arrays.asList(a, b));
+ }
+
+ @Override
+ public List<WireArray> getAllOutputs()
+ {
+ return Collections.unmodifiableList(Arrays.asList(out));
+ }
}
}