From b593cf1c729f2342aa21a1f3497cd0ab1020cb73 Mon Sep 17 00:00:00 2001 From: hneemann Date: Sun, 11 Jun 2017 14:26:35 +0200 Subject: [PATCH] added backtracking. Is needed to determine the input signals, a output signal depends on. --- .../digital/analyse/DependencyAnalyser.java | 69 + .../digital/analyse/ModelAnalyser.java | 37 +- .../digital/core/BackTracException.java | 17 + .../java/de/neemann/digital/core/Model.java | 4 +- .../java/de/neemann/digital/core/Node.java | 2 +- .../neemann/digital/core/NodeInterface.java | 19 + .../digital/core/NodeWithoutDelay.java | 35 + .../de/neemann/digital/core/Observable.java | 7 +- .../neemann/digital/core/ObservableValue.java | 2 +- .../neemann/digital/core/element/Element.java | 2 +- .../de/neemann/digital/core/pld/Diode.java | 2 +- .../digital/core/pld/DiodeForward.java | 2 +- .../digital/core/switching/Switch.java | 2 +- .../neemann/digital/core/wiring/Splitter.java | 53 +- .../digital/draw/model/InverterConfig.java | 8 +- .../components/table/ExpressionCreator.java | 2 +- src/main/resources/lang/lang_de.xml | 2 + src/main/resources/lang/lang_en.xml | 2 + .../analyse/DependencyAnalyserTest.java | 62 + src/test/resources/dig/backTrac/Plexer.dig | 569 ++++++ src/test/resources/dig/backTrac/counter.dig | 1058 +++++++++++ .../resources/dig/backTrac/counter2Bit3.dig | 277 +++ src/test/resources/dig/backTrac/decoder.dig | 1660 +++++++++++++++++ src/test/resources/dig/backTrac/dif.dig | 129 ++ 24 files changed, 3987 insertions(+), 35 deletions(-) create mode 100644 src/main/java/de/neemann/digital/analyse/DependencyAnalyser.java create mode 100644 src/main/java/de/neemann/digital/core/BackTracException.java create mode 100644 src/main/java/de/neemann/digital/core/NodeInterface.java create mode 100644 src/main/java/de/neemann/digital/core/NodeWithoutDelay.java create mode 100644 src/test/java/de/neemann/digital/analyse/DependencyAnalyserTest.java create mode 100644 src/test/resources/dig/backTrac/Plexer.dig create mode 100644 src/test/resources/dig/backTrac/counter.dig create mode 100644 src/test/resources/dig/backTrac/counter2Bit3.dig create mode 100644 src/test/resources/dig/backTrac/decoder.dig create mode 100644 src/test/resources/dig/backTrac/dif.dig diff --git a/src/main/java/de/neemann/digital/analyse/DependencyAnalyser.java b/src/main/java/de/neemann/digital/analyse/DependencyAnalyser.java new file mode 100644 index 000000000..9a42aeba6 --- /dev/null +++ b/src/main/java/de/neemann/digital/analyse/DependencyAnalyser.java @@ -0,0 +1,69 @@ +package de.neemann.digital.analyse; + +import de.neemann.digital.core.*; +import de.neemann.digital.draw.elements.PinException; +import de.neemann.digital.lang.Lang; + +import java.util.*; + +import static de.neemann.digital.core.Model.MAX_LOOP_COUNTER; + +/** + * Used to analyse on which inputs a given output depends. + * So you only have to take into account the inputs, a given outputs + * depends on. + * Created by hneemann on 11.06.17. + */ +public class DependencyAnalyser { + + private final HashMap> sigMap; + + /** + * Creates a new instance + * + * @param modelAnalyser the model analyser + * @throws BackTracException BackTracException + * @throws PinException PinException + */ + public DependencyAnalyser(ModelAnalyser modelAnalyser) throws BackTracException, PinException { + sigMap = new HashMap<>(); + for (Signal s : modelAnalyser.getInputs()) { + Set effected = new HashSet<>(); + backTrac(s.getValue(), effected, MAX_LOOP_COUNTER); + sigMap.put(s, effected); + } + } + + /** + * Returns all inputs the given output depends on + * + * @param output the output to analyse + * @return the list of inputs which effect the given output + */ + public ArrayList getInputs(Signal output) { + ArrayList list = new ArrayList<>(); + for (Map.Entry> e : sigMap.entrySet()) { + if (e.getValue().contains(output.getValue())) { + list.add(e.getKey()); + } + } + return list; + } + + private void backTrac(ObservableValue value, Set effected, int depth) throws PinException, BackTracException { + effected.add(value); + + if (depth < 0) + throw new BackTracException(Lang.get("err_backtracLoopFound")); + + for (de.neemann.digital.core.Observer o : value) { + if ((o instanceof NodeInterface)) { + ObservableValues outputs = ((NodeInterface) o).getOutputs(); + for (ObservableValue co : outputs) + backTrac(co, effected, depth - 1); + } else + throw new BackTracException(Lang.get("err_backtracOf_N_isImpossible", o.getClass().getSimpleName())); + } + } + +} diff --git a/src/main/java/de/neemann/digital/analyse/ModelAnalyser.java b/src/main/java/de/neemann/digital/analyse/ModelAnalyser.java index e5567c74e..20eb37b65 100644 --- a/src/main/java/de/neemann/digital/analyse/ModelAnalyser.java +++ b/src/main/java/de/neemann/digital/analyse/ModelAnalyser.java @@ -84,7 +84,12 @@ public class ModelAnalyser { inputs.add(sig); ObservableValue notQ = ff.getOutputs().get(1); - q.addObserver(() -> notQ.setValue(~q.getValue())); + q.addObserver(new NodeWithoutDelay(notQ) { + @Override + public void hasChanged() { + notQ.setValue(~q.getValue()); + } + }); } if (inputs.size() == 0) @@ -167,10 +172,13 @@ public class ModelAnalyser { final ObservableValue qout = ff.getOutputs().get(0); final ObservableValue nqout = ff.getOutputs().get(1); ObservableValue spq = outsp.getOutputs().get(0); - spq.addObserver(() -> { - final long value = spq.getValue(); - qout.setValue(value); - nqout.setValue(~value); + spq.addObserver(new NodeWithoutDelay(qout, nqout) { + @Override + public void hasChanged() { + final long value = spq.getValue(); + qout.setValue(value); + nqout.setValue(~value); + } }); } catch (NodeException e) { @@ -216,7 +224,12 @@ public class ModelAnalyser { try { Splitter sp = Splitter.createNToOne(bits); final ObservableValue out = sp.getOutputs().get(0); - out.addObserver(() -> s.getValue().setValue(out.getValue())); + out.addObserver(new NodeWithoutDelay(s.getValue()) { + @Override + public void hasChanged() { + s.getValue().setValue(out.getValue()); + } + }); out.fireHasChanged(); ObservableValues.Builder builder = new ObservableValues.Builder(); @@ -338,5 +351,17 @@ public class ModelAnalyser { } } + /** + * @return the models inputs + */ + public ArrayList getInputs() { + return inputs; + } + /** + * @return the models outputs + */ + public ArrayList getOutputs() { + return outputs; + } } diff --git a/src/main/java/de/neemann/digital/core/BackTracException.java b/src/main/java/de/neemann/digital/core/BackTracException.java new file mode 100644 index 000000000..753ece60a --- /dev/null +++ b/src/main/java/de/neemann/digital/core/BackTracException.java @@ -0,0 +1,17 @@ +package de.neemann.digital.core; + +/** + * Indicates an error backtracking a value to all affected values + * Created by hneemann on 11.06.17. + */ +public class BackTracException extends Exception { + + /** + * Creates a new instance + * + * @param message the message + */ + public BackTracException(String message) { + super(message); + } +} diff --git a/src/main/java/de/neemann/digital/core/Model.java b/src/main/java/de/neemann/digital/core/Model.java index 0ea499a38..acae3a3b3 100644 --- a/src/main/java/de/neemann/digital/core/Model.java +++ b/src/main/java/de/neemann/digital/core/Model.java @@ -41,7 +41,7 @@ public class Model implements Iterable { /** * Maximal number of calculation loops before oscillating behaviour is detected */ - private static final int MAX_COUNTER = 1000; + public static final int MAX_LOOP_COUNTER = 1000; private final ArrayList clocks; private final ArrayList breaks; @@ -191,7 +191,7 @@ public class Model implements Iterable { int counter = 0; if (needsUpdate()) { while (needsUpdate()) { - if (counter++ > MAX_COUNTER) { + if (counter++ > MAX_LOOP_COUNTER) { throw new NodeException(Lang.get("err_seemsToOscillate")).addNodes(nodesToUpdateNext); } doMicroStep(noise); diff --git a/src/main/java/de/neemann/digital/core/Node.java b/src/main/java/de/neemann/digital/core/Node.java index 789050a88..c0084a129 100644 --- a/src/main/java/de/neemann/digital/core/Node.java +++ b/src/main/java/de/neemann/digital/core/Node.java @@ -16,7 +16,7 @@ import java.io.File; * * @author hneemann */ -public abstract class Node implements Observer { +public abstract class Node implements NodeInterface { private final boolean hasState; private Model model; diff --git a/src/main/java/de/neemann/digital/core/NodeInterface.java b/src/main/java/de/neemann/digital/core/NodeInterface.java new file mode 100644 index 000000000..7e4ae8909 --- /dev/null +++ b/src/main/java/de/neemann/digital/core/NodeInterface.java @@ -0,0 +1,19 @@ +package de.neemann.digital.core; + +import de.neemann.digital.draw.elements.PinException; + +/** + * The simplest possible node + * Created by hneemann on 11.06.17. + */ +public interface NodeInterface extends Observer { + + /** + * returns the outputs effected by this node + * + * @return the outputs + * @throws PinException PinException + */ + ObservableValues getOutputs() throws PinException; + +} diff --git a/src/main/java/de/neemann/digital/core/NodeWithoutDelay.java b/src/main/java/de/neemann/digital/core/NodeWithoutDelay.java new file mode 100644 index 000000000..b0067158b --- /dev/null +++ b/src/main/java/de/neemann/digital/core/NodeWithoutDelay.java @@ -0,0 +1,35 @@ +package de.neemann.digital.core; + +import de.neemann.digital.draw.elements.PinException; + +/** + * A node which has no delay + * Created by hneemann on 11.06.17. + */ +public abstract class NodeWithoutDelay implements NodeInterface { + + private ObservableValues outputs; + + /** + * Creates a new instance + * + * @param outputs the nodes outputs + */ + public NodeWithoutDelay(ObservableValue... outputs) { + this(new ObservableValues(outputs)); + } + + /** + * Creates a new instance + * + * @param outputs the nodes outputs + */ + public NodeWithoutDelay(ObservableValues outputs) { + this.outputs = outputs; + } + + @Override + public ObservableValues getOutputs() throws PinException { + return outputs; + } +} diff --git a/src/main/java/de/neemann/digital/core/Observable.java b/src/main/java/de/neemann/digital/core/Observable.java index 94f244583..99da67c6a 100644 --- a/src/main/java/de/neemann/digital/core/Observable.java +++ b/src/main/java/de/neemann/digital/core/Observable.java @@ -8,7 +8,7 @@ import java.util.Iterator; * * @author hneemann */ -public class Observable { +public class Observable implements Iterable { private final ArrayList observers; /** @@ -75,4 +75,9 @@ public class Observable { public boolean hasObserver(Observer observer) { return observers.contains(observer); } + + @Override + public Iterator iterator() { + return observers.iterator(); + } } diff --git a/src/main/java/de/neemann/digital/core/ObservableValue.java b/src/main/java/de/neemann/digital/core/ObservableValue.java index bfa019400..4e4bf4ac0 100644 --- a/src/main/java/de/neemann/digital/core/ObservableValue.java +++ b/src/main/java/de/neemann/digital/core/ObservableValue.java @@ -104,7 +104,7 @@ public class ObservableValue extends Observable implements PinDescription { * @return this for chained calls */ public ObservableValue addObserverToValue(Observer observer) { - super.addObserver(observer); + addObserver(observer); return this; } diff --git a/src/main/java/de/neemann/digital/core/element/Element.java b/src/main/java/de/neemann/digital/core/element/Element.java index 5bfeaca2e..e3d01cc79 100644 --- a/src/main/java/de/neemann/digital/core/element/Element.java +++ b/src/main/java/de/neemann/digital/core/element/Element.java @@ -22,7 +22,7 @@ public interface Element { void setInputs(ObservableValues inputs) throws NodeException; /** - * When the connections between the elements are build all outputs a collected + * When the connections between the elements are build, all outputs are collected * by calling this method. After the interconnection they are set to the inputs * by calling setInputs() * diff --git a/src/main/java/de/neemann/digital/core/pld/Diode.java b/src/main/java/de/neemann/digital/core/pld/Diode.java index 085f3ed0b..f0e19b57e 100644 --- a/src/main/java/de/neemann/digital/core/pld/Diode.java +++ b/src/main/java/de/neemann/digital/core/pld/Diode.java @@ -10,7 +10,7 @@ import de.neemann.digital.core.element.Keys; * A diode needed to create wired elements * Used to build a wired OR or AND. */ -public class Diode implements Element, Observer { +public class Diode implements Element, NodeInterface { /** * The diodes description diff --git a/src/main/java/de/neemann/digital/core/pld/DiodeForward.java b/src/main/java/de/neemann/digital/core/pld/DiodeForward.java index 27d60ecb0..7a8e9609b 100644 --- a/src/main/java/de/neemann/digital/core/pld/DiodeForward.java +++ b/src/main/java/de/neemann/digital/core/pld/DiodeForward.java @@ -11,7 +11,7 @@ import static de.neemann.digital.core.element.PinInfo.input; * A diode needed to pull a wire to VDD. * Used to build a wired OR. */ -public class DiodeForward implements Element, Observer { +public class DiodeForward implements Element, NodeInterface { /** * The diodes description diff --git a/src/main/java/de/neemann/digital/core/switching/Switch.java b/src/main/java/de/neemann/digital/core/switching/Switch.java index 1d14a9db1..6dfef5d57 100644 --- a/src/main/java/de/neemann/digital/core/switching/Switch.java +++ b/src/main/java/de/neemann/digital/core/switching/Switch.java @@ -12,7 +12,7 @@ import de.neemann.digital.lang.Lang; /** * A simple switch */ -public class Switch implements Element, Observer { +public class Switch implements Element, NodeInterface { /** * The switch description diff --git a/src/main/java/de/neemann/digital/core/wiring/Splitter.java b/src/main/java/de/neemann/digital/core/wiring/Splitter.java index 22e98b64b..803343d99 100644 --- a/src/main/java/de/neemann/digital/core/wiring/Splitter.java +++ b/src/main/java/de/neemann/digital/core/wiring/Splitter.java @@ -141,14 +141,22 @@ public class Splitter implements Element { final ObservableValue inValue = inputs.get(in.number); final ObservableValue outValue = outputs.get(out.number); if (highZIn) - inValue.addObserverToValue(() -> { - if (inValue.isHighZ()) - outValue.set(0, true); - else - outValue.set(inValue.getValue() >> bitPos, false); + inValue.addObserverToValue(new NodeWithoutDelay(outValue) { + @Override + public void hasChanged() { + if (inValue.isHighZ()) + outValue.set(0, true); + else + outValue.set(inValue.getValue() >> bitPos, false); + } }); else - inValue.addObserverToValue(() -> outValue.setValue(inValue.getValue() >> bitPos)); + inValue.addObserverToValue(new NodeWithoutDelay(outValue) { + @Override + public void hasChanged() { + outValue.setValue(inValue.getValue() >> bitPos); + } + }); break; // done!! out is completely filled! } @@ -163,10 +171,13 @@ public class Splitter implements Element { final long mask = ~(((1L << in.bits) - 1) << bitPos); final ObservableValue inValue = inputs.get(in.number); final ObservableValue outValue = outputs.get(out.number); - inputs.get(in.number).addObserverToValue(() -> { - long in1 = inValue.getValue(); - long out1 = outValue.getValue(); - outValue.setValue((out1 & mask) | (in1 << bitPos)); + inputs.get(in.number).addObserverToValue(new NodeWithoutDelay(outValue) { + @Override + public void hasChanged() { + long in1 = inValue.getValue(); + long out1 = outValue.getValue(); + outValue.setValue((out1 & mask) | (in1 << bitPos)); + } }); continue; // done with this input, its completely copied to the output! } @@ -180,10 +191,13 @@ public class Splitter implements Element { final int shift = out.getPos() - in.getPos(); final ObservableValue inValue = inputs.get(in.number); final ObservableValue outValue = outputs.get(out.number); - inputs.get(in.number).addObserverToValue(() -> { - long in12 = inValue.getValue(); - long out12 = outValue.getValue(); - outValue.setValue((out12 & mask) | (in12 >> shift)); + inputs.get(in.number).addObserverToValue(new NodeWithoutDelay(outValue) { + @Override + public void hasChanged() { + long in12 = inValue.getValue(); + long out12 = outValue.getValue(); + outValue.setValue((out12 & mask) | (in12 >> shift)); + } }); continue; } @@ -194,10 +208,13 @@ public class Splitter implements Element { final long mask = ~(((1L << bitsToCopy) - 1) << shift); final ObservableValue inValue = inputs.get(in.number); final ObservableValue outValue = outputs.get(out.number); - inputs.get(in.number).addObserverToValue(() -> { - long in13 = inValue.getValue(); - long out13 = outValue.getValue(); - outValue.setValue((out13 & mask) | (in13 << shift)); + inputs.get(in.number).addObserverToValue(new NodeWithoutDelay(outValue) { + @Override + public void hasChanged() { + long in13 = inValue.getValue(); + long out13 = outValue.getValue(); + outValue.setValue((out13 & mask) | (in13 << shift)); + } }); } diff --git a/src/main/java/de/neemann/digital/draw/model/InverterConfig.java b/src/main/java/de/neemann/digital/draw/model/InverterConfig.java index f601b978a..74c1465c3 100644 --- a/src/main/java/de/neemann/digital/draw/model/InverterConfig.java +++ b/src/main/java/de/neemann/digital/draw/model/InverterConfig.java @@ -1,5 +1,6 @@ package de.neemann.digital.draw.model; +import de.neemann.digital.core.NodeWithoutDelay; import de.neemann.digital.core.ObservableValue; import java.util.HashSet; @@ -51,7 +52,12 @@ public class InverterConfig { return orig; ObservableValue out = new ObservableValue("~" + orig.getName(), orig.getBits()); - orig.addObserver(() -> out.set(~orig.getValue(), orig.isHighZ())); + orig.addObserver(new NodeWithoutDelay(out) { + @Override + public void hasChanged() { + out.set(~orig.getValue(), orig.isHighZ()); + } + }); out.set(~orig.getValue(), orig.isHighZ()); return out; } diff --git a/src/main/java/de/neemann/digital/gui/components/table/ExpressionCreator.java b/src/main/java/de/neemann/digital/gui/components/table/ExpressionCreator.java index 3bcf6a677..53074f033 100644 --- a/src/main/java/de/neemann/digital/gui/components/table/ExpressionCreator.java +++ b/src/main/java/de/neemann/digital/gui/components/table/ExpressionCreator.java @@ -82,7 +82,7 @@ public class ExpressionCreator { TableReducer tr = new TableReducer(vars, boolTable); List localVars = vars; if (tr.canReduce()) { - LOGGER.debug(resultName + " reduced from " + vars.size() + " to " + tr.getVars().size() + " variables"); + LOGGER.debug(resultName + " reduced from " + vars.size() + " to " + tr.getVars().size() + " variables ("+tr.getVars()+")"); boolTable = tr.getTable(); localVars = tr.getVars(); } diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index d8c903df6..8962b6dba 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -539,6 +539,8 @@ Sind evtl. die Namen der Variablen nicht eindeutig? Die Steuereingänge eines Transmission-Gates müssen invertiert beschaltet werden! Signal {0} wurde mehrfach verwendet! Fehler beim Einlesen der Testdaten. + Das Model enthält zirkuläre Abhängigkeiten. + Die Modelkomponente {0} kann nicht analysiert werden. Adress-Bits Anzahl der Adress-Bits die verwendet werden. diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index aed3c72fb..8fb3e36ec 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -529,6 +529,8 @@ The names of the variables may not be unique. The two control inputs of a transmission gate must be inverted! Signal {0} is used twice! Error parsing the test data. + Thes model contains circular dependencies. + The model component {0} can not be analysed. Address Bits Number of address bits used. diff --git a/src/test/java/de/neemann/digital/analyse/DependencyAnalyserTest.java b/src/test/java/de/neemann/digital/analyse/DependencyAnalyserTest.java new file mode 100644 index 000000000..f0b4e8638 --- /dev/null +++ b/src/test/java/de/neemann/digital/analyse/DependencyAnalyserTest.java @@ -0,0 +1,62 @@ +package de.neemann.digital.analyse; + +import de.neemann.digital.core.*; +import de.neemann.digital.draw.elements.PinException; +import de.neemann.digital.integration.ToBreakRunner; +import junit.framework.TestCase; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * @author hneemann + */ +public class DependencyAnalyserTest extends TestCase { + + private static final int[] VAL = new int[]{1, 1, 1, 2, 6, 5, 5, 3, 8, 7, 7, 5, 10, 9, 9, 7, 2, 14, 14, 14, 14, 14, 14, 14, 2, 2}; + + public void testAnalyzer() throws Exception { + Model model = new ToBreakRunner("dig/backTrac/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()); + } + +} + +/* + +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]) + + */ diff --git a/src/test/resources/dig/backTrac/Plexer.dig b/src/test/resources/dig/backTrac/Plexer.dig new file mode 100644 index 000000000..7b6a1bf00 --- /dev/null +++ b/src/test/resources/dig/backTrac/Plexer.dig @@ -0,0 +1,569 @@ + + + 1 + + + Width + 5 + + + + + Clock + + + runRealTime + true + + + Label + C + + + Frequency + 20 + + + + + + Multiplexer + + + Selector Bits + 2 + + + Bits + 4 + + + + + + Splitter + + + Input Splitting + 4 + + + Output Splitting + 1*4 + + + + + + Decoder + + + Selector Bits + 2 + + + flipSelPos + true + + + + + + Splitter + + + Input Splitting + 1,1 + + + Output Splitting + 2 + + + + + + Ground + + + Bits + 4 + + + + + + Out + + + Description + Pin 18 + + + Label + s2 + + + pinNumber + 18 + + + + + + dif.dig + + + + + counter2Bit3.dig + + + + + decoder.dig + + + + + counter.dig + + + Label + C0 + + + + + + counter.dig + + + Label + C1 + + + + + + counter.dig + + + Label + C2 + + + + + + Out + + + Description + Pin 14 + + + Label + d0 + + + pinNumber + 8 + + + + + + Out + + + Description + Pin 12 + + + Label + c0 + + + pinNumber + 6 + + + + + + Out + + + Description + Pin 11 + + + Label + b0 + + + pinNumber + 5 + + + + + + Out + + + Description + Pin 9 + + + Label + a0 + + + pinNumber + 4 + + + + + + Out + + + Description + Pin 8 + + + Label + e0 + + + pinNumber + 9 + + + + + + Out + + + Description + Pin 6 + + + Label + f0 + + + pinNumber + 11 + + + + + + Out + + + Description + Pin 5 + + + Label + g0 + + + pinNumber + 12 + + + + + + Out + + + Description + Pin 17 + + + Label + s1 + + + pinNumber + 19 + + + + + + Out + + + Description + Pin 16 + + + Label + s0 + + + pinNumber + 20 + + + + + + In + + + Description + Pin 26 + + + Label + Count + + + pinNumber + 26 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/dig/backTrac/counter.dig b/src/test/resources/dig/backTrac/counter.dig new file mode 100644 index 000000000..c6ebfb1e8 --- /dev/null +++ b/src/test/resources/dig/backTrac/counter.dig @@ -0,0 +1,1058 @@ + + + 1 + + + Width + 4 + + + + + Tunnel + + + Inputs + 1 + + + NetName + Q_3n + + + + + + D_FF + + + Label + *Q_3n + + + Inputs + 1 + + + + + + Or + + + Inputs + 3 + + + + + + And + + + Inputs + 4 + + + + + + And + + + + + And + + + + + Tunnel + + + Inputs + 1 + + + NetName + Q_2n + + + + + + D_FF + + + Label + *Q_2n + + + Inputs + 1 + + + + + + Or + + + Inputs + 4 + + + + + + And + + + Inputs + 4 + + + + + + And + + + + + And + + + + + And + + + + + Tunnel + + + Inputs + 1 + + + NetName + Q_1n + + + + + + D_FF + + + Label + *Q_1n + + + Inputs + 1 + + + + + + Or + + + Inputs + 3 + + + + + + And + + + Inputs + 4 + + + + + + And + + + + + And + + + + + Tunnel + + + Inputs + 1 + + + NetName + Q_0n + + + + + + D_FF + + + Label + *Q_0n + + + Inputs + 1 + + + + + + Or + + + + + And + + + + + And + + + + + Out + + + Label + Q + + + + + + And + + + Inputs + 3 + + + + + + In + + + rotation + + + + Label + en + + + + + + Not + + + rotation + + + + + + + Tunnel + + + rotation + + + + NetName + Q_0n + + + + + + Not + + + rotation + + + + + + + Tunnel + + + rotation + + + + NetName + Q_1n + + + + + + Not + + + rotation + + + + + + + Tunnel + + + rotation + + + + NetName + Q_2n + + + + + + Not + + + rotation + + + + + + + Tunnel + + + rotation + + + + NetName + Q_3n + + + + + + Not + + + rotation + + + + + + + Clock + + + runRealTime + true + + + rotation + + + + Label + C + + + + + + Tunnel + + + rotation + + + + NetName + Q_0n + + + + + + Tunnel + + + rotation + + + + NetName + Q_1n + + + + + + Tunnel + + + rotation + + + + NetName + Q_2n + + + + + + Tunnel + + + rotation + + + + NetName + Q_3n + + + + + + Out + + + Label + ov + + + Inputs + 1 + + + + + + Splitter + + + Input Splitting + 1*4 + + + Output Splitting + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/dig/backTrac/counter2Bit3.dig b/src/test/resources/dig/backTrac/counter2Bit3.dig new file mode 100644 index 000000000..f4f8a2682 --- /dev/null +++ b/src/test/resources/dig/backTrac/counter2Bit3.dig @@ -0,0 +1,277 @@ + + + 1 + + + Width + 4 + + + + + Tunnel + + + Inputs + 1 + + + NetName + Q_1n + + + + + + D_FF + + + Label + Q_1n + + + Inputs + 1 + + + + + + Tunnel + + + Inputs + 1 + + + NetName + Q_0n + + + + + + D_FF + + + Label + Q_0n + + + Inputs + 1 + + + + + + And + + + + + Out + + + Label + Q1 + + + Inputs + 1 + + + + + + Out + + + Label + Q0 + + + Inputs + 1 + + + + + + Tunnel + + + rotation + + + + NetName + Q_0n + + + + + + Not + + + rotation + + + + + + + Tunnel + + + rotation + + + + NetName + Q_1n + + + + + + Not + + + rotation + + + + + + + Clock + + + runRealTime + true + + + rotation + + + + Label + C + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/dig/backTrac/decoder.dig b/src/test/resources/dig/backTrac/decoder.dig new file mode 100644 index 000000000..cbc71c246 --- /dev/null +++ b/src/test/resources/dig/backTrac/decoder.dig @@ -0,0 +1,1660 @@ + + + 1 + + + Width + 4 + + + + + Out + + + Label + d + + + Inputs + 1 + + + + + + Or + + + Inputs + 6 + + + + + + And + + + + + And + + + Inputs + 3 + + + + + + And + + + Inputs + 3 + + + + + + And + + + + + And + + + + + And + + + + + Out + + + Label + c + + + Inputs + 1 + + + + + + Or + + + Inputs + 5 + + + + + + And + + + Inputs + 3 + + + + + + And + + + Inputs + 3 + + + + + + And + + + Inputs + 3 + + + + + + And + + + + + And + + + + + Out + + + Label + b + + + Inputs + 1 + + + + + + Or + + + Inputs + 5 + + + + + + And + + + + + And + + + + + And + + + + + And + + + + + And + + + + + Out + + + Label + a + + + Inputs + 1 + + + + + + Or + + + Inputs + 5 + + + + + + And + + + Inputs + 3 + + + + + + And + + + + + And + + + Inputs + 3 + + + + + + And + + + Inputs + 3 + + + + + + And + + + Inputs + 3 + + + + + + Out + + + Label + e + + + Inputs + 1 + + + + + + Or + + + Inputs + 4 + + + + + + And + + + + + And + + + + + And + + + + + And + + + + + Out + + + Label + f + + + Inputs + 1 + + + + + + Or + + + Inputs + 5 + + + + + + And + + + Inputs + 3 + + + + + + And + + + + + And + + + + + And + + + + + And + + + + + Out + + + Label + g + + + Inputs + 1 + + + + + + Or + + + Inputs + 5 + + + + + + And + + + + + And + + + Inputs + 3 + + + + + + And + + + + + And + + + + + And + + + + + In + + + Description + Bit 0 des Dekodereingangs. + + + rotation + + + + Label + D_0 + + + + + + Not + + + rotation + + + + + + + In + + + Description + Bit 1 des Dekodereingangs. + + + rotation + + + + Label + D_1 + + + + + + Not + + + rotation + + + + + + + In + + + Description + Bit 2 des Dekodereingangs. + + + rotation + + + + Label + D_2 + + + + + + Not + + + rotation + + + + + + + In + + + Description + Bit 3 des Dekodereingangs. + + + rotation + + + + Label + D_3 + + + + + + Not + + + rotation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/dig/backTrac/dif.dig b/src/test/resources/dig/backTrac/dif.dig new file mode 100644 index 000000000..892146650 --- /dev/null +++ b/src/test/resources/dig/backTrac/dif.dig @@ -0,0 +1,129 @@ + + + 1 + + + Width + 4 + + + + + In + + + Label + Count + + + + + + D_FF + + + Label + p0 + + + + + + D_FF + + + Label + p1 + + + + + + And + + + + + Clock + + + Label + C + + + + + + Out + + + Label + Out + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file