summaryrefslogtreecommitdiff
path: root/tests/realmath/generate.py
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-06-15 08:48:41 +0200
committerClifford Wolf <clifford@clifford.at>2014-06-15 08:48:41 +0200
commit656685fa31b54cebf0210518d3cac8aa496dddd7 (patch)
tree6738f9fd818e70059f30cc0f7cea69a8867ea8bb /tests/realmath/generate.py
parent7f57bc838517a5660beaf0645d7bb4cc6ed71ce9 (diff)
Improved realmath test bench
Diffstat (limited to 'tests/realmath/generate.py')
-rw-r--r--tests/realmath/generate.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/realmath/generate.py b/tests/realmath/generate.py
index af7648b8..58cedf02 100644
--- a/tests/realmath/generate.py
+++ b/tests/realmath/generate.py
@@ -62,11 +62,19 @@ for idx in range(100):
print('task compare_ref_syn;')
print(' input [7:0] i;')
print(' input [63:0] r, s;')
+ print(' reg [64*8-1:0] buffer;')
+ print(' integer j;')
print(' begin')
- print(' if (-3 < $signed(r-s) && $signed(r-s) < +3)')
- print(' $display("%d: %b %b", i, r, s);')
- print(' else')
- print(' $display("%d: %b %b %s", i, r, s, r !== s ? "TRIG" : "");')
+ print(' if (-1 <= $signed(r-s) && $signed(r-s) <= +1) begin')
+ print(' // $display("%d: %b %b", i, r, s);')
+ print(' end else if (r === s) begin ')
+ print(' // $display("%d: %b %b", i, r, s);')
+ print(' end else begin ')
+ print(' for (j = 0; j < 64; j = j+1)')
+ print(' buffer[j*8 +: 8] = r[j] !== s[j] ? "^" : " ";')
+ print(' $display("\\n%3d: %b %b", i, r, s);')
+ print(' $display(" %s %s", buffer, buffer);')
+ print(' end')
print(' end')
print('endtask')
print('initial begin #1;')