Search in sources :

Example 21 with ObservableValues

use of de.neemann.digital.core.ObservableValues in project Digital by hneemann.

the class SplitterHighZTest method testHighZError.

public void testHighZError() throws NodeException, PinException {
    ObservableValue a = new ObservableValue("a", 1).setToHighZ();
    ObservableValue b = new ObservableValue("b", 1);
    Splitter splitter = new Splitter(new ElementAttributes().set(Keys.INPUT_SPLIT, "1,1").set(Keys.OUTPUT_SPLIT, "2"));
    splitter.setInputs(ovs(a, b));
    ObservableValues outputs = splitter.getOutputs();
    assertEquals(1, outputs.size());
    TestExecuter sc = new TestExecuter().setInputs(a, b).setOutputsOf(splitter);
    sc.check(0, 0, 0);
    sc.check(0, 1, 2);
    sc.check(1, 0, 1);
    sc.check(1, 1, 3);
    sc.checkZ(HIGHZ, HIGHZ, HIGHZ);
}
Also used : ObservableValues(de.neemann.digital.core.ObservableValues) ObservableValue(de.neemann.digital.core.ObservableValue) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) TestExecuter(de.neemann.digital.TestExecuter)

Example 22 with ObservableValues

use of de.neemann.digital.core.ObservableValues in project Digital by hneemann.

the class FlipflopTTest method testFlipFlopWithEnable.

public void testFlipFlopWithEnable() throws Exception {
    ObservableValue t = new ObservableValue("t", 1);
    ObservableValue c = new ObservableValue("c", 1);
    Model model = new Model();
    FlipflopT out = model.add(new FlipflopT(new ElementAttributes().setBits(1).set(Keys.WITH_ENABLE, true)));
    out.setInputs(new ObservableValues(t, c));
    TestExecuter sc = new TestExecuter(model).setInputs(t, c).setOutputs(out.getOutputs());
    // T  C  Q  ~Q
    sc.check(1, 0, 0, 1);
    sc.check(1, 1, 1, 0);
    sc.check(1, 1, 1, 0);
    sc.check(1, 0, 1, 0);
    sc.check(1, 0, 1, 0);
    sc.check(1, 1, 0, 1);
    sc.check(1, 0, 0, 1);
    sc.check(0, 1, 0, 1);
    sc.check(0, 0, 0, 1);
    sc.check(0, 1, 0, 1);
    sc.check(0, 0, 0, 1);
    sc.check(1, 1, 1, 0);
    sc.check(0, 0, 1, 0);
    sc.check(0, 1, 1, 0);
    sc.check(0, 0, 1, 0);
}
Also used : ObservableValues(de.neemann.digital.core.ObservableValues) ObservableValue(de.neemann.digital.core.ObservableValue) Model(de.neemann.digital.core.Model) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) TestExecuter(de.neemann.digital.TestExecuter)

Aggregations

ObservableValues (de.neemann.digital.core.ObservableValues)22 ObservableValue (de.neemann.digital.core.ObservableValue)17 TestExecuter (de.neemann.digital.TestExecuter)16 ElementAttributes (de.neemann.digital.core.element.ElementAttributes)16 Model (de.neemann.digital.core.Model)3 BitsException (de.neemann.digital.core.BitsException)1 NodeException (de.neemann.digital.core.NodeException)1 PinDescription (de.neemann.digital.core.element.PinDescription)1 ArrayList (java.util.ArrayList)1