The fusion of Wires caused an exception upon updating Wire values, if
one of the fused Wires had no inputs, other than the Wire it was fused
with.
The Connector Component still has this issue.
{\r
t.reset();\r
Wire a = new Wire(t, 3, 1), b = new Wire(t, 2, 1), c = new Wire(t, 3, 1), out = new Wire(t, 8, 1);\r
{\r
t.reset();\r
Wire a = new Wire(t, 3, 1), b = new Wire(t, 2, 1), c = new Wire(t, 3, 1), out = new Wire(t, 8, 1);\r
assertBitArrayEquals(rC.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO);\r
}\r
\r
assertBitArrayEquals(rC.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO);\r
}\r
\r
+ @Test\r
+ void fusionTest2()\r
+ {\r
+ t.reset();\r
+ Wire a = new Wire(t, 3, 1), b = new Wire(t, 3, 1);\r
+ Wire.fuse(a, b);\r
+ a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.U, Bit.Z);\r
+ t.executeAll();\r
+ assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.U, Bit.Z);\r
+ }\r
+\r
@Test\r
void triStateBufferTest()\r
{\r
@Test\r
void triStateBufferTest()\r
{\r
\r
TestBitDisplay test = new TestBitDisplay(t, c.createReadOnlyEnd());\r
TestBitDisplay test2 = new TestBitDisplay(t, a.createReadOnlyEnd());\r
\r
TestBitDisplay test = new TestBitDisplay(t, c.createReadOnlyEnd());\r
TestBitDisplay test2 = new TestBitDisplay(t, a.createReadOnlyEnd());\r
- LongConsumer print = time -> System.out.format("Time %2d\n a: %s\n b: %s\n c: %s\n", time, a, b, c);\r
+ LongConsumer print = time -> System.out.format("Time %2d\n a: %s\n b: %s\n c: %s\n", time, a, b, c);\r
\r
cI.feedSignals(Bit.ONE);\r
test.assertAfterSimulationIs(print, Bit.ONE);\r
\r
cI.feedSignals(Bit.ONE);\r
test.assertAfterSimulationIs(print, Bit.ONE);\r
@Override\r
public void update(LogicObservable initiator)\r
{\r
@Override\r
public void update(LogicObservable initiator)\r
{\r
- ReadWriteEnd read = (ReadWriteEnd) initiator;\r
- target.setValues(fromTarget, read.wireValuesExcludingMe().subVector(fromSource, fromSource + length));\r
+ ReadWriteEnd source = (ReadWriteEnd) initiator;\r
+ BitVector targetInput = (source.getWire().inputs.size() > 1)\r
+ ? source.wireValuesExcludingMe().subVector(fromSource, fromSource + length)\r
+ : BitVector.of(Bit.Z, length);\r
+ target.setValues(fromTarget, targetInput);\r
}\r
}\r
}
\ No newline at end of file
}\r
}\r
}
\ No newline at end of file