projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge logic of origin into logic
[Mograsim.git]
/
era.mi
/
src
/
era
/
mi
/
logic
/
tests
/
Connector.java
diff --git
a/era.mi/src/era/mi/logic/tests/Connector.java
b/era.mi/src/era/mi/logic/tests/Connector.java
index
d59ee8c
..
39645bf
100644
(file)
--- a/
era.mi/src/era/mi/logic/tests/Connector.java
+++ b/
era.mi/src/era/mi/logic/tests/Connector.java
@@
-1,38
+1,39
@@
package era.mi.logic.tests;
package era.mi.logic.tests;
+import era.mi.logic.Bit;
import era.mi.logic.Simulation;
import era.mi.logic.Simulation;
-import era.mi.logic.wires.Wire
Array
;
-import era.mi.logic.wires.Wire
Array.WireArrayInput
;
-import era.mi.logic.wires.Wire
Array
Observer;
+import era.mi.logic.wires.Wire;
+import era.mi.logic.wires.Wire
.WireEnd
;
+import era.mi.logic.wires.WireObserver;
-public class Connector implements Wire
Array
Observer
+public class Connector implements WireObserver
{
{
- private final Wire
Array
a;
-
private final WireArray b;
- private final Wire
ArrayInput
aI;
- private final Wire
ArrayInput
bI;
+ private final Wire a;
+
//
private final WireArray b;
+ private final Wire
End
aI;
+ private final Wire
End
bI;
- public Connector(Wire
Array a, WireArray
b)
+ public Connector(Wire
a, Wire
b)
{
if (a.length != b.length)
{
if (a.length != b.length)
- throw new IllegalArgumentException(
"WireArray width does not match: " + a.length + ", " + b.length
);
+ throw new IllegalArgumentException(
String.format("WireArray width does not match: %d, %d", a.length, b.length)
);
this.a = a;
this.a = a;
-
this.b = b;
+
//
this.b = b;
a.addObserver(this);
b.addObserver(this);
a.addObserver(this);
b.addObserver(this);
- aI = a.create
Input
();
- bI = b.create
Input
();
+ aI = a.create
End
();
+ bI = b.create
End
();
}
@Override
}
@Override
- public void update(Wire
Array initiator
)
+ public void update(Wire
initiator, Bit[] oldValues
)
{
Simulation.TIMELINE.addEvent((e) ->
{
if (initiator == a)
{
Simulation.TIMELINE.addEvent((e) ->
{
if (initiator == a)
- bI.feedSignals(a
.getValues
());
+ bI.feedSignals(a
I.wireValuesExcludingMe
());
else
else
- aI.feedSignals(b
.getValues
());
+ aI.feedSignals(b
I.wireValuesExcludingMe
());
}, 1);
}
}
}, 1);
}
}