Search in sources :

Example 76 with ObservableValue

use of de.neemann.digital.core.ObservableValue 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 77 with ObservableValue

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

the class FlipflopDTest method testFlipFlop.

public void testFlipFlop() throws Exception {
    ObservableValue d = new ObservableValue("d", 8);
    ObservableValue c = new ObservableValue("c", 1);
    Model model = new Model();
    FlipflopD out = model.add(new FlipflopD(new ElementAttributes().setBits(8)));
    out.setInputs(ovs(d, c));
    TestExecuter sc = new TestExecuter(model).setInputs(d, c).setOutputs(out.getOutputs());
    // D  C  Q  ~Q
    sc.check(0, 0, 0, 255);
    sc.check(1, 0, 0, 255);
    sc.check(1, 1, 1, 254);
    sc.check(1, 0, 1, 254);
    sc.check(0, 0, 1, 254);
    sc.check(7, 0, 1, 254);
    sc.check(7, 1, 7, 248);
}
Also used : ObservableValue(de.neemann.digital.core.ObservableValue) Model(de.neemann.digital.core.Model) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) TestExecuter(de.neemann.digital.TestExecuter)

Example 78 with ObservableValue

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

the class FlipflopJKAsyncTest method testFlipFlop.

public void testFlipFlop() throws Exception {
    ObservableValue set = new ObservableValue("set", 1);
    ObservableValue j = new ObservableValue("j", 1);
    ObservableValue c = new ObservableValue("c", 1);
    ObservableValue k = new ObservableValue("k", 1);
    ObservableValue clr = new ObservableValue("clr", 1);
    Model model = new Model();
    FlipflopJKAsync out = model.add(new FlipflopJKAsync(new ElementAttributes()));
    out.setInputs(ovs(set, j, c, k, clr));
    TestExecuter sc = new TestExecuter(model).setInputs(set, j, c, k, clr).setOutputs(out.getOutputs());
    // Set J  C  K  clr Q  ~Q
    sc.check(0, 0, 0, 0, 0, 0, 1);
    sc.check(0, 0, 0, 0, 0, 0, 1);
    sc.check(0, 1, 0, 0, 0, 0, 1);
    sc.check(0, 0, 1, 0, 0, 0, 1);
    sc.check(0, 1, 0, 0, 0, 0, 1);
    sc.check(0, 1, 1, 0, 0, 1, 0);
    sc.check(0, 1, 0, 1, 0, 1, 0);
    sc.check(0, 1, 1, 1, 0, 0, 1);
    sc.check(0, 1, 0, 1, 0, 0, 1);
    sc.check(0, 1, 1, 1, 0, 1, 0);
    sc.check(0, 0, 0, 1, 0, 1, 0);
    sc.check(0, 0, 1, 1, 0, 0, 1);
    sc.check(0, 0, 0, 0, 0, 0, 1);
    // async
    sc.check(1, 0, 0, 0, 0, 1, 0);
    sc.check(0, 0, 0, 0, 0, 1, 0);
    sc.check(0, 0, 0, 0, 1, 0, 1);
    sc.check(0, 0, 0, 0, 0, 0, 1);
}
Also used : ObservableValue(de.neemann.digital.core.ObservableValue) Model(de.neemann.digital.core.Model) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) TestExecuter(de.neemann.digital.TestExecuter)

Example 79 with ObservableValue

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

the class FlipflopJKTest method testFlipFlop.

public void testFlipFlop() throws Exception {
    ObservableValue j = new ObservableValue("j", 1);
    ObservableValue c = new ObservableValue("c", 1);
    ObservableValue k = new ObservableValue("k", 1);
    Model model = new Model();
    FlipflopJK out = model.add(new FlipflopJK(new ElementAttributes()));
    out.setInputs(ovs(j, c, k));
    TestExecuter sc = new TestExecuter(model).setInputs(j, c, k).setOutputs(out.getOutputs());
    // J  C  K  Q  ~Q
    sc.check(0, 0, 0, 0, 1);
    sc.check(0, 0, 0, 0, 1);
    sc.check(1, 0, 0, 0, 1);
    sc.check(0, 1, 0, 0, 1);
    sc.check(1, 0, 0, 0, 1);
    sc.check(1, 1, 0, 1, 0);
    sc.check(1, 0, 1, 1, 0);
    sc.check(1, 1, 1, 0, 1);
    sc.check(1, 0, 1, 0, 1);
    sc.check(1, 1, 1, 1, 0);
    sc.check(0, 0, 1, 1, 0);
    sc.check(0, 1, 1, 0, 1);
    sc.check(0, 0, 0, 0, 1);
}
Also used : ObservableValue(de.neemann.digital.core.ObservableValue) Model(de.neemann.digital.core.Model) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) TestExecuter(de.neemann.digital.TestExecuter)

Example 80 with ObservableValue

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

the class FlipflopTTest method testFlipFlop.

public void testFlipFlop() throws Exception {
    ObservableValue c = new ObservableValue("c", 1);
    Model model = new Model();
    FlipflopT out = model.add(new FlipflopT(new ElementAttributes().setBits(1).set(Keys.WITH_ENABLE, false)));
    out.setInputs(c.asList());
    TestExecuter sc = new TestExecuter(model).setInputs(c).setOutputs(out.getOutputs());
    // C  Q  ~Q
    sc.check(0, 0, 1);
    sc.check(1, 1, 0);
    sc.check(1, 1, 0);
    sc.check(0, 1, 0);
    sc.check(0, 1, 0);
    sc.check(1, 0, 1);
    sc.check(0, 0, 1);
}
Also used : 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

ObservableValue (de.neemann.digital.core.ObservableValue)88 ElementAttributes (de.neemann.digital.core.element.ElementAttributes)73 TestExecuter (de.neemann.digital.TestExecuter)61 Model (de.neemann.digital.core.Model)56 ObservableValues (de.neemann.digital.core.ObservableValues)17 NodeException (de.neemann.digital.core.NodeException)5 ArrayList (java.util.ArrayList)4 BitsException (de.neemann.digital.core.BitsException)3 FanIn (de.neemann.digital.core.basic.FanIn)3 Signal (de.neemann.digital.core.Signal)2 Element (de.neemann.digital.core.element.Element)2 Clock (de.neemann.digital.core.wiring.Clock)2 Delay (de.neemann.digital.core.wiring.Delay)2 DataBus (de.neemann.digital.core.wiring.bus.DataBus)2 IOState (de.neemann.digital.draw.elements.IOState)2 CircuitComponent (de.neemann.digital.gui.components.CircuitComponent)2 Sync (de.neemann.digital.gui.sync.Sync)2 BurnException (de.neemann.digital.core.BurnException)1 Node (de.neemann.digital.core.Node)1 NodeWithoutDelay (de.neemann.digital.core.NodeWithoutDelay)1