From 32f13e4d8d5461199bc4422eea9748e8dc07990d Mon Sep 17 00:00:00 2001 From: hneemann Date: Thu, 31 Aug 2017 18:31:50 +0200 Subject: [PATCH] fixed flaky test in VHDLExample.dig --- src/main/dig/processor/VHDLExample.dig | 40 ++++++++++--------- .../de/neemann/digital/data/ValueTable.java | 23 +++++++++++ 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/src/main/dig/processor/VHDLExample.dig b/src/main/dig/processor/VHDLExample.dig index 601908efa..c50afd4da 100644 --- a/src/main/dig/processor/VHDLExample.dig +++ b/src/main/dig/processor/VHDLExample.dig @@ -341,6 +341,10 @@ Single-Cycle CPU. pinNumber U18 + + InDefault + + @@ -360,24 +364,22 @@ Single-Cycle CPU. Testdata - reset Clock U D L R Y15 Y14 Y13 Y12 Y11 Y10 Y9 Y8 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 - 1 0 0 0 0 0 x x x x x x x x x x x x x x x x - 1 1 0 0 0 0 x x x x x x x x x x x x x x x x - 0 0 0 0 0 0 x x x x x x x x x x x x x x x x + reset Clock U D L R Y15 Y14 Y13 Y12 Y11 Y10 Y9 Y8 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 + 1 0 0 0 0 0 x x x x x x x x x x x x x x x x + 1 1 0 0 0 0 x x x x x x x x x x x x x x x x + 1 0 0 0 0 0 x x x x x x x x x x x x x x x x + 0 0 0 0 0 0 x x x x x x x x x x x x x x x x -repeat(11) 0 C 0 0 0 0 x x x x x x x x x x x x x x x x - 0 C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 - -loop(i,14) -repeat(12) 0 C 0 0 0 0 x x x x x x x x x x x x x x x x - 0 C 0 0 0 0 bits(16,1<<(i+1)) -end loop - -repeat(14) 0 C 0 0 0 0 x x x x x x x x x x x x x x x x +repeat(12) 0 C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 loop(i,15) -repeat(11) 0 C 0 0 0 0 x x x x x x x x x x x x x x x x - 0 C 0 0 0 0 bits(16,1<<(15-i)) +repeat(13) 0 C 0 0 0 0 bits(16,1<<i) +end loop + +repeat(2) 0 C 0 0 0 0 bits(16,1<<14) + +loop(i,15) +repeat(12) 0 C 0 0 0 0 bits(16,1<<(15-i)) end loop @@ -613,14 +615,14 @@ end loop - - - - + + + + diff --git a/src/main/java/de/neemann/digital/data/ValueTable.java b/src/main/java/de/neemann/digital/data/ValueTable.java index 0c9fcb411..96e308e10 100644 --- a/src/main/java/de/neemann/digital/data/ValueTable.java +++ b/src/main/java/de/neemann/digital/data/ValueTable.java @@ -217,4 +217,27 @@ public class ValueTable extends Observable implements Iterable { this.maxSize = maxSize; return this; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + for (String n : names) + sb.append(n).append(" "); + sb.append("\n"); + + if (tableRowIndex == null) + for (Value[] row : values) { + for (Value v : row) + sb.append(v.toString()).append(" "); + sb.append("\n"); + } + else + for (int i : tableRowIndex) { + for (Value v : values.get(i)) + sb.append(v.toString()).append(" "); + sb.append("\n"); + } + + return sb.toString(); + } }