use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class VHDLGeneratorTest method testSplitter3.
public void testSplitter3() throws PinException, NodeException, ElementNotFoundException, IOException {
ToBreakRunner br = new ToBreakRunner("dig/hdl/model2/splitter3.dig");
CodePrinterStr out = new CodePrinterStr();
VHDLGenerator gen = new VHDLGenerator(br.getLibrary(), out).export(br.getCircuit());
assertEquals("-- generated by Digital. Don't modify this file!\n" + "-- Any changes will be lost if this file is regenerated.\n" + "\n" + "LIBRARY ieee;\n" + "USE ieee.std_logic_1164.all;\n" + "USE ieee.numeric_std.all;\n" + "\n" + "entity main is\n" + " port (\n" + " A: in std_logic_vector(3 downto 0);\n" + " B: in std_logic_vector(3 downto 0);\n" + " S: out std_logic_vector(3 downto 0));\n" + "end main;\n" + "\n" + "architecture Behavioral of main is\n" + "begin\n" + " S(1 downto 0) <= (A(1 downto 0) AND B(1 downto 0));\n" + " S(3 downto 2) <= (A(3 downto 2) OR B(3 downto 2));\n" + "end Behavioral;\n", out.toString());
}
use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class CycleDetectorTest method testCycles.
public void testCycles() throws Exception {
for (String name : nameTableSequential) {
Model model = new ToBreakRunner("../../main/dig/sequential/" + name, false).getModel();
try {
new ModelAnalyser(model).analyse();
fail("in " + name + " cycle detection failes!");
} catch (CycleDetector.CycleException e) {
assertTrue(true);
}
}
}
use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class DependencyAnalyserTest method testSplitter.
public void testSplitter() throws Exception {
Model model = new ToBreakRunner("dig/backtrack/Splitter.dig").getModel();
ModelAnalyser m = new ModelAnalyser(model);
DependencyAnalyser da = new DependencyAnalyser(m);
assertEquals(2, m.getOutputs().size());
assertEquals(1, da.getInputs(m.getOutputs().get(0)).size());
assertEquals(1, da.getInputs(m.getOutputs().get(1)).size());
}
use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class DependencyAnalyserTest method testBacktrackCompleteness.
public void testBacktrackCompleteness() throws Exception {
ToBreakRunner toBreakRunner = new ToBreakRunner("dig/backtrack/AllComponents.dig", false);
// create a set of all components used in the circuit
Circuit circuit = toBreakRunner.getCircuit();
Set<String> set = new HashSet<>();
for (VisualElement e : circuit.getElements()) set.add(e.getElementName());
// ensure all available components are included in test circuit
for (ElementLibrary.ElementContainer c : toBreakRunner.getLibrary()) {
if (!set.contains(c.getDescription().getName())) {
// nodes with state are allowed to be missing
Element n = c.getDescription().createElement(new ElementAttributes());
boolean ok = (n instanceof Node) && ((Node) n).hasState();
assertTrue("component " + c.getDescription().getName() + " is missing in test/resources/dig/backtrack/AllComponents.dig!", ok);
}
}
// check if backtracking is ok at all components!
ModelAnalyser m = new ModelAnalyser(toBreakRunner.getModel());
new DependencyAnalyser(m);
}
use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class DependencyAnalyserTest method testAnalyzer.
public void testAnalyzer() throws Exception {
Model model = new ToBreakRunner("dig/backtrack/Plexer.dig").getModel();
ModelAnalyser m = new ModelAnalyser(model);
DependencyAnalyser da = new DependencyAnalyser(m);
assertEquals(17, m.getInputs().size());
assertEquals(26, m.getOutputs().size());
for (int i = 0; i < m.getOutputs().size(); i++) assertEquals("" + i, VAL[i], da.getInputs(m.getOutputs().get(i)).size());
}
Aggregations