import era.mi.logic.components.gates.OrGate;\r
import era.mi.logic.components.gates.XorGate;\r
import era.mi.logic.wires.WireArray;\r
-import era.mi.logic.wires.WireArray.WireArrayInput;\r
+import era.mi.logic.wires.WireArray.WireArrayEnd;\r
\r
-class ComponentTest {\r
+class ComponentTest\r
+{\r
\r
@Test\r
- void circuitExampleTest() {\r
+ void circuitExampleTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(1, 1), b = new WireArray(1, 1), c = new WireArray(1, 10), d = new WireArray(2, 1),\r
e = new WireArray(1, 1), f = new WireArray(1, 1), g = new WireArray(1, 1), h = new WireArray(2, 1), i = new WireArray(2, 1),\r
}\r
\r
@Test\r
- void splitterTest() {\r
+ void splitterTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(3, 1), b = new WireArray(2, 1), c = new WireArray(3, 1), in = new WireArray(8, 1);\r
in.createInput().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);\r
}\r
\r
@Test\r
- void mergerTest() {\r
+ void mergerTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(3, 1), b = new WireArray(2, 1), c = new WireArray(3, 1), out = new WireArray(8, 1);\r
a.createInput().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO);\r
}\r
\r
@Test\r
- void triStateBufferTest() {\r
+ void triStateBufferTest()\r
+ {\r
WireArray a = new WireArray(1, 1), b = new WireArray(1, 1), en = new WireArray(1, 1), notEn = new WireArray(1, 1);\r
new NotGate(1, en, notEn);\r
new TriStateBuffer(1, a, b, en);\r
new TriStateBuffer(1, b, a, notEn);\r
\r
- WireArrayInput enI = en.createInput(), aI = a.createInput(), bI = b.createInput();\r
+ WireArrayEnd enI = en.createInput(), aI = a.createInput(), bI = b.createInput();\r
enI.feedSignals(Bit.ONE);\r
aI.feedSignals(Bit.ONE);\r
\r
}\r
\r
@Test\r
- void muxTest() {\r
+ void muxTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(4, 3), b = new WireArray(4, 6), c = new WireArray(4, 4), select = new WireArray(2, 5),\r
out = new WireArray(4, 1);\r
- WireArrayInput selectIn = select.createInput();\r
+ WireArrayEnd selectIn = select.createInput();\r
\r
selectIn.feedSignals(Bit.ZERO, Bit.ZERO);\r
a.createInput().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);\r
}\r
\r
@Test\r
- void demuxTest() {\r
+ void demuxTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(4, 3), b = new WireArray(4, 6), c = new WireArray(4, 4), select = new WireArray(2, 5),\r
in = new WireArray(4, 1);\r
- WireArrayInput selectIn = select.createInput();\r
+ WireArrayEnd selectIn = select.createInput();\r
\r
selectIn.feedSignals(Bit.ZERO, Bit.ZERO);\r
in.createInput().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);\r
Simulation.TIMELINE.executeAll();\r
\r
assertBitArrayEquals(a.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);\r
- assertBitArrayEquals(b.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);\r
- assertBitArrayEquals(c.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);\r
+ assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);\r
+ assertBitArrayEquals(c.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);\r
selectIn.feedSignals(Bit.ZERO, Bit.ONE);\r
Simulation.TIMELINE.executeAll();\r
\r
assertBitArrayEquals(a.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);\r
- assertBitArrayEquals(b.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);\r
+ assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);\r
assertBitArrayEquals(c.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);\r
\r
selectIn.feedSignals(Bit.ONE, Bit.ONE);\r
Simulation.TIMELINE.executeAll();\r
\r
assertBitArrayEquals(a.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);\r
- assertBitArrayEquals(b.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);\r
+ assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);\r
assertBitArrayEquals(c.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);\r
\r
}\r
\r
@Test\r
- void andTest() {\r
+ void andTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(4, 1), b = new WireArray(4, 3), c = new WireArray(4, 1);\r
new AndGate(1, c, a, b);\r
}\r
\r
@Test\r
- void orTest() {\r
+ void orTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(4, 1), b = new WireArray(4, 3), c = new WireArray(4, 1);\r
new OrGate(1, c, a, b);\r
}\r
\r
@Test\r
- void xorTest() {\r
+ void xorTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(3, 1), b = new WireArray(3, 2), c = new WireArray(3, 1), d = new WireArray(3, 1);\r
new XorGate(1, d, a, b, c);\r
}\r
\r
@Test\r
- void rsLatchCircuitTest() {\r
+ void rsLatchCircuitTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray r = new WireArray(1, 1), s = new WireArray(1, 1), t1 = new WireArray(1, 15), t2 = new WireArray(1, 1),\r
q = new WireArray(1, 1), nq = new WireArray(1, 1);\r
new NotGate(1, t2, q);\r
new NotGate(1, t1, nq);\r
\r
- WireArrayInput sIn = s.createInput(), rIn = r.createInput();\r
+ WireArrayEnd sIn = s.createInput(), rIn = r.createInput();\r
\r
sIn.feedSignals(Bit.ONE);\r
rIn.feedSignals(Bit.ZERO);\r
}\r
\r
@Test\r
- void numericValueTest() {\r
+ void numericValueTest()\r
+ {\r
Simulation.TIMELINE.reset();\r
\r
WireArray a = new WireArray(4, 1);\r
}\r
\r
@Test\r
- void multipleInputs() {\r
+ void multipleInputs()\r
+ {\r
Simulation.TIMELINE.reset();\r
WireArray w = new WireArray(2, 1);\r
- WireArrayInput wI1 = w.createInput(), wI2 = w.createInput();\r
+ WireArrayEnd wI1 = w.createInput(), wI2 = w.createInput();\r
wI1.feedSignals(Bit.ONE, Bit.Z);\r
wI2.feedSignals(Bit.Z, Bit.X);\r
Simulation.TIMELINE.executeAll();\r
assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.Z);\r
}\r
\r
- @Test\r
- void wireConnections() {\r
+// @Test\r
+ void wireConnections()\r
+ {\r
// Nur ein Experiment, was über mehrere 'passive' Bausteine hinweg passieren würde\r
\r
Simulation.TIMELINE.reset();\r
WireArray a = new WireArray(1, 2);\r
WireArray b = new WireArray(1, 2);\r
WireArray c = new WireArray(1, 2);\r
- WireArrayInput aI = a.createInput();\r
- WireArrayInput bI = b.createInput();\r
- WireArrayInput cI = c.createInput();\r
+ WireArrayEnd aI = a.createInput();\r
+ WireArrayEnd bI = b.createInput();\r
+ WireArrayEnd cI = c.createInput();\r
\r
TestBitDisplay test = new TestBitDisplay(c);\r
TestBitDisplay test2 = new TestBitDisplay(a);\r
test2.assertAfterSimulationIs(Bit.ONE);\r
}\r
\r
- private static void assertBitArrayEquals(Bit[] actual, Bit... expected) {\r
+ private static void assertBitArrayEquals(Bit[] actual, Bit... expected)\r
+ {\r
assertArrayEquals(expected, actual);\r
}\r
}\r