diff --git a/src/main/dig/combinatorial/Comp7485Parall.dig b/src/main/dig/combinatorial/Comp7485Parall.dig index 9aab4af73..9e448be09 100644 --- a/src/main/dig/combinatorial/Comp7485Parall.dig +++ b/src/main/dig/combinatorial/Comp7485Parall.dig @@ -10,7 +10,7 @@ Comp7485.dig - + Comp7485.dig @@ -20,12 +20,12 @@ Comp7485.dig - + Const - + Const @@ -35,7 +35,7 @@ 0 - + Const @@ -45,7 +45,7 @@ 0 - + Const @@ -95,7 +95,7 @@ A_0 - + In @@ -105,7 +105,7 @@ A_1 - + In @@ -115,7 +115,7 @@ A_2 - + In @@ -125,7 +125,7 @@ A_3 - + In @@ -135,7 +135,7 @@ B_0 - + In @@ -145,7 +145,7 @@ B_1 - + In @@ -155,7 +155,7 @@ B_2 - + In @@ -165,7 +165,7 @@ B_3 - + Const @@ -200,7 +200,7 @@ A_4 - + In @@ -210,7 +210,7 @@ A_5 - + In @@ -220,7 +220,7 @@ A_6 - + In @@ -230,7 +230,7 @@ A_7 - + In @@ -240,7 +240,7 @@ B_4 - + In @@ -260,7 +260,7 @@ B_6 - + In @@ -270,12 +270,12 @@ B_7 - + Const - + Const @@ -285,7 +285,7 @@ 0 - + Const @@ -295,7 +295,7 @@ 0 - + In @@ -305,7 +305,7 @@ A_8 - + In @@ -315,7 +315,7 @@ A_9 - + In @@ -325,7 +325,7 @@ A_10 - + In @@ -335,7 +335,7 @@ A_11 - + In @@ -345,7 +345,7 @@ B_8 - + In @@ -355,7 +355,7 @@ B_9 - + In @@ -365,7 +365,7 @@ B_10 - + In @@ -375,7 +375,7 @@ B_11 - + Out @@ -426,32 +426,32 @@ Testdata A_11 A_10 A_9 A_8 A_7 A_6 A_5 A_4 A_3 A_2 A_1 A_0 B_11 B_10 B_9 B_8 B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0 P<Q P=Q P>Q -repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n&0xff)) ((n>>8)=(n&0xff)) ((n>>8)>(n&0xff)) +repeat(1<<24) bits(12,n>>12) bits(12,n&0xfff) ((n>>12)<(n&0xfff)) ((n>>12)=(n&0xfff)) ((n>>12)>(n&0xfff)) - + - + - + - + - + - + @@ -466,24 +466,20 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - - - - - + - + - + @@ -495,40 +491,24 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - - - - - - - - - + - - + + - - - - - - - - - - + + - + - - + + @@ -539,28 +519,12 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - - - - - - - - - - - - - + - - - - - - + + @@ -571,11 +535,15 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - - + + - + + + + + @@ -587,7 +555,7 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - + @@ -595,113 +563,81 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - - - - - + - - - - - - + + - - + + - - + + - - + + - + - - - - - - - - - - - - - - - - - - + + - - - - - - + + + + + + - - - - - + - - + + + + + + - - - - - - - - @@ -711,100 +647,44 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -814,29 +694,5 @@ repeat(1<<16) bits(12,n>>8) bits(12,n&0xff) ((n>>8)<(n& - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/de/neemann/digital/testing/TestResult.java b/src/main/java/de/neemann/digital/testing/TestResult.java index 92aecb438..3c361b4df 100644 --- a/src/main/java/de/neemann/digital/testing/TestResult.java +++ b/src/main/java/de/neemann/digital/testing/TestResult.java @@ -22,12 +22,15 @@ import java.util.NoSuchElementException; * @author hneemann */ public class TestResult { + private static final int MAX_RESULTS = 1 << 10; + private static final int ERR_RESULTS = MAX_RESULTS * 2; private final ArrayList names; private final LineEmitter lines; private final ArrayList results; private boolean allPassed; private Exception exception; + private boolean toManyResults = false; /** * Creates a new testing result @@ -132,13 +135,20 @@ public class TestResult { throw new RuntimeException(e); } + boolean ok = true; for (TestSignal out : outputs) { MatchedValue matchedValue = new MatchedValue(row[out.index], out.value); res[out.index] = matchedValue; - if (!matchedValue.isPassed()) + if (!matchedValue.isPassed()) { allPassed = false; + ok = false; + } } - results.add(res); + + if (results.size() < (ok ? MAX_RESULTS : ERR_RESULTS)) + results.add(res); + else + toManyResults = true; } }, new Context()); } catch (ParserException e) { @@ -176,6 +186,17 @@ public class TestResult { return allPassed; } + + /** + * Indicates if there are to many entries in the table to show. + * If there are to many entries, the test results is still correct. + * + * @return true if there are missing items in the results list. + */ + public boolean isToManyResults() { + return toManyResults; + } + private int getIndexOf(String name) { if (name == null || name.length() == 0) return -1; diff --git a/src/main/java/de/neemann/digital/testing/parser/LineEmitterRepeat.java b/src/main/java/de/neemann/digital/testing/parser/LineEmitterRepeat.java index a6b0de1d3..a8e918019 100644 --- a/src/main/java/de/neemann/digital/testing/parser/LineEmitterRepeat.java +++ b/src/main/java/de/neemann/digital/testing/parser/LineEmitterRepeat.java @@ -1,10 +1,13 @@ package de.neemann.digital.testing.parser; +import de.neemann.digital.lang.Lang; + /** * Repeats some inner table rows. * Created by hneemann on 19.04.17. */ public class LineEmitterRepeat implements LineEmitter { + private static final int MAX_LOOPS = 1 << 24; private final String name; private final int size; @@ -16,11 +19,15 @@ public class LineEmitterRepeat implements LineEmitter { * @param name name of the loop variable * @param size number of iterations * @param inner the lines to repeat + * @throws ParserException if there are to many iterations */ - public LineEmitterRepeat(String name, int size, LineEmitter inner) { + public LineEmitterRepeat(String name, int size, LineEmitter inner) throws ParserException { this.name = name; this.size = size; this.inner = inner; + + if (size > MAX_LOOPS) + throw new ParserException(Lang.get("err_toManyIterations")); } @Override diff --git a/src/main/java/de/neemann/digital/testing/parser/Parser.java b/src/main/java/de/neemann/digital/testing/parser/Parser.java index 9e10414ad..e653b237b 100644 --- a/src/main/java/de/neemann/digital/testing/parser/Parser.java +++ b/src/main/java/de/neemann/digital/testing/parser/Parser.java @@ -94,8 +94,6 @@ public class Parser { tok.consume(); expect(Tokenizer.Token.OPEN); int count = (int) parseInt(); - if (count > 1 << 16) - throw new ParserException(Lang.get("err_toManyTestEntries")); expect(Tokenizer.Token.CLOSE); list.add(new LineEmitterRepeat("n", count, parseSingleRow())); break; @@ -106,8 +104,6 @@ public class Parser { String var = tok.getIdent(); expect(Tokenizer.Token.COMMA); count = (int) parseInt(); - if (count > 1 << 16) - throw new ParserException(Lang.get("err_toManyTestEntries")); expect(Tokenizer.Token.CLOSE); list.add(new LineEmitterRepeat(var, count, parseRows(Tokenizer.Token.LOOP))); break; diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index f5f83f0ff..dd1314a09 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -485,7 +485,7 @@ Es sind nur {1} Variablen erlaubt, es wurden jedoch {2} gefunden. Die Schaltung {0} bindet sich selbst ein! Das Ergebnis der Minimierung ist nicht korrekt! Sind evtl. die Namen der Variablen nicht eindeutig? - Zu viele Einträge in der Testdatenmatrix. + Zu viele Iterationen in einer Schleife. Diode benötigt am Ausgang einen PullUp-Widerstand! Diode benötigt am Ausgang einen PullDown-Widerstand! Testsignal {0} in der Schaltung nicht gefunden! diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index 871012f48..e59a76a50 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -475,7 +475,7 @@ allowed are {1} variables but {2} are found. The circuit {0} imports itself! The result of the minimization is not correct! The names of the variables may not be unique. - To many entries in the test data matrix. + To many iterations in a loop. Diode needs a pull up resistor at its output! Diode needs a pull down resistor at its output! Test signal {0} not found in the circuit!