mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-30 00:18:37 -04:00
added an error message if diodes are not used correctly
This commit is contained in:
parent
0df2fbcd35
commit
532e17eae5
@ -1,96 +1,184 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<circuit>
|
<circuit>
|
||||||
<version>1</version>
|
<version>1</version>
|
||||||
<visualElements>
|
<visualElements>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
<elementName>In</elementName>
|
<elementName>In</elementName>
|
||||||
<elementAttributes/>
|
<elementAttributes>
|
||||||
<pos x="140" y="120"/>
|
<entry>
|
||||||
<rotate>0</rotate>
|
<string>Label</string>
|
||||||
</visualElement>
|
<string>D</string>
|
||||||
<visualElement>
|
</entry>
|
||||||
<elementName>Out</elementName>
|
</elementAttributes>
|
||||||
<elementAttributes/>
|
<pos x="140" y="120"/>
|
||||||
<pos x="600" y="120"/>
|
</visualElement>
|
||||||
<rotate>0</rotate>
|
<visualElement>
|
||||||
</visualElement>
|
<elementName>Out</elementName>
|
||||||
<visualElement>
|
<elementAttributes>
|
||||||
<elementName>In</elementName>
|
<entry>
|
||||||
<elementAttributes/>
|
<string>rotation</string>
|
||||||
<pos x="140" y="200"/>
|
<rotation rotation="1"/>
|
||||||
<rotate>0</rotate>
|
</entry>
|
||||||
</visualElement>
|
<entry>
|
||||||
<visualElement>
|
<string>Label</string>
|
||||||
<elementName>D-T.dig</elementName>
|
<string>D_2</string>
|
||||||
<elementAttributes/>
|
</entry>
|
||||||
<pos x="200" y="120"/>
|
</elementAttributes>
|
||||||
<rotate>0</rotate>
|
<pos x="580" y="80"/>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
<elementName>D-T.dig</elementName>
|
<elementName>In</elementName>
|
||||||
<elementAttributes/>
|
<elementAttributes>
|
||||||
<pos x="340" y="120"/>
|
<entry>
|
||||||
<rotate>0</rotate>
|
<string>Label</string>
|
||||||
</visualElement>
|
<string>C</string>
|
||||||
<visualElement>
|
</entry>
|
||||||
<elementName>D-T.dig</elementName>
|
</elementAttributes>
|
||||||
<elementAttributes/>
|
<pos x="140" y="200"/>
|
||||||
<pos x="480" y="120"/>
|
</visualElement>
|
||||||
<rotate>0</rotate>
|
<visualElement>
|
||||||
</visualElement>
|
<elementName>D-T.dig</elementName>
|
||||||
</visualElements>
|
<elementAttributes/>
|
||||||
<wires>
|
<pos x="200" y="120"/>
|
||||||
<wire>
|
</visualElement>
|
||||||
<p1 x="260" y="120"/>
|
<visualElement>
|
||||||
<p2 x="340" y="120"/>
|
<elementName>D-T.dig</elementName>
|
||||||
</wire>
|
<elementAttributes/>
|
||||||
<wire>
|
<pos x="340" y="120"/>
|
||||||
<p1 x="400" y="120"/>
|
</visualElement>
|
||||||
<p2 x="480" y="120"/>
|
<visualElement>
|
||||||
</wire>
|
<elementName>D-T.dig</elementName>
|
||||||
<wire>
|
<elementAttributes/>
|
||||||
<p1 x="540" y="120"/>
|
<pos x="480" y="120"/>
|
||||||
<p2 x="600" y="120"/>
|
</visualElement>
|
||||||
</wire>
|
<visualElement>
|
||||||
<wire>
|
<elementName>Testcase</elementName>
|
||||||
<p1 x="140" y="120"/>
|
<elementAttributes>
|
||||||
<p2 x="200" y="120"/>
|
<entry>
|
||||||
</wire>
|
<string>Testdata</string>
|
||||||
<wire>
|
<testData>
|
||||||
<p1 x="140" y="200"/>
|
<dataString>C D D_0 D_1 D_2
|
||||||
<p2 x="180" y="200"/>
|
# clear all bits
|
||||||
</wire>
|
C 0 0 x x
|
||||||
<wire>
|
C 0 0 0 x
|
||||||
<p1 x="320" y="200"/>
|
C 0 0 0 0
|
||||||
<p2 x="460" y="200"/>
|
|
||||||
</wire>
|
# fill with one
|
||||||
<wire>
|
C 1 1 0 0
|
||||||
<p1 x="180" y="200"/>
|
C 1 1 1 0
|
||||||
<p2 x="320" y="200"/>
|
C 1 1 1 1
|
||||||
</wire>
|
|
||||||
<wire>
|
# fill with zero
|
||||||
<p1 x="180" y="140"/>
|
C 0 0 1 1
|
||||||
<p2 x="200" y="140"/>
|
C 0 0 0 1
|
||||||
</wire>
|
C 0 0 0 0
|
||||||
<wire>
|
</dataString>
|
||||||
<p1 x="320" y="140"/>
|
</testData>
|
||||||
<p2 x="340" y="140"/>
|
</entry>
|
||||||
</wire>
|
</elementAttributes>
|
||||||
<wire>
|
<pos x="480" y="240"/>
|
||||||
<p1 x="460" y="140"/>
|
</visualElement>
|
||||||
<p2 x="480" y="140"/>
|
<visualElement>
|
||||||
</wire>
|
<elementName>Out</elementName>
|
||||||
<wire>
|
<elementAttributes>
|
||||||
<p1 x="320" y="140"/>
|
<entry>
|
||||||
<p2 x="320" y="200"/>
|
<string>rotation</string>
|
||||||
</wire>
|
<rotation rotation="1"/>
|
||||||
<wire>
|
</entry>
|
||||||
<p1 x="180" y="140"/>
|
<entry>
|
||||||
<p2 x="180" y="200"/>
|
<string>Label</string>
|
||||||
</wire>
|
<string>D_0</string>
|
||||||
<wire>
|
</entry>
|
||||||
<p1 x="460" y="140"/>
|
</elementAttributes>
|
||||||
<p2 x="460" y="200"/>
|
<pos x="300" y="80"/>
|
||||||
</wire>
|
</visualElement>
|
||||||
</wires>
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>rotation</string>
|
||||||
|
<rotation rotation="1"/>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>D_1</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="440" y="80"/>
|
||||||
|
</visualElement>
|
||||||
|
</visualElements>
|
||||||
|
<wires>
|
||||||
|
<wire>
|
||||||
|
<p1 x="260" y="120"/>
|
||||||
|
<p2 x="300" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="400" y="120"/>
|
||||||
|
<p2 x="440" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="120"/>
|
||||||
|
<p2 x="200" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="540" y="120"/>
|
||||||
|
<p2 x="580" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="440" y="120"/>
|
||||||
|
<p2 x="480" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="300" y="120"/>
|
||||||
|
<p2 x="340" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="200"/>
|
||||||
|
<p2 x="180" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="180" y="200"/>
|
||||||
|
<p2 x="320" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="320" y="200"/>
|
||||||
|
<p2 x="460" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="180" y="140"/>
|
||||||
|
<p2 x="200" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="320" y="140"/>
|
||||||
|
<p2 x="340" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="460" y="140"/>
|
||||||
|
<p2 x="480" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="320" y="140"/>
|
||||||
|
<p2 x="320" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="580" y="80"/>
|
||||||
|
<p2 x="580" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="180" y="140"/>
|
||||||
|
<p2 x="180" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="440" y="80"/>
|
||||||
|
<p2 x="440" y="120"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="460" y="140"/>
|
||||||
|
<p2 x="460" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="300" y="80"/>
|
||||||
|
<p2 x="300" y="120"/>
|
||||||
|
</wire>
|
||||||
|
</wires>
|
||||||
</circuit>
|
</circuit>
|
@ -4,6 +4,7 @@ import de.neemann.digital.core.ObservableValue;
|
|||||||
import de.neemann.digital.core.element.ElementAttributes;
|
import de.neemann.digital.core.element.ElementAttributes;
|
||||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||||
import de.neemann.digital.core.element.Keys;
|
import de.neemann.digital.core.element.Keys;
|
||||||
|
import de.neemann.digital.core.element.PinDescription;
|
||||||
|
|
||||||
import static de.neemann.digital.core.element.PinInfo.input;
|
import static de.neemann.digital.core.element.PinInfo.input;
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ public class DiodeBackward extends DiodeForeward {
|
|||||||
* @param attr the elements attributes
|
* @param attr the elements attributes
|
||||||
*/
|
*/
|
||||||
public DiodeBackward(ElementAttributes attr) {
|
public DiodeBackward(ElementAttributes attr) {
|
||||||
super(attr, DESCRIPTION);
|
super(attr, DESCRIPTION, PinDescription.PullResistor.pullUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package de.neemann.digital.core.pld;
|
package de.neemann.digital.core.pld;
|
||||||
|
|
||||||
import de.neemann.digital.core.*;
|
import de.neemann.digital.core.*;
|
||||||
import de.neemann.digital.core.element.Element;
|
import de.neemann.digital.core.element.*;
|
||||||
import de.neemann.digital.core.element.ElementAttributes;
|
import de.neemann.digital.core.wiring.bus.CommonBusValue;
|
||||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.digital.core.element.Keys;
|
|
||||||
|
|
||||||
import static de.neemann.digital.core.element.PinInfo.input;
|
import static de.neemann.digital.core.element.PinInfo.input;
|
||||||
|
|
||||||
@ -24,6 +23,7 @@ public class DiodeForeward implements Element, Observer {
|
|||||||
private final ObservableValue output;
|
private final ObservableValue output;
|
||||||
private final boolean blown;
|
private final boolean blown;
|
||||||
private ObservableValue input;
|
private ObservableValue input;
|
||||||
|
private PinDescription.PullResistor requiredResistor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
@ -31,17 +31,19 @@ public class DiodeForeward implements Element, Observer {
|
|||||||
* @param attr the elements attributes
|
* @param attr the elements attributes
|
||||||
*/
|
*/
|
||||||
public DiodeForeward(ElementAttributes attr) {
|
public DiodeForeward(ElementAttributes attr) {
|
||||||
this(attr, DESCRIPTION);
|
this(attr, DESCRIPTION, PinDescription.PullResistor.pullDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
*
|
*
|
||||||
* @param attr the elements attributes
|
* @param attr the elements attributes
|
||||||
* @param description used to set the output pin description
|
* @param description used to set the output pin description
|
||||||
|
* @param requiredResistor resistor needed at the output net
|
||||||
*/
|
*/
|
||||||
protected DiodeForeward(ElementAttributes attr, ElementTypeDescription description) {
|
protected DiodeForeward(ElementAttributes attr, ElementTypeDescription description, PinDescription.PullResistor requiredResistor) {
|
||||||
output = new ObservableValue("out", 1, true).setPinDescription(description);
|
output = new ObservableValue("out", 1, true).setPinDescription(description).setBidirectional();
|
||||||
|
this.requiredResistor = requiredResistor;
|
||||||
blown = attr.get(Keys.BLOWN);
|
blown = attr.get(Keys.BLOWN);
|
||||||
if (blown)
|
if (blown)
|
||||||
output.set(1, true);
|
output.set(1, true);
|
||||||
@ -50,6 +52,17 @@ public class DiodeForeward implements Element, Observer {
|
|||||||
@Override
|
@Override
|
||||||
public void setInputs(ObservableValues inputs) throws NodeException {
|
public void setInputs(ObservableValues inputs) throws NodeException {
|
||||||
input = inputs.get(0).addObserverToValue(this).checkBits(1, null);
|
input = inputs.get(0).addObserverToValue(this).checkBits(1, null);
|
||||||
|
|
||||||
|
ObservableValue o = inputs.get(1);
|
||||||
|
if (o instanceof CommonBusValue) {
|
||||||
|
CommonBusValue cbv = (CommonBusValue) o;
|
||||||
|
if (cbv.getResistor().equals(requiredResistor))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (requiredResistor.equals(PinDescription.PullResistor.pullDown))
|
||||||
|
throw new NodeException(Lang.get("err_diodeNeedsPullDownResistorAtOutput"), output.asList());
|
||||||
|
else
|
||||||
|
throw new NodeException(Lang.get("err_diodeNeedsPullUpResistorAtOutput"), output.asList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,6 +8,7 @@ import de.neemann.digital.core.wiring.Clock;
|
|||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
@ -47,23 +48,31 @@ public class TestResult {
|
|||||||
*/
|
*/
|
||||||
public TestResult create(Model model) throws TestingDataException, NodeException {
|
public TestResult create(Model model) throws TestingDataException, NodeException {
|
||||||
allPassed = true;
|
allPassed = true;
|
||||||
|
HashSet<String> usedSignals = new HashSet<>();
|
||||||
|
|
||||||
ArrayList<TestSignal> inputs = new ArrayList<>();
|
ArrayList<TestSignal> inputs = new ArrayList<>();
|
||||||
for (Signal s : model.getInputs()) {
|
for (Signal s : model.getInputs()) {
|
||||||
final int index = getIndexOf(s.getName());
|
final int index = getIndexOf(s.getName());
|
||||||
if (index >= 0)
|
if (index >= 0) {
|
||||||
inputs.add(new TestSignal(index, s.getValue()));
|
inputs.add(new TestSignal(index, s.getValue()));
|
||||||
|
usedSignals.add(s.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (Clock c : model.getClocks()) {
|
for (Clock c : model.getClocks()) {
|
||||||
final int index = getIndexOf(c.getLabel());
|
final int index = getIndexOf(c.getLabel());
|
||||||
if (index >= 0)
|
if (index >= 0) {
|
||||||
inputs.add(new TestSignal(index, c.getClockOutput()));
|
inputs.add(new TestSignal(index, c.getClockOutput()));
|
||||||
|
usedSignals.add(c.getLabel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<TestSignal> outputs = new ArrayList<>();
|
ArrayList<TestSignal> outputs = new ArrayList<>();
|
||||||
for (Signal s : model.getOutputs()) {
|
for (Signal s : model.getOutputs()) {
|
||||||
final int index = getIndexOf(s.getName());
|
final int index = getIndexOf(s.getName());
|
||||||
if (index >= 0)
|
if (index >= 0) {
|
||||||
outputs.add(new TestSignal(index, s.getValue()));
|
outputs.add(new TestSignal(index, s.getValue()));
|
||||||
|
usedSignals.add(s.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.size() == 0)
|
if (inputs.size() == 0)
|
||||||
@ -72,6 +81,10 @@ public class TestResult {
|
|||||||
if (outputs.size() == 0)
|
if (outputs.size() == 0)
|
||||||
throw new TestingDataException(Lang.get("err_noTestOutputSignalsDefined"));
|
throw new TestingDataException(Lang.get("err_noTestOutputSignalsDefined"));
|
||||||
|
|
||||||
|
for (String name : names)
|
||||||
|
if (!usedSignals.contains(name))
|
||||||
|
throw new TestingDataException(Lang.get("err_testSignal_N_notFound", name));
|
||||||
|
|
||||||
model.init();
|
model.init();
|
||||||
|
|
||||||
for (Value[] rowWithDontCare : lines) {
|
for (Value[] rowWithDontCare : lines) {
|
||||||
|
@ -338,8 +338,8 @@ Die gesammte Speichergröße beträgt damit damit dx*dy*2 Speicherworte.</string
|
|||||||
Wird verwendet um ein "Wired And" zu implementieren.
|
Wird verwendet um ein "Wired And" zu implementieren.
|
||||||
Innerhalb der Simulation verhält sich eine Diode wie ein aktives Gatter mit dreiwerteiger Wertetabelle:
|
Innerhalb der Simulation verhält sich eine Diode wie ein aktives Gatter mit dreiwerteiger Wertetabelle:
|
||||||
Ist der Eingang 0 ist auch der Ausgang 0. In den anderen Fällen (1 und hochohmig) ist der Ausgang hochohmig (High Z).
|
Ist der Eingang 0 ist auch der Ausgang 0. In den anderen Fällen (1 und hochohmig) ist der Ausgang hochohmig (High Z).
|
||||||
Damit können sich antiparallele zusammen geschaltete Dioden gegenseiting im low-Zustand halten, was mit realen
|
Damit können sich antiparallel zusammen geschaltete Dioden gegenseitig im low-Zustand halten, was mit realen
|
||||||
Dioden nicht möglich ist.
|
Dioden nicht möglich ist. Daher ist am Ausgang ein Pull Up Widerstand erforderlich!
|
||||||
Es handelt sich um eine ideale Diode: In Durchlassrichtung gibt es keinen Spannungabfall über der Diode.</string>
|
Es handelt sich um eine ideale Diode: In Durchlassrichtung gibt es keinen Spannungabfall über der Diode.</string>
|
||||||
<string name="elem_DiodeBackward_pin_in">Ist der Eingang 0 ist auch der Ausgang 0. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
<string name="elem_DiodeBackward_pin_in">Ist der Eingang 0 ist auch der Ausgang 0. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
||||||
<string name="elem_DiodeBackward_pin_out">Ist der Eingang 0 ist auch der Ausgang 0. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
<string name="elem_DiodeBackward_pin_out">Ist der Eingang 0 ist auch der Ausgang 0. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
||||||
@ -348,8 +348,8 @@ Die gesammte Speichergröße beträgt damit damit dx*dy*2 Speicherworte.</string
|
|||||||
Wird verwendet um ein "Wired Or" zu implementieren.
|
Wird verwendet um ein "Wired Or" zu implementieren.
|
||||||
Innerhalb der Simulation verhält sich eine Diode wie ein aktives Gatter mit dreiwerteiger Wertetabelle:
|
Innerhalb der Simulation verhält sich eine Diode wie ein aktives Gatter mit dreiwerteiger Wertetabelle:
|
||||||
Ist der Eingang 1 ist auch der Ausgang 1. In den anderen Fällen (0 und hochohmig) ist der Ausgang hochohmig (High Z).
|
Ist der Eingang 1 ist auch der Ausgang 1. In den anderen Fällen (0 und hochohmig) ist der Ausgang hochohmig (High Z).
|
||||||
Damit können sich antiparallel zusammen geschaltete Dioden gegenseiting im high-Zustand halten, was mit realen
|
Damit können sich antiparallel zusammen geschaltete Dioden gegenseitig im high-Zustand halten, was mit realen
|
||||||
Dioden nicht möglich ist.
|
Dioden nicht möglich ist. Daher ist am Ausgang ein Pull Down Widerstand erforderlich!
|
||||||
Es handelt sich um eine ideale Diode: In Durchlassrichtung gibt es keinen Spannungabfall über der Diode.</string>
|
Es handelt sich um eine ideale Diode: In Durchlassrichtung gibt es keinen Spannungabfall über der Diode.</string>
|
||||||
<string name="elem_DiodeForeward_pin_in">Ist der Eingang 1 ist auch der Ausgang 1. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
<string name="elem_DiodeForeward_pin_in">Ist der Eingang 1 ist auch der Ausgang 1. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
||||||
<string name="elem_DiodeForeward_pin_out">Ist der Eingang 1 ist auch der Ausgang 1. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
<string name="elem_DiodeForeward_pin_out">Ist der Eingang 1 ist auch der Ausgang 1. In allen anderen Fällen ist der Ausgang hochohmig.</string>
|
||||||
@ -486,6 +486,9 @@ Es sind nur {1} Variablen erlaubt, es wurden jedoch {2} gefunden.</string>
|
|||||||
<string name="err_minimizationFailed">Das Ergebnis der Minimierung ist nicht korrekt!
|
<string name="err_minimizationFailed">Das Ergebnis der Minimierung ist nicht korrekt!
|
||||||
Sind evtl. die Namen der Variablen nicht eindeutig?</string>
|
Sind evtl. die Namen der Variablen nicht eindeutig?</string>
|
||||||
<string name="err_toManyTestEntries">Zu viele Einträge in der Testdatenmatrix.</string>
|
<string name="err_toManyTestEntries">Zu viele Einträge in der Testdatenmatrix.</string>
|
||||||
|
<string name="err_diodeNeedsPullUpResistorAtOutput">Diode benötigt am Ausgang einen PullUp-Widerstand!</string>
|
||||||
|
<string name="err_diodeNeedsPullDownResistorAtOutput">Diode benötigt am Ausgang einen PullDown-Widerstand!</string>
|
||||||
|
<string name="err_testSignal_N_notFound">Testsignal {0} in der Schaltung nicht gefunden!</string>
|
||||||
|
|
||||||
<string name="key_AddrBits">Adress-Bits</string>
|
<string name="key_AddrBits">Adress-Bits</string>
|
||||||
<string name="key_AddrBits_tt">Anzahl der Adress-Bits die verwendet werden.</string>
|
<string name="key_AddrBits_tt">Anzahl der Adress-Bits die verwendet werden.</string>
|
||||||
|
@ -331,6 +331,8 @@
|
|||||||
<string name="elem_DiodeBackward">Diode to Ground</string>
|
<string name="elem_DiodeBackward">Diode to Ground</string>
|
||||||
<string name="elem_DiodeBackward_tt">A simplified unidirectional diode, used to pull a wire to ground. It is used to implement a wired AND.
|
<string name="elem_DiodeBackward_tt">A simplified unidirectional diode, used to pull a wire to ground. It is used to implement a wired AND.
|
||||||
Is the input low, also the output is low. In the other cases (input is high or high z) the output is in high z state.
|
Is the input low, also the output is low. In the other cases (input is high or high z) the output is in high z state.
|
||||||
|
So two anti parallel connected diodes can keep each other in low state, which is not possible with real diodes.
|
||||||
|
To aviod such problems, it is necessary to connect a pull up resistor to the diods output.
|
||||||
So this is a ideal diode: There is no voltage drop across a forward-biased diode.</string>
|
So this is a ideal diode: There is no voltage drop across a forward-biased diode.</string>
|
||||||
<string name="elem_DiodeBackward_pin_in">If the input is low also the output is low. In all other cases the output is in high z state.</string>
|
<string name="elem_DiodeBackward_pin_in">If the input is low also the output is low. In all other cases the output is in high z state.</string>
|
||||||
<string name="elem_DiodeBackward_pin_out">If the input is low also the output is low. In all other cases the output is in high z state.</string>
|
<string name="elem_DiodeBackward_pin_out">If the input is low also the output is low. In all other cases the output is in high z state.</string>
|
||||||
@ -338,7 +340,8 @@
|
|||||||
<string name="elem_DiodeForeward_tt">A simplified unidirectional diode, used to pull a wire to VDD. It is used to implement a wired OR.
|
<string name="elem_DiodeForeward_tt">A simplified unidirectional diode, used to pull a wire to VDD. It is used to implement a wired OR.
|
||||||
In the simulation the diode behaves like an active gate with a trivalent truth table:
|
In the simulation the diode behaves like an active gate with a trivalent truth table:
|
||||||
Is the input high, also the output is high. In all other cases (input is low or high z) the output is in high z state.
|
Is the input high, also the output is high. In all other cases (input is low or high z) the output is in high z state.
|
||||||
So two antiparallel connected diodes can keep each other in high state, which is not possible with real diodes.
|
So two anti parallel connected diodes can keep each other in high state, which is not possible with real diodes.
|
||||||
|
To aviod such problems, it is necessary to connect a pull down resistor to the diods output.
|
||||||
This is an ideal diode: There is no voltage drop across a forward-biased diode.</string>
|
This is an ideal diode: There is no voltage drop across a forward-biased diode.</string>
|
||||||
<string name="elem_DiodeForeward_pin_in">If the input is high also the output is high. In all other cases the output is in high z state.</string>
|
<string name="elem_DiodeForeward_pin_in">If the input is high also the output is high. In all other cases the output is in high z state.</string>
|
||||||
<string name="elem_DiodeForeward_pin_out">If the input is high also the output is high. In all other cases the output is in high z state.</string>
|
<string name="elem_DiodeForeward_pin_out">If the input is high also the output is high. In all other cases the output is in high z state.</string>
|
||||||
@ -473,6 +476,9 @@ allowed are {1} variables but {2} are found.</string>
|
|||||||
<string name="err_minimizationFailed">The result of the minimization is not correct!
|
<string name="err_minimizationFailed">The result of the minimization is not correct!
|
||||||
The names of the variables may not be unique.</string>
|
The names of the variables may not be unique.</string>
|
||||||
<string name="err_toManyTestEntries">To many entries in the test data matrix.</string>
|
<string name="err_toManyTestEntries">To many entries in the test data matrix.</string>
|
||||||
|
<string name="err_diodeNeedsPullUpResistorAtOutput">Diode needs a pull up resistor at its output!</string>
|
||||||
|
<string name="err_diodeNeedsPullDownResistorAtOutput">Diode needs a pull down resistor at its output!</string>
|
||||||
|
<string name="err_testSignal_N_notFound">Test signal {0} not found in the circuit!</string>
|
||||||
|
|
||||||
<string name="key_AddrBits">Address Bits</string>
|
<string name="key_AddrBits">Address Bits</string>
|
||||||
<string name="key_AddrBits_tt">Number of address bits used.</string>
|
<string name="key_AddrBits_tt">Number of address bits used.</string>
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
package de.neemann.digital.core.pld;
|
|
||||||
|
|
||||||
import de.neemann.digital.core.ObservableValue;
|
|
||||||
import de.neemann.digital.core.ObservableValues;
|
|
||||||
import de.neemann.digital.core.element.ElementAttributes;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by hneemann on 01.11.16.
|
|
||||||
*/
|
|
||||||
public class DirectionalDiodeTest extends TestCase {
|
|
||||||
|
|
||||||
public void testDiodeForeward() throws Exception {
|
|
||||||
ObservableValue a = new ObservableValue("a", 1);
|
|
||||||
|
|
||||||
DiodeForeward diodeForeward = new DiodeForeward(new ElementAttributes());
|
|
||||||
diodeForeward.setInputs(a.asList());
|
|
||||||
diodeForeward.init(null);
|
|
||||||
|
|
||||||
ObservableValues outputs = diodeForeward.getOutputs();
|
|
||||||
assertEquals(1, outputs.size());
|
|
||||||
|
|
||||||
ObservableValue output = outputs.get(0);
|
|
||||||
|
|
||||||
a.setBool(true);
|
|
||||||
assertEquals(false, output.isHighZ());
|
|
||||||
assertEquals(1, output.getValue());
|
|
||||||
a.setBool(false);
|
|
||||||
assertEquals(true, output.isHighZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDiodeBackward() throws Exception {
|
|
||||||
ObservableValue a = new ObservableValue("a", 1);
|
|
||||||
|
|
||||||
DiodeBackward diodeBackward = new DiodeBackward(new ElementAttributes());
|
|
||||||
diodeBackward.setInputs(a.asList());
|
|
||||||
diodeBackward.init(null);
|
|
||||||
|
|
||||||
ObservableValues outputs = diodeBackward.getOutputs();
|
|
||||||
assertEquals(1, outputs.size());
|
|
||||||
|
|
||||||
ObservableValue output = outputs.get(0);
|
|
||||||
|
|
||||||
a.setBool(true);
|
|
||||||
assertEquals(true, output.isHighZ());
|
|
||||||
a.setBool(false);
|
|
||||||
assertEquals(false, output.isHighZ());
|
|
||||||
assertEquals(0, output.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -29,7 +29,7 @@ public class TestExamples extends TestCase {
|
|||||||
public void testDistExamples() throws Exception {
|
public void testDistExamples() throws Exception {
|
||||||
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
||||||
assertEquals(111, new FileScanner(this::check).scan(examples));
|
assertEquals(111, new FileScanner(this::check).scan(examples));
|
||||||
assertEquals(71, testCasesInFiles);
|
assertEquals(72, testCasesInFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,8 +39,8 @@ public class TestExamples extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testTestExamples() throws Exception {
|
public void testTestExamples() throws Exception {
|
||||||
File examples = new File(Resources.getRoot(), "/dig/test");
|
File examples = new File(Resources.getRoot(), "/dig/test");
|
||||||
assertEquals(56, new FileScanner(this::check).scan(examples));
|
assertEquals(55, new FileScanner(this::check).scan(examples));
|
||||||
assertEquals(52, testCasesInFiles);
|
assertEquals(51, testCasesInFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<string>Y</string>
|
<string>Y</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="320" y="220"/>
|
<pos x="340" y="220"/>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
<elementName>Testcase</elementName>
|
<elementName>Testcase</elementName>
|
||||||
@ -29,9 +29,9 @@
|
|||||||
<string>Testdata</string>
|
<string>Testdata</string>
|
||||||
<testData>
|
<testData>
|
||||||
<dataString>A Y
|
<dataString>A Y
|
||||||
1 Z
|
1 1
|
||||||
0 0
|
0 0
|
||||||
Z Z</dataString>
|
Z 1</dataString>
|
||||||
</testData>
|
</testData>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
@ -47,6 +47,11 @@ Z Z</dataString>
|
|||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="280" y="220"/>
|
<pos x="280" y="220"/>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>PullUp</elementName>
|
||||||
|
<elementAttributes/>
|
||||||
|
<pos x="320" y="200"/>
|
||||||
|
</visualElement>
|
||||||
</visualElements>
|
</visualElements>
|
||||||
<wires>
|
<wires>
|
||||||
<wire>
|
<wire>
|
||||||
@ -57,5 +62,13 @@ Z Z</dataString>
|
|||||||
<p1 x="300" y="220"/>
|
<p1 x="300" y="220"/>
|
||||||
<p2 x="320" y="220"/>
|
<p2 x="320" y="220"/>
|
||||||
</wire>
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="320" y="220"/>
|
||||||
|
<p2 x="340" y="220"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="320" y="200"/>
|
||||||
|
<p2 x="320" y="220"/>
|
||||||
|
</wire>
|
||||||
</wires>
|
</wires>
|
||||||
</circuit>
|
</circuit>
|
@ -30,7 +30,7 @@
|
|||||||
<string>Y</string>
|
<string>Y</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="320" y="140"/>
|
<pos x="340" y="140"/>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
<elementName>Testcase</elementName>
|
<elementName>Testcase</elementName>
|
||||||
@ -40,14 +40,19 @@
|
|||||||
<testData>
|
<testData>
|
||||||
<dataString>A Y
|
<dataString>A Y
|
||||||
1 1
|
1 1
|
||||||
0 Z
|
0 0
|
||||||
Z Z
|
Z 0
|
||||||
</dataString>
|
</dataString>
|
||||||
</testData>
|
</testData>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="420" y="100"/>
|
<pos x="420" y="100"/>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>PullDown</elementName>
|
||||||
|
<elementAttributes/>
|
||||||
|
<pos x="320" y="160"/>
|
||||||
|
</visualElement>
|
||||||
</visualElements>
|
</visualElements>
|
||||||
<wires>
|
<wires>
|
||||||
<wire>
|
<wire>
|
||||||
@ -58,5 +63,13 @@ Z Z
|
|||||||
<p1 x="300" y="140"/>
|
<p1 x="300" y="140"/>
|
||||||
<p2 x="320" y="140"/>
|
<p2 x="320" y="140"/>
|
||||||
</wire>
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="320" y="140"/>
|
||||||
|
<p2 x="340" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="320" y="140"/>
|
||||||
|
<p2 x="320" y="160"/>
|
||||||
|
</wire>
|
||||||
</wires>
|
</wires>
|
||||||
</circuit>
|
</circuit>
|
Loading…
x
Reference in New Issue
Block a user