mirror of
https://github.com/hneemann/Digital.git
synced 2025-10-03 01:41:16 -04:00
shows an error if a test data signal is used twice
This commit is contained in:
parent
5fd30c8d13
commit
6ed91b59cb
@ -5,6 +5,7 @@ import de.neemann.gui.language.Language;
|
||||
import de.neemann.gui.language.Resources;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
@ -90,6 +91,7 @@ public final class Lang {
|
||||
else
|
||||
currentLanguage = new Language("en");
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used for generation of documentation
|
||||
*
|
||||
@ -111,9 +113,9 @@ public final class Lang {
|
||||
// if the 'testdata' system property is set, let the test fail!
|
||||
// If we are in production usage, don't let the program crash, simply return the key itself instead!
|
||||
if (System.getProperty("testdata") != null)
|
||||
throw new Error("missing laguage key '" + key + "'");
|
||||
throw new Error("missing language key '" + key + "'");
|
||||
|
||||
return key;
|
||||
return key + " " + Arrays.asList(params).toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,14 +61,14 @@ public class TestResult {
|
||||
final int index = getIndexOf(s.getName());
|
||||
if (index >= 0) {
|
||||
inputs.add(new TestSignal(index, s.getValue()));
|
||||
usedSignals.add(s.getName());
|
||||
addTo(usedSignals, s.getName());
|
||||
}
|
||||
}
|
||||
for (Clock c : model.getClocks()) {
|
||||
final int index = getIndexOf(c.getLabel());
|
||||
if (index >= 0) {
|
||||
inputs.add(new TestSignal(index, c.getClockOutput()));
|
||||
usedSignals.add(c.getLabel());
|
||||
addTo(usedSignals, c.getLabel());
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class TestResult {
|
||||
final int index = getIndexOf(s.getName());
|
||||
if (index >= 0) {
|
||||
outputs.add(new TestSignal(index, s.getValue()));
|
||||
usedSignals.add(s.getName());
|
||||
addTo(usedSignals, s.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,6 +107,12 @@ public class TestResult {
|
||||
return this;
|
||||
}
|
||||
|
||||
private void addTo(HashSet<String> signals, String name) throws TestingDataException {
|
||||
if (signals.contains(name))
|
||||
throw new TestingDataException(Lang.get("err_nameUsedTwice_N", name));
|
||||
signals.add(name);
|
||||
}
|
||||
|
||||
private void checkRow(Model model, Value[] row) {
|
||||
Value[] res = new Value[row.length];
|
||||
|
||||
|
@ -54,7 +54,10 @@ public class Parser {
|
||||
Tokenizer.Token token = tok.simpleIdent();
|
||||
switch (token) {
|
||||
case IDENT:
|
||||
names.add(tok.getIdent());
|
||||
final String name = tok.getIdent();
|
||||
if (names.contains(name))
|
||||
throw new ParserException(Lang.get("err_nameUsedTwice_N", name));
|
||||
names.add(name);
|
||||
break;
|
||||
case EOL:
|
||||
return;
|
||||
|
@ -424,7 +424,8 @@ Die gesammte Speichergröße beträgt damit damit dx*dy*2 Speicherworte.</string
|
||||
<string name="elem_LedMatrix_pin_c-addr">Die Nummer der aktuellen Spalte, dessen Zustand gerade am anderen Eingang anliegt.</string>
|
||||
|
||||
<string name="elem_TransGate">Transmissionsgatter</string>
|
||||
<string name="elem_TransGate_tt">Ein reales Transmissionsgatter ist aus nur zwei Transistoren aufgebaut.</string>
|
||||
<string name="elem_TransGate_tt">Ein reales Transmissionsgatter ist aus nur zwei Transistoren aufgebaut.
|
||||
Daher wird es oft eingesetzt um Transistoren einzusparen.</string>
|
||||
<string name="elem_TransGate_pin_A">Eingang A</string>
|
||||
<string name="elem_TransGate_pin_B">Eingang_B</string>
|
||||
<string name="elem_TransGate_pin_S">Steuereingang</string>
|
||||
@ -523,6 +524,7 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
|
||||
<string name="err_toManyBits_Found_N0_maxIs_N1">Es sind nur {1} Bits erlaubt, es sind jedoch {0} Bits angegeben!</string>
|
||||
<string name="err_MultiBitFlipFlopFound">Es sind keine Flipflops mit mehr als einem Bit erlaubt!</string>
|
||||
<string name="err_invalidTransmissionGateState">Die Steuereingänge eines Transmission-Gates müssen invertiert beschaltet werden!</string>
|
||||
<string name="err_nameUsedTwice_N">Signal {0} wurde mehrfach verwendet!</string>
|
||||
|
||||
<string name="key_AddrBits">Adress-Bits</string>
|
||||
<string name="key_AddrBits_tt">Anzahl der Adress-Bits die verwendet werden.</string>
|
||||
|
@ -414,7 +414,8 @@
|
||||
<string name="elem_LedMatrix_pin_c-addr">The number of the current column whose state is currently visible at the other input.</string>
|
||||
|
||||
<string name="elem_TransGate">Transmission-Gate</string>
|
||||
<string name="elem_TransGate_tt">A real transmission-gate is build from only two transistors.</string>
|
||||
<string name="elem_TransGate_tt">A real transmission-gate is build from only two transistors.
|
||||
Therefore, it is often used to save transistors during implementation on silicon.</string>
|
||||
<string name="elem_TransGate_pin_A">input A</string>
|
||||
<string name="elem_TransGate_pin_B">input B</string>
|
||||
<string name="elem_TransGate_pin_S">control input.</string>
|
||||
@ -513,6 +514,7 @@ The names of the variables may not be unique.</string>
|
||||
<string name="err_toManyBits_Found_N0_maxIs_N1">Only {1} bits allowed, but {0} bits found!</string>
|
||||
<string name="err_MultiBitFlipFlopFound">Flipflops with more then one bits are not allowed!</string>
|
||||
<string name="err_invalidTransmissionGateState">The two control inputs of a transmission gate must be inverted!</string>
|
||||
<string name="err_nameUsedTwice_N">Signal {0} is used twice!</string>
|
||||
|
||||
<string name="key_AddrBits">Address Bits</string>
|
||||
<string name="key_AddrBits_tt">Number of address bits used.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user