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);
}
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);
}
Aggregations