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
/
XorGate.java
diff --git
a/era.mi/src/era/mi/logic/components/gates/XorGate.java
b/era.mi/src/era/mi/logic/components/gates/XorGate.java
index
9287f3f
..
b13dd2b
100644
(file)
--- a/
era.mi/src/era/mi/logic/components/gates/XorGate.java
+++ b/
era.mi/src/era/mi/logic/components/gates/XorGate.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 XorGate extends BasicComponent
{
private WireArray a, b, out;
public class XorGate extends BasicComponent
{
private WireArray a, b, out;
+ private WireArrayInput outI;
public XorGate(int processTime, WireArray a, WireArray b, WireArray out)
{
public XorGate(int processTime, WireArray a, WireArray b, WireArray out)
{
@@
-20,7
+26,7
@@
public class XorGate extends BasicComponent
protected void compute()
{
protected void compute()
{
- out.feedSignals(Util.xor(a.getValues(), b.getValues()));
+ out
I
.feedSignals(Util.xor(a.getValues(), b.getValues()));
}
public WireArray getA()
}
public WireArray getA()
@@
-37,4
+43,16
@@
public class XorGate 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));
+ }
}
}