use of de.neemann.digital.hdl.printer.CodePrinterStr in project Digital by hneemann.
the class HDLModelTest method testSimple2.
public void testSimple2() throws IOException, PinException, HDLException, NodeException, ElementNotFoundException {
HDLCircuit hdl = getCircuit("dig/hdl/model2/comb2.dig", null).applyDefaultOptimizations();
CodePrinterStr cp = new CodePrinterStr();
hdl.print(cp);
assertEquals("circuit main\n" + " in(A:1 defines (A->1), B:1 defines (B->1), C:1 defines (C->1))\n" + " out(Y:1 reads (Y->1))\n" + " sig()\n" + "\n" + " node merged expression\n" + " in(In_2:1 reads (C->1), In_1:1 reads (A->1), In_2:1 reads (B->1))\n" + " out(out:1 defines (Y->1))\n" + " Y->1 := ((A AND B) OR C)\n" + "\n" + "end circuit main\n", cp.toString());
}
use of de.neemann.digital.hdl.printer.CodePrinterStr in project Digital by hneemann.
the class HDLModelTest method testSplitter.
public void testSplitter() throws IOException, PinException, HDLException, NodeException, ElementNotFoundException {
HDLCircuit hdl = getCircuit("dig/hdl/model2/splitter.dig", null).applyDefaultOptimizations();
CodePrinterStr cp = new CodePrinterStr();
hdl.print(cp);
assertEquals("circuit main\n" + " in(A:4 defines (A->1))\n" + " out(X:2 reads (X->1))\n" + " sig()\n" + "\n" + " node merged expression\n" + " in(in:4 reads (A->1))\n" + " out(out:2 defines (X->1))\n" + " X->1 := (A(1-0) AND NOT A(3-2))\n" + "\n" + "end circuit main\n", cp.toString());
}
use of de.neemann.digital.hdl.printer.CodePrinterStr in project Digital by hneemann.
the class HDLModelTest method testSplitter3.
public void testSplitter3() throws IOException, PinException, HDLException, NodeException, ElementNotFoundException {
HDLCircuit hdl = getCircuit("dig/hdl/model2/splitter3.dig", null).apply(new ReplaceOneToMany()).apply(new MergeAssignements()).apply(new NodeSorterExpressionBased()).nameUnnamedSignals();
CodePrinterStr cp = new CodePrinterStr();
hdl.print(cp);
assertEquals("circuit main\n" + " in(A:4 defines (A->2), B:4 defines (B->2))\n" + " out(S:4 reads (S->1))\n" + " sig(s0->1, s1->1)\n" + "\n" + " node merged expression\n" + " in(in:4 reads (A->2), in:4 reads (B->2))\n" + " out(out:2 defines (s0->1))\n" + " s0->1 := (A(1-0) AND B(1-0))\n" + " node merged expression\n" + " in(in:4 reads (A->2), in:4 reads (B->2))\n" + " out(out:2 defines (s1->1))\n" + " s1->1 := (A(3-2) OR B(3-2))\n" + " node Splitter\n" + " in(0,1:2 reads (s0->1), 2,3:2 reads (s1->1))\n" + " out(0-3:4 defines (S->1))\n" + " S(1-0) := s0\n" + " S(3-2) := s1\n" + "\n" + "end circuit main\n", cp.toString());
}
use of de.neemann.digital.hdl.printer.CodePrinterStr in project Digital by hneemann.
the class HDLModelTest method testSplitter2.
public void testSplitter2() throws IOException, PinException, HDLException, NodeException, ElementNotFoundException {
HDLCircuit hdl = getCircuit("dig/hdl/model2/splitter2.dig", null).applyDefaultOptimizations();
CodePrinterStr cp = new CodePrinterStr();
hdl.print(cp);
assertEquals("circuit main\n" + " in(A:2 defines (A->1), B:2 defines (B->1))\n" + " out(X:1 reads (X->1), Y:3 reads (Y->1))\n" + " sig(s0->2)\n" + "\n" + " node Splitter\n" + " in(0,1:2 reads (A->1), 2,3:2 reads (B->1))\n" + " out(single:4 defines (s0->2))\n" + " s0(1-0) := A\n" + " s0(3-2) := B\n" + " node splitter\n" + " in(in:4 reads (s0->2))\n" + " out(0:1 defines (X->1))\n" + " X->1 := s0(0-0)\n" + " node splitter\n" + " in(in:4 reads (s0->2))\n" + " out(1-3:3 defines (Y->1))\n" + " Y->1 := s0(3-1)\n" + "\n" + "end circuit main\n", cp.toString());
}
use of de.neemann.digital.hdl.printer.CodePrinterStr in project Digital by hneemann.
the class HDLModelTest method testInputInvert.
public void testInputInvert() throws IOException, PinException, HDLException, NodeException, ElementNotFoundException {
HDLCircuit hdl = getCircuit("dig/hdl/model2/inputInvert.dig", null).applyDefaultOptimizations();
CodePrinterStr cp = new CodePrinterStr();
hdl.print(cp);
assertEquals("circuit main\n" + " in(A:1 defines (A->1), B:1 defines (B->1), C:1 defines (C->1))\n" + " out(Y:1 reads (Y->1))\n" + " sig()\n" + "\n" + " node merged expression\n" + " in(In_2:1 reads (B->1), In_3:1 reads (C->1), In_1:1 reads (A->1))\n" + " out(out:1 defines (Y->1))\n" + " Y->1 := ((A AND NOT B) OR B OR C)\n" + "\n" + "end circuit main\n", cp.toString());
}
Aggregations