From 656685fa31b54cebf0210518d3cac8aa496dddd7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 15 Jun 2014 08:48:41 +0200 Subject: [PATCH] Improved realmath test bench --- tests/realmath/generate.py | 16 ++++++++++++---- tests/realmath/run-test.sh | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/realmath/generate.py b/tests/realmath/generate.py index af7648b87..58cedf028 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;') diff --git a/tests/realmath/run-test.sh b/tests/realmath/run-test.sh index 9568cdd6a..48e87417c 100755 --- a/tests/realmath/run-test.sh +++ b/tests/realmath/run-test.sh @@ -13,7 +13,7 @@ for ((i = 0; i < 100; i++)); do idx=$( printf "%05d" $i ) ../../../yosys -q uut_${idx}.ys iverilog -o uut_${idx}_tb uut_${idx}_tb.v uut_${idx}.v uut_${idx}_syn.v - ./uut_${idx}_tb > uut_${idx}.log + ./uut_${idx}_tb done echo -- 2.30.2