playing around with new substituting algorithm

This commit is contained in:
hneemann 2019-06-27 11:53:15 +02:00
parent 3808d15c81
commit 4d2b7ef86a
10 changed files with 929 additions and 80 deletions

View File

@ -8,14 +8,10 @@ package de.neemann.digital.analyse;
import de.neemann.digital.analyse.expression.BitSetter;
import de.neemann.digital.analyse.quinemc.BoolTableByteArray;
import de.neemann.digital.core.*;
import de.neemann.digital.core.basic.And;
import de.neemann.digital.core.basic.Not;
import de.neemann.digital.core.basic.Or;
import de.neemann.digital.core.element.ElementAttributes;
import de.neemann.digital.core.flipflops.FlipflopD;
import de.neemann.digital.core.flipflops.FlipflopJK;
import de.neemann.digital.core.flipflops.FlipflopT;
import de.neemann.digital.core.switching.*;
import de.neemann.digital.core.switching.NFET;
import de.neemann.digital.core.switching.Relay;
import de.neemann.digital.core.switching.RelayDT;
import de.neemann.digital.core.wiring.Clock;
import de.neemann.digital.core.wiring.Splitter;
import de.neemann.digital.draw.elements.PinException;
@ -49,13 +45,6 @@ public class ModelAnalyser {
public ModelAnalyser(Model model) throws AnalyseException {
this.model = model;
try {
replaceTFF();
replaceJKFF();
} catch (NodeException e) {
throw new AnalyseException(e);
}
modelAnalyzerInfo = new ModelAnalyserInfo(model);
inputs = checkBinaryInputs(model.getInputs());
@ -274,66 +263,6 @@ public class ModelAnalyser {
return out;
}
private void replaceJKFF() throws NodeException, AnalyseException {
List<FlipflopJK> jkList = model.findNode(FlipflopJK.class);
for (FlipflopJK jk : jkList) {
checkClock(jk);
jk.getClockVal().removeObserver(jk);
jk.getjVal().removeObserver(jk);
jk.getkVal().removeObserver(jk);
// create d ff
ObservableValue q = jk.getOutputs().get(0);
ObservableValue qn = jk.getOutputs().get(1);
FlipflopD d = new FlipflopD(jk.getLabel(), q, qn);
And a1 = new And(new ElementAttributes());
a1.setInputs(new ObservableValues(jk.getjVal(), qn));
And a2 = new And(new ElementAttributes());
Not nk = new Not(new ElementAttributes());
nk.setInputs(jk.getkVal().asList());
a2.setInputs(new ObservableValues(nk.getOutput(), q));
Or or = new Or(new ElementAttributes());
or.setInputs(new ObservableValues(a1.getOutput(), a2.getOutput()));
d.setInputs(new ObservableValues(or.getOutputs().get(0), jk.getClockVal()));
model.add(a1);
model.add(a2);
model.add(nk);
model.add(or);
model.replace(jk, d);
}
}
private void replaceTFF() throws NodeException, AnalyseException {
List<FlipflopT> tList = model.findNode(FlipflopT.class);
for (FlipflopT tff : tList) {
checkClock(tff);
tff.getClockVal().removeObserver(tff);
ObservableValue q = tff.getOutputs().get(0);
ObservableValue qn = tff.getOutputs().get(1);
ObservableValue enable = tff.getEnableVal();
if (enable == null) {
// create d ff
FlipflopD d = new FlipflopD(tff.getLabel(), q, qn);
d.setInputs(new ObservableValues(qn, getClock()));
model.replace(tff, d);
} else {
// create jk ff
enable.removeObserver(tff);
FlipflopJK jk = new FlipflopJK(tff.getLabel(), q, qn);
jk.setInputs(new ObservableValues(enable, getClock(), enable));
model.replace(tff, jk);
}
}
}
/**
* @return the models inputs
*/

View File

@ -0,0 +1,104 @@
/*
* Copyright (c) 2019 Helmut Neemann.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.analyse;
import de.neemann.digital.core.element.ElementAttributes;
import de.neemann.digital.core.element.ElementTypeDescription;
import de.neemann.digital.core.element.Keys;
import de.neemann.digital.draw.elements.Circuit;
import de.neemann.digital.draw.elements.PinException;
import de.neemann.digital.draw.library.CustomElement;
import de.neemann.digital.draw.library.ElementLibrary;
import de.neemann.digital.draw.library.ElementNotFoundException;
import de.neemann.digital.draw.library.LibraryInterface;
import de.neemann.digital.lang.Lang;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
/**
* Used to substitute certain complex builtin components by simple custom components.
* Used to allow to analyse this components in a more simple way.
*/
public class SubstituteLibrary implements LibraryInterface {
private static final Logger LOGGER = LoggerFactory.getLogger(SubstituteLibrary.class);
private static final Map<String, SubstituteInterface> map = new HashMap<>();
private static final SubstituteInterface T_FF_WITH_ENABLE = new Substitute("T_FF_EN.dig");
private static final SubstituteInterface T_FF_WITHOUT_ENABLE = new Substitute("T_FF.dig");
static {
map.put("JK_FF", new Substitute("JK_FF.dig"));
map.put("T_FF", (attr, library) -> {
if (attr.get(Keys.WITH_ENABLE))
return T_FF_WITH_ENABLE.getElementType(attr, library);
else
return T_FF_WITHOUT_ENABLE.getElementType(attr, library);
});
map.put("Counter", new Substitute("Counter.dig"));
}
private final ElementLibrary parent;
public SubstituteLibrary(ElementLibrary parent) {
this.parent = parent;
}
@Override
public ElementTypeDescription getElementType(String elementName, ElementAttributes attr) throws ElementNotFoundException {
SubstituteInterface subst = map.get(elementName);
if (subst != null) {
try {
ElementTypeDescription type = subst.getElementType(attr, parent);
if (type != null)
return type;
} catch (PinException | IOException e) {
throw new ElementNotFoundException(Lang.get("err_substitutingError"), e);
}
}
return parent.getElementType(elementName, attr);
}
private interface SubstituteInterface {
ElementTypeDescription getElementType(ElementAttributes attr, ElementLibrary library) throws PinException, IOException;
}
private static final class Substitute implements SubstituteInterface {
private final String filename;
private ElementLibrary.ElementTypeDescriptionCustom typeDescriptionCustom;
private Substitute(String filename) {
this.filename = filename;
}
@Override
public ElementTypeDescription getElementType(ElementAttributes attr, ElementLibrary library) throws PinException, IOException {
if (typeDescriptionCustom == null) {
LOGGER.info("load substitute circuit " + filename);
InputStream in = getClass().getClassLoader().getResourceAsStream("analyser/" + filename);
if (in == null)
throw new IOException("substituting failed: could not find file " + filename);
Circuit circuit = modify(Circuit.loadCircuit(in, library.getShapeFactory()));
typeDescriptionCustom =
new ElementLibrary.ElementTypeDescriptionCustom(new File(filename),
attributes -> new CustomElement(circuit, library),
circuit);
}
return typeDescriptionCustom;
}
private Circuit modify(Circuit circuit) {
return circuit;
}
}
}

View File

@ -52,7 +52,7 @@ import java.util.*;
* This is done because the loading of a circuit and the creation of an icon is very time consuming and should
* be avoided if not necessary. It's a kind of lazy loading.
*/
public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer> {
public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>, LibraryInterface {
private static final Logger LOGGER = LoggerFactory.getLogger(ElementLibrary.class);
private static final long MIN_RESCAN_INTERVAL = 5000;
@ -403,6 +403,11 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
return map.get(elementName);
}
@Override
public ElementTypeDescription getElementType(String elementName, ElementAttributes attr) throws ElementNotFoundException {
return getElementType(elementName);
}
/**
* Returns a {@link ElementTypeDescription} by a given name.
* If not found its tried to load it.

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2019 Helmut Neemann.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.draw.library;
import de.neemann.digital.core.element.ElementAttributes;
import de.neemann.digital.core.element.ElementTypeDescription;
/**
* Library interface used by the model creator
*/
public interface LibraryInterface {
/**
* Creates a element description.
*
* @param elementName the name of the element
* @param attr the elements attributes
* @return the ElementTypeDescription
*/
ElementTypeDescription getElementType(String elementName, ElementAttributes attr) throws ElementNotFoundException;
}

View File

@ -20,6 +20,7 @@ import de.neemann.digital.draw.graphics.Vector;
import de.neemann.digital.draw.library.CustomElement;
import de.neemann.digital.draw.library.ElementLibrary;
import de.neemann.digital.draw.library.ElementNotFoundException;
import de.neemann.digital.draw.library.LibraryInterface;
import de.neemann.digital.draw.shapes.Drawable;
import de.neemann.digital.lang.Lang;
@ -48,7 +49,7 @@ public class ModelCreator implements Iterable<ModelEntry> {
* @throws NodeException NodeException
* @throws ElementNotFoundException ElementNotFoundException
*/
public ModelCreator(Circuit circuit, ElementLibrary library) throws PinException, NodeException, ElementNotFoundException {
public ModelCreator(Circuit circuit, LibraryInterface library) throws PinException, NodeException, ElementNotFoundException {
this(circuit, library, false);
}
@ -62,7 +63,7 @@ public class ModelCreator implements Iterable<ModelEntry> {
* @throws NodeException NodeException
* @throws ElementNotFoundException ElementNotFoundException
*/
public ModelCreator(Circuit circuit, ElementLibrary library, boolean readAsCustom) throws PinException, NodeException, ElementNotFoundException {
public ModelCreator(Circuit circuit, LibraryInterface library, boolean readAsCustom) throws PinException, NodeException, ElementNotFoundException {
this(circuit, library, readAsCustom, new NetList(circuit), "", 0, null);
}
@ -80,7 +81,7 @@ public class ModelCreator implements Iterable<ModelEntry> {
* @throws NodeException NodeException
* @throws ElementNotFoundException ElementNotFoundException
*/
public ModelCreator(Circuit circuit, ElementLibrary library, boolean isNestedCircuit, NetList netList, String subName, int depth, VisualElement containingVisualElement) throws PinException, NodeException, ElementNotFoundException {
public ModelCreator(Circuit circuit, LibraryInterface library, boolean isNestedCircuit, NetList netList, String subName, int depth, VisualElement containingVisualElement) throws PinException, NodeException, ElementNotFoundException {
this.circuit = circuit;
this.netList = netList;
entries = new ArrayList<>();
@ -99,8 +100,8 @@ public class ModelCreator implements Iterable<ModelEntry> {
cve = containingVisualElement;
Pins pins = ve.getPins();
ElementTypeDescription elementType = library.getElementType(ve.getElementName());
ElementAttributes attr = ve.getElementAttributes();
ElementTypeDescription elementType = library.getElementType(ve.getElementName(), attr);
if (attr.getLabel().contains("*")
&& !ve.equalsDescription(In.DESCRIPTION)
&& !ve.equalsDescription(Out.DESCRIPTION)) {

View File

@ -5,6 +5,7 @@
*/
package de.neemann.digital.gui;
import de.neemann.digital.analyse.SubstituteLibrary;
import de.neemann.digital.analyse.AnalyseException;
import de.neemann.digital.analyse.ModelAnalyser;
import de.neemann.digital.analyse.TruthTable;
@ -1128,7 +1129,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
@Override
public void actionPerformed(ActionEvent e) {
try {
Model model = new ModelCreator(circuitComponent.getCircuit(), library).createModel(false);
Model model = new ModelCreator(circuitComponent.getCircuit(), new SubstituteLibrary(library)).createModel(false);
try {
model.checkForInvalidSignals();
new TableDialog(Main.this,

View File

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="utf-8"?>
<circuit>
<version>1</version>
<attributes/>
<visualElements>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>en</string>
</entry>
</elementAttributes>
<pos x="240" y="260"/>
</visualElement>
<visualElement>
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>C</string>
</entry>
</elementAttributes>
<pos x="240" y="340"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>clr</string>
</entry>
</elementAttributes>
<pos x="240" y="300"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>out</string>
</entry>
<entry>
<string>Bits</string>
<int>4</int>
</entry>
</elementAttributes>
<pos x="540" y="160"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>ovf</string>
</entry>
</elementAttributes>
<pos x="540" y="240"/>
</visualElement>
<visualElement>
<elementName>D_FF</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>*</string>
</entry>
<entry>
<string>Bits</string>
<int>4</int>
</entry>
</elementAttributes>
<pos x="440" y="160"/>
</visualElement>
<visualElement>
<elementName>Multiplexer</elementName>
<elementAttributes>
<entry>
<string>Bits</string>
<int>4</int>
</entry>
</elementAttributes>
<pos x="360" y="140"/>
</visualElement>
<visualElement>
<elementName>Ground</elementName>
<elementAttributes>
<entry>
<string>Bits</string>
<int>4</int>
</entry>
</elementAttributes>
<pos x="340" y="200"/>
</visualElement>
<visualElement>
<elementName>Multiplexer</elementName>
<elementAttributes>
<entry>
<string>Bits</string>
<int>4</int>
</entry>
</elementAttributes>
<pos x="300" y="120"/>
</visualElement>
<visualElement>
<elementName>Add</elementName>
<elementAttributes>
<entry>
<string>Bits</string>
<int>4</int>
</entry>
</elementAttributes>
<pos x="220" y="160"/>
</visualElement>
<visualElement>
<elementName>Ground</elementName>
<elementAttributes/>
<pos x="200" y="220"/>
</visualElement>
<visualElement>
<elementName>Const</elementName>
<elementAttributes>
<entry>
<string>Bits</string>
<int>4</int>
</entry>
</elementAttributes>
<pos x="200" y="180"/>
</visualElement>
<visualElement>
<elementName>And</elementName>
<elementAttributes/>
<pos x="460" y="220"/>
</visualElement>
</visualElements>
<wires>
<wire>
<p1 x="500" y="160"/>
<p2 x="520" y="160"/>
</wire>
<wire>
<p1 x="400" y="160"/>
<p2 x="440" y="160"/>
</wire>
<wire>
<p1 x="280" y="160"/>
<p2 x="300" y="160"/>
</wire>
<wire>
<p1 x="200" y="160"/>
<p2 x="220" y="160"/>
</wire>
<wire>
<p1 x="520" y="160"/>
<p2 x="540" y="160"/>
</wire>
<wire>
<p1 x="200" y="80"/>
<p2 x="280" y="80"/>
</wire>
<wire>
<p1 x="280" y="80"/>
<p2 x="520" y="80"/>
</wire>
<wire>
<p1 x="520" y="240"/>
<p2 x="540" y="240"/>
</wire>
<wire>
<p1 x="240" y="340"/>
<p2 x="420" y="340"/>
</wire>
<wire>
<p1 x="240" y="260"/>
<p2 x="320" y="260"/>
</wire>
<wire>
<p1 x="320" y="260"/>
<p2 x="460" y="260"/>
</wire>
<wire>
<p1 x="340" y="180"/>
<p2 x="360" y="180"/>
</wire>
<wire>
<p1 x="420" y="180"/>
<p2 x="440" y="180"/>
</wire>
<wire>
<p1 x="200" y="180"/>
<p2 x="220" y="180"/>
</wire>
<wire>
<p1 x="280" y="180"/>
<p2 x="300" y="180"/>
</wire>
<wire>
<p1 x="280" y="120"/>
<p2 x="300" y="120"/>
</wire>
<wire>
<p1 x="200" y="200"/>
<p2 x="220" y="200"/>
</wire>
<wire>
<p1 x="240" y="300"/>
<p2 x="380" y="300"/>
</wire>
<wire>
<p1 x="340" y="140"/>
<p2 x="360" y="140"/>
</wire>
<wire>
<p1 x="300" y="220"/>
<p2 x="460" y="220"/>
</wire>
<wire>
<p1 x="320" y="160"/>
<p2 x="320" y="260"/>
</wire>
<wire>
<p1 x="420" y="180"/>
<p2 x="420" y="340"/>
</wire>
<wire>
<p1 x="340" y="180"/>
<p2 x="340" y="200"/>
</wire>
<wire>
<p1 x="520" y="80"/>
<p2 x="520" y="160"/>
</wire>
<wire>
<p1 x="280" y="80"/>
<p2 x="280" y="120"/>
</wire>
<wire>
<p1 x="200" y="80"/>
<p2 x="200" y="160"/>
</wire>
<wire>
<p1 x="200" y="200"/>
<p2 x="200" y="220"/>
</wire>
<wire>
<p1 x="380" y="180"/>
<p2 x="380" y="300"/>
</wire>
<wire>
<p1 x="300" y="180"/>
<p2 x="300" y="220"/>
</wire>
</wires>
<measurementOrdering/>
</circuit>

View File

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="utf-8"?>
<circuit>
<version>1</version>
<attributes/>
<visualElements>
<visualElement>
<elementName>D_FF</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>*</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="240" y="60"/>
</visualElement>
<visualElement>
<elementName>Or</elementName>
<elementAttributes/>
<pos x="140" y="40"/>
</visualElement>
<visualElement>
<elementName>And</elementName>
<elementAttributes>
<entry>
<string>inverterConfig</string>
<inverterConfig>
<string>In_2</string>
</inverterConfig>
</entry>
</elementAttributes>
<pos x="40" y="0"/>
</visualElement>
<visualElement>
<elementName>And</elementName>
<elementAttributes/>
<pos x="40" y="80"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>Q</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="340" y="40"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>~Q</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="340" y="80"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>J</string>
</entry>
</elementAttributes>
<pos x="0" y="80"/>
</visualElement>
<visualElement>
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<string>runRealTime</string>
<boolean>true</boolean>
</entry>
<entry>
<string>Label</string>
<string>C</string>
</entry>
<entry>
<string>Frequency</string>
<int>2</int>
</entry>
</elementAttributes>
<pos x="200" y="120"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>K</string>
</entry>
</elementAttributes>
<pos x="0" y="40"/>
</visualElement>
</visualElements>
<wires>
<wire>
<p1 x="20" y="0"/>
<p2 x="40" y="0"/>
</wire>
<wire>
<p1 x="120" y="80"/>
<p2 x="140" y="80"/>
</wire>
<wire>
<p1 x="220" y="80"/>
<p2 x="240" y="80"/>
</wire>
<wire>
<p1 x="300" y="80"/>
<p2 x="320" y="80"/>
</wire>
<wire>
<p1 x="0" y="80"/>
<p2 x="40" y="80"/>
</wire>
<wire>
<p1 x="320" y="80"/>
<p2 x="340" y="80"/>
</wire>
<wire>
<p1 x="20" y="160"/>
<p2 x="320" y="160"/>
</wire>
<wire>
<p1 x="100" y="20"/>
<p2 x="120" y="20"/>
</wire>
<wire>
<p1 x="100" y="100"/>
<p2 x="120" y="100"/>
</wire>
<wire>
<p1 x="20" y="-40"/>
<p2 x="320" y="-40"/>
</wire>
<wire>
<p1 x="0" y="40"/>
<p2 x="20" y="40"/>
</wire>
<wire>
<p1 x="120" y="40"/>
<p2 x="140" y="40"/>
</wire>
<wire>
<p1 x="320" y="40"/>
<p2 x="340" y="40"/>
</wire>
<wire>
<p1 x="20" y="120"/>
<p2 x="40" y="120"/>
</wire>
<wire>
<p1 x="200" y="120"/>
<p2 x="220" y="120"/>
</wire>
<wire>
<p1 x="200" y="60"/>
<p2 x="240" y="60"/>
</wire>
<wire>
<p1 x="300" y="60"/>
<p2 x="320" y="60"/>
</wire>
<wire>
<p1 x="320" y="-40"/>
<p2 x="320" y="40"/>
</wire>
<wire>
<p1 x="320" y="80"/>
<p2 x="320" y="160"/>
</wire>
<wire>
<p1 x="320" y="40"/>
<p2 x="320" y="60"/>
</wire>
<wire>
<p1 x="20" y="120"/>
<p2 x="20" y="160"/>
</wire>
<wire>
<p1 x="20" y="-40"/>
<p2 x="20" y="0"/>
</wire>
<wire>
<p1 x="120" y="20"/>
<p2 x="120" y="40"/>
</wire>
<wire>
<p1 x="120" y="80"/>
<p2 x="120" y="100"/>
</wire>
<wire>
<p1 x="220" y="80"/>
<p2 x="220" y="120"/>
</wire>
</wires>
<measurementOrdering/>
</circuit>

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<circuit>
<version>1</version>
<attributes/>
<visualElements>
<visualElement>
<elementName>D_FF</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>*</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="240" y="60"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>Q</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="340" y="40"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>~Q</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="340" y="80"/>
</visualElement>
<visualElement>
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<string>runRealTime</string>
<boolean>true</boolean>
</entry>
<entry>
<string>Label</string>
<string>C</string>
</entry>
<entry>
<string>Frequency</string>
<int>2</int>
</entry>
</elementAttributes>
<pos x="200" y="80"/>
</visualElement>
</visualElements>
<wires>
<wire>
<p1 x="200" y="80"/>
<p2 x="240" y="80"/>
</wire>
<wire>
<p1 x="300" y="80"/>
<p2 x="320" y="80"/>
</wire>
<wire>
<p1 x="320" y="80"/>
<p2 x="340" y="80"/>
</wire>
<wire>
<p1 x="220" y="120"/>
<p2 x="320" y="120"/>
</wire>
<wire>
<p1 x="320" y="40"/>
<p2 x="340" y="40"/>
</wire>
<wire>
<p1 x="220" y="60"/>
<p2 x="240" y="60"/>
</wire>
<wire>
<p1 x="300" y="60"/>
<p2 x="320" y="60"/>
</wire>
<wire>
<p1 x="320" y="80"/>
<p2 x="320" y="120"/>
</wire>
<wire>
<p1 x="320" y="40"/>
<p2 x="320" y="60"/>
</wire>
<wire>
<p1 x="220" y="60"/>
<p2 x="220" y="120"/>
</wire>
</wires>
<measurementOrdering/>
</circuit>

View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="utf-8"?>
<circuit>
<version>1</version>
<attributes/>
<visualElements>
<visualElement>
<elementName>D_FF</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>*</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="240" y="60"/>
</visualElement>
<visualElement>
<elementName>Or</elementName>
<elementAttributes/>
<pos x="140" y="40"/>
</visualElement>
<visualElement>
<elementName>And</elementName>
<elementAttributes>
<entry>
<string>inverterConfig</string>
<inverterConfig>
<string>In_2</string>
</inverterConfig>
</entry>
</elementAttributes>
<pos x="40" y="0"/>
</visualElement>
<visualElement>
<elementName>And</elementName>
<elementAttributes/>
<pos x="40" y="80"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>Q</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="340" y="40"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>~Q</string>
</entry>
<entry>
<string>Inputs</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="340" y="80"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>T</string>
</entry>
</elementAttributes>
<pos x="-20" y="40"/>
</visualElement>
<visualElement>
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<string>runRealTime</string>
<boolean>true</boolean>
</entry>
<entry>
<string>Label</string>
<string>C</string>
</entry>
<entry>
<string>Frequency</string>
<int>2</int>
</entry>
</elementAttributes>
<pos x="200" y="120"/>
</visualElement>
</visualElements>
<wires>
<wire>
<p1 x="20" y="0"/>
<p2 x="40" y="0"/>
</wire>
<wire>
<p1 x="120" y="80"/>
<p2 x="140" y="80"/>
</wire>
<wire>
<p1 x="220" y="80"/>
<p2 x="240" y="80"/>
</wire>
<wire>
<p1 x="300" y="80"/>
<p2 x="320" y="80"/>
</wire>
<wire>
<p1 x="0" y="80"/>
<p2 x="40" y="80"/>
</wire>
<wire>
<p1 x="320" y="80"/>
<p2 x="340" y="80"/>
</wire>
<wire>
<p1 x="20" y="160"/>
<p2 x="320" y="160"/>
</wire>
<wire>
<p1 x="100" y="20"/>
<p2 x="120" y="20"/>
</wire>
<wire>
<p1 x="100" y="100"/>
<p2 x="120" y="100"/>
</wire>
<wire>
<p1 x="20" y="-40"/>
<p2 x="320" y="-40"/>
</wire>
<wire>
<p1 x="-20" y="40"/>
<p2 x="0" y="40"/>
</wire>
<wire>
<p1 x="120" y="40"/>
<p2 x="140" y="40"/>
</wire>
<wire>
<p1 x="320" y="40"/>
<p2 x="340" y="40"/>
</wire>
<wire>
<p1 x="0" y="40"/>
<p2 x="20" y="40"/>
</wire>
<wire>
<p1 x="20" y="120"/>
<p2 x="40" y="120"/>
</wire>
<wire>
<p1 x="200" y="120"/>
<p2 x="220" y="120"/>
</wire>
<wire>
<p1 x="200" y="60"/>
<p2 x="240" y="60"/>
</wire>
<wire>
<p1 x="300" y="60"/>
<p2 x="320" y="60"/>
</wire>
<wire>
<p1 x="320" y="-40"/>
<p2 x="320" y="40"/>
</wire>
<wire>
<p1 x="320" y="80"/>
<p2 x="320" y="160"/>
</wire>
<wire>
<p1 x="320" y="40"/>
<p2 x="320" y="60"/>
</wire>
<wire>
<p1 x="0" y="40"/>
<p2 x="0" y="80"/>
</wire>
<wire>
<p1 x="20" y="120"/>
<p2 x="20" y="160"/>
</wire>
<wire>
<p1 x="20" y="-40"/>
<p2 x="20" y="0"/>
</wire>
<wire>
<p1 x="120" y="20"/>
<p2 x="120" y="40"/>
</wire>
<wire>
<p1 x="120" y="80"/>
<p2 x="120" y="100"/>
</wire>
<wire>
<p1 x="220" y="80"/>
<p2 x="220" y="120"/>
</wire>
</wires>
<measurementOrdering/>
</circuit>