Search in sources :

Example 6 with ToBreakRunner

use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.

the class DependencyAnalyserTest method testInputInvert.

/*
ExpressionCreator - p0n+1 reduced from 17 to 1 variables ([Count])
ExpressionCreator - p1n+1 reduced from 17 to 1 variables ([p0n])
ExpressionCreator - Q_1n+1 reduced from 17 to 1 variables ([Q_0n])
ExpressionCreator - Q_0n+1 reduced from 17 to 2 variables ([Q_1n, Q_0n])
ExpressionCreator - C0Q_3n+1 reduced from 17 to 6 variables ([p0n, p1n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n])
ExpressionCreator - C0Q_2n+1 reduced from 17 to 5 variables ([p0n, p1n, C0Q_2n, C0Q_1n, C0Q_0n])
ExpressionCreator - C0Q_1n+1 reduced from 17 to 5 variables ([p0n, p1n, C0Q_3n, C0Q_1n, C0Q_0n])
ExpressionCreator - C0Q_0n+1 reduced from 17 to 3 variables ([p0n, p1n, C0Q_0n])
ExpressionCreator - C1Q_3n+1 reduced from 17 to 8 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n])
ExpressionCreator - C1Q_2n+1 reduced from 17 to 7 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_2n, C1Q_1n, C1Q_0n])
ExpressionCreator - C1Q_1n+1 reduced from 17 to 7 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_3n, C1Q_1n, C1Q_0n])
ExpressionCreator - C1Q_0n+1 reduced from 17 to 5 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_0n])
ExpressionCreator - C2Q_3n+1 reduced from 17 to 10 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_3n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - C2Q_2n+1 reduced from 17 to 9 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_3n, C1Q_0n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - C2Q_1n+1 reduced from 17 to 9 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_3n, C1Q_0n, C2Q_3n, C2Q_1n, C2Q_0n])
ExpressionCreator - C2Q_0n+1 reduced from 17 to 7 variables ([p0n, p1n, C0Q_3n, C0Q_0n, C1Q_3n, C1Q_0n, C2Q_0n])
ExpressionCreator - s2 reduced from 17 to 2 variables ([Q_1n, Q_0n])
ExpressionCreator - d0 reduced from 17 to 14 variables ([Q_1n, Q_0n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - c0 reduced from 17 to 14 variables ([Q_1n, Q_0n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - b0 reduced from 17 to 14 variables ([Q_1n, Q_0n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - a0 reduced from 17 to 14 variables ([Q_1n, Q_0n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - e0 reduced from 17 to 14 variables ([Q_1n, Q_0n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - f0 reduced from 17 to 14 variables ([Q_1n, Q_0n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - g0 reduced from 17 to 14 variables ([Q_1n, Q_0n, C0Q_3n, C0Q_2n, C0Q_1n, C0Q_0n, C1Q_3n, C1Q_2n, C1Q_1n, C1Q_0n, C2Q_3n, C2Q_2n, C2Q_1n, C2Q_0n])
ExpressionCreator - s1 reduced from 17 to 2 variables ([Q_1n, Q_0n])
ExpressionCreator - s0 reduced from 17 to 2 variables ([Q_1n, Q_0n])
 */
public void testInputInvert() throws Exception {
    Model model = new ToBreakRunner("dig/backtrack/InputInvert.dig").getModel();
    ModelAnalyser m = new ModelAnalyser(model);
    DependencyAnalyser da = new DependencyAnalyser(m);
    assertEquals(1, m.getOutputs().size());
    Signal out = m.getOutputs().get(0);
    ArrayList<Signal> inputs = da.getInputs(out);
    assertEquals(2, inputs.size());
}
Also used : ToBreakRunner(de.neemann.digital.integration.ToBreakRunner)

Example 7 with ToBreakRunner

use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.

the class ModelAnalyserTest method testAnalyzer.

public void testAnalyzer() throws Exception {
    Model model = new ToBreakRunner("dig/analyze/analyzeTest.dig").getModel();
    TruthTable tt = new ModelAnalyser(model).analyse();
    assertEquals(4, tt.getRows());
    assertEquals(3, tt.getCols());
    // circuit is XOr:
    assertEquals(0, tt.getValue(0, 2));
    assertEquals(1, tt.getValue(1, 2));
    assertEquals(1, tt.getValue(2, 2));
    assertEquals(0, tt.getValue(3, 2));
    assertEquals("A\tB\tY\t\n" + "0\t0\t0\t\n" + "0\t1\t1\t\n" + "1\t0\t1\t\n" + "1\t1\t0\t\n", tt.toString());
}
Also used : Model(de.neemann.digital.core.Model) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner)

Example 8 with ToBreakRunner

use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.

the class ModelAnalyserTest method testAnalyzerMultiBit.

public void testAnalyzerMultiBit() throws Exception {
    Model model = new ToBreakRunner("dig/analyze/multiBitCounter.dig", false).getModel();
    TruthTable tt = new ModelAnalyser(model).analyse();
    checkTable(tt.getResult("Q0n+1"), one, zero, one, zero);
    checkTable(tt.getResult("Q1n+1"), zero, one, one, zero);
    assertEquals("Y1", tt.getResultName(2));
    assertEquals("Y0", tt.getResultName(3));
    final BoolTable y1 = tt.getResult(2);
    final BoolTable y0 = tt.getResult(3);
    for (int i = 0; i < 4; i++) {
        assertEquals((i & 1) > 0, y0.get(i).invert().bool());
        assertEquals((i & 2) > 0, y1.get(i).invert().bool());
    }
}
Also used : BoolTable(de.neemann.digital.analyse.quinemc.BoolTable) Model(de.neemann.digital.core.Model) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner)

Example 9 with ToBreakRunner

use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.

the class ModelAnalyserTest method testAnalyzerMultiBit3.

// test with non zero default values set
public void testAnalyzerMultiBit3() throws Exception {
    Model model = new ToBreakRunner("dig/analyze/multiBitInOutDef.dig", false).getModel();
    TruthTable tt = new ModelAnalyser(model).analyse();
    checkIdent(tt);
}
Also used : Model(de.neemann.digital.core.Model) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner)

Example 10 with ToBreakRunner

use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.

the class ModelAnalyserTest method testAnalyzerDFF.

public void testAnalyzerDFF() throws Exception {
    Model model = new ToBreakRunner("dig/analyze/analyzeTestDFF.dig").getModel();
    TruthTable tt = new ModelAnalyser(model).analyse();
    check2BitCounter(tt);
}
Also used : Model(de.neemann.digital.core.Model) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner)

Aggregations

ToBreakRunner (de.neemann.digital.integration.ToBreakRunner)29 Model (de.neemann.digital.core.Model)16 CodePrinterStr (de.neemann.digital.hdl.printer.CodePrinterStr)6 VisualElement (de.neemann.digital.draw.elements.VisualElement)3 BoolTable (de.neemann.digital.analyse.quinemc.BoolTable)2 Signal (de.neemann.digital.core.Signal)2 Circuit (de.neemann.digital.draw.elements.Circuit)2 HDLCircuit (de.neemann.digital.hdl.model2.HDLCircuit)2 HDLModel (de.neemann.digital.hdl.model2.HDLModel)2 CodePrinter (de.neemann.digital.hdl.printer.CodePrinter)2 File (java.io.File)2 ModelAnalyser (de.neemann.digital.analyse.ModelAnalyser)1 TruthTable (de.neemann.digital.analyse.TruthTable)1 Element (de.neemann.digital.core.element.Element)1 ElementAttributes (de.neemann.digital.core.element.ElementAttributes)1 ElementLibrary (de.neemann.digital.draw.library.ElementLibrary)1 BuilderExpressionCreator (de.neemann.digital.gui.components.table.BuilderExpressionCreator)1 ExpressionCreator (de.neemann.digital.gui.components.table.ExpressionCreator)1 ExpressionListenerStore (de.neemann.digital.gui.components.table.ExpressionListenerStore)1 TestCaseDescription (de.neemann.digital.testing.TestCaseDescription)1