diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bram/generate.py | 5 | ||||
-rwxr-xr-x | tests/bram/run-test.sh | 2 | ||||
-rw-r--r-- | tests/fsm/generate.py | 5 | ||||
-rwxr-xr-x | tests/fsm/run-test.sh | 2 | ||||
-rw-r--r-- | tests/realmath/generate.py | 5 | ||||
-rwxr-xr-x | tests/realmath/run-test.sh | 2 | ||||
-rw-r--r-- | tests/share/generate.py | 5 | ||||
-rwxr-xr-x | tests/share/run-test.sh | 2 | ||||
-rw-r--r-- | tests/simple/graphtest.v | 34 | ||||
-rw-r--r-- | tests/simple/memory.v | 15 | ||||
-rw-r--r-- | tests/simple/task_func.v | 42 | ||||
-rw-r--r-- | tests/simple/wreduce.v | 9 | ||||
-rw-r--r-- | tests/techmap/mem_simple_4x1_map.v | 9 | ||||
-rwxr-xr-x | tests/tools/txt2tikztiming.py | 5 |
14 files changed, 116 insertions, 26 deletions
diff --git a/tests/bram/generate.py b/tests/bram/generate.py index 766157eb3..05a7ed027 100644 --- a/tests/bram/generate.py +++ b/tests/bram/generate.py @@ -1,7 +1,4 @@ -#!/usr/bin/python - -from __future__ import division -from __future__ import print_function +#!/usr/bin/env python3 import os import sys diff --git a/tests/bram/run-test.sh b/tests/bram/run-test.sh index d617187ec..f0bf0131e 100755 --- a/tests/bram/run-test.sh +++ b/tests/bram/run-test.sh @@ -8,7 +8,7 @@ rm -rf temp mkdir -p temp echo "generating tests.." -python generate.py +python3 generate.py { echo -n "all:" diff --git a/tests/fsm/generate.py b/tests/fsm/generate.py index fb5695ff6..8757d4741 100644 --- a/tests/fsm/generate.py +++ b/tests/fsm/generate.py @@ -1,7 +1,4 @@ -#!/usr/bin/python - -from __future__ import division -from __future__ import print_function +#!/usr/bin/env python3 import sys import random diff --git a/tests/fsm/run-test.sh b/tests/fsm/run-test.sh index 57c2a5b12..423892334 100755 --- a/tests/fsm/run-test.sh +++ b/tests/fsm/run-test.sh @@ -8,7 +8,7 @@ set -e rm -rf temp mkdir -p temp echo "generating tests.." -python generate.py +python3 generate.py { all_targets="all_targets:" diff --git a/tests/realmath/generate.py b/tests/realmath/generate.py index aee211185..19d01c7c6 100644 --- a/tests/realmath/generate.py +++ b/tests/realmath/generate.py @@ -1,7 +1,4 @@ -#!/usr/bin/python - -from __future__ import division -from __future__ import print_function +#!/usr/bin/env python3 import sys import random diff --git a/tests/realmath/run-test.sh b/tests/realmath/run-test.sh index 8419688c9..f1ec5476b 100755 --- a/tests/realmath/run-test.sh +++ b/tests/realmath/run-test.sh @@ -4,7 +4,7 @@ set -e rm -rf temp mkdir -p temp echo "generating tests.." -python generate.py +python3 generate.py cd temp echo "running tests.." diff --git a/tests/share/generate.py b/tests/share/generate.py index 271dd9c40..01a19a8d9 100644 --- a/tests/share/generate.py +++ b/tests/share/generate.py @@ -1,7 +1,4 @@ -#!/usr/bin/python - -from __future__ import division -from __future__ import print_function +#!/usr/bin/env python3 import sys import random diff --git a/tests/share/run-test.sh b/tests/share/run-test.sh index 6e880677c..18dbbc279 100755 --- a/tests/share/run-test.sh +++ b/tests/share/run-test.sh @@ -8,7 +8,7 @@ set -e rm -rf temp mkdir -p temp echo "generating tests.." -python generate.py +python3 generate.py echo "running tests.." for i in $( ls temp/*.ys | sed 's,[^0-9],,g; s,^0*\(.\),\1,g;' ); do diff --git a/tests/simple/graphtest.v b/tests/simple/graphtest.v new file mode 100644 index 000000000..74788dbbe --- /dev/null +++ b/tests/simple/graphtest.v @@ -0,0 +1,34 @@ +module graphtest (A,B,X,Y,Z); + +input [3:0] A; +input [3:0] B; +output reg [3:0] X; +output [9:0] Y; +output [7:0] Z; + +wire [4:0] t; + +assign t[4] = 1'b0; // Constant connects to wire +assign t[2:0] = A[2:0] & { 2'b10, B[3]}; // Concatenation of intermediate wire +assign t[3] = A[2] ^ B[3]; // Bitwise-XOR + +// assign Y[2:0] = 3'b111; +// assign Y[6:3] = A; +// assign Y[9:7] = t[0:2]; +assign Y = {3'b111, A, t[2:0]}; // Direct assignment of concatenation + +assign Z[0] = 1'b0; // Constant connects to PO +assign Z[1] = t[3]; // Intermediate sig connects to PO +assign Z[3:2] = A[2:1]; // PI connects to PO +assign Z[7:4] = {1'b0, B[2:0]}; // Concat of CV and PI connect to PO + +always @* begin + if (A == 4'b1111) begin // All-Const at port (eq) + X = B; + end + else begin + X = 4'b0000; // All-Const at port (mux) + end +end + +endmodule diff --git a/tests/simple/memory.v b/tests/simple/memory.v index 67f89cd75..d58ed9d1a 100644 --- a/tests/simple/memory.v +++ b/tests/simple/memory.v @@ -228,3 +228,18 @@ module memtest09 ( end endmodule +// ---------------------------------------------------------- + +module memtest10(input clk, input [5:0] din, output [5:0] dout); + reg [5:0] queue [0:3]; + integer i; + + always @(posedge clk) begin + queue[0] <= din; + for (i = 1; i < 4; i=i+1) begin + queue[i] <= queue[i-1]; + end + end + + assign dout = queue[3]; +endmodule diff --git a/tests/simple/task_func.v b/tests/simple/task_func.v index 9b8e26e51..fa50c1d5c 100644 --- a/tests/simple/task_func.v +++ b/tests/simple/task_func.v @@ -68,7 +68,7 @@ endmodule // ------------------------------------------------------------------- -module task_func_test03( input [7:0] din_a, input [7:0] din_b, output [7:0] dout_a); +module task_func_test03(input [7:0] din_a, input [7:0] din_b, output [7:0] dout_a); assign dout_a = test(din_a,din_b); function [7:0] test; input [7:0] a; @@ -80,3 +80,43 @@ module task_func_test03( input [7:0] din_a, input [7:0] din_b, output [7:0] dout end endfunction endmodule + +// ------------------------------------------------------------------- + +module task_func_test04(input [7:0] in, output [7:0] out1, out2, out3, out4); + parameter p = 23; + parameter px = 42; + function [7:0] test1; + input [7:0] i; + parameter p = 42; + begin + test1 = i + p; + end + endfunction + function [7:0] test2; + input [7:0] i; + parameter p2 = p+42; + begin + test2 = i + p2; + end + endfunction + function [7:0] test3; + input [7:0] i; + begin + test3 = i + p; + end + endfunction + function [7:0] test4; + input [7:0] i; + parameter px = p + 13; + parameter p3 = px - 37; + parameter p4 = p3 ^ px; + begin + test4 = i + p4; + end + endfunction + assign out1 = test1(in); + assign out2 = test2(in); + assign out3 = test3(in); + assign out4 = test4(in); +endmodule diff --git a/tests/simple/wreduce.v b/tests/simple/wreduce.v new file mode 100644 index 000000000..ba5484385 --- /dev/null +++ b/tests/simple/wreduce.v @@ -0,0 +1,9 @@ +module wreduce_test0(input [7:0] a, b, output [15:0] x, y, z); + assign x = -$signed({1'b0, a}); + assign y = $signed({1'b0, a}) + $signed({1'b0, b}); + assign z = x ^ y; +endmodule + +module wreduce_test1(input [31:0] a, b, output [7:0] x, y, z, w); + assign x = a - b, y = a * b, z = a >> b, w = a << b; +endmodule diff --git a/tests/techmap/mem_simple_4x1_map.v b/tests/techmap/mem_simple_4x1_map.v index 868f5d00c..762e2938e 100644 --- a/tests/techmap/mem_simple_4x1_map.v +++ b/tests/techmap/mem_simple_4x1_map.v @@ -1,5 +1,5 @@ -module \$mem (RD_CLK, RD_ADDR, RD_DATA, WR_CLK, WR_EN, WR_ADDR, WR_DATA); +module \$mem (RD_CLK, RD_EN, RD_ADDR, RD_DATA, WR_CLK, WR_EN, WR_ADDR, WR_DATA); parameter MEMID = ""; parameter SIZE = 256; parameter OFFSET = 0; @@ -17,6 +17,7 @@ module \$mem (RD_CLK, RD_ADDR, RD_DATA, WR_CLK, WR_EN, WR_ADDR, WR_DATA); parameter WR_CLK_POLARITY = 1'b1; input [RD_PORTS-1:0] RD_CLK; + input [RD_PORTS-1:0] RD_EN; input [RD_PORTS*ABITS-1:0] RD_ADDR; output reg [RD_PORTS*WIDTH-1:0] RD_DATA; @@ -30,6 +31,8 @@ module \$mem (RD_CLK, RD_ADDR, RD_DATA, WR_CLK, WR_EN, WR_ADDR, WR_DATA); parameter _TECHMAP_CONNMAP_RD_CLK_ = 0; parameter _TECHMAP_CONNMAP_WR_CLK_ = 0; + parameter _TECHMAP_CONSTVAL_RD_EN_ = 0; + parameter _TECHMAP_BITS_CONNMAP_ = 0; parameter _TECHMAP_CONNMAP_WR_EN_ = 0; @@ -46,6 +49,10 @@ module \$mem (RD_CLK, RD_ADDR, RD_DATA, WR_CLK, WR_EN, WR_ADDR, WR_DATA); if (RD_PORTS > 1 || WR_PORTS > 1) _TECHMAP_FAIL_ <= 1; + // read enable must be constant high + if (_TECHMAP_CONSTVAL_RD_EN_[0] !== 1'b1) + _TECHMAP_FAIL_ <= 1; + // we expect positive read clock and non-transparent reads if (RD_TRANSPARENT || !RD_CLK_ENABLE || !RD_CLK_POLARITY) _TECHMAP_FAIL_ <= 1; diff --git a/tests/tools/txt2tikztiming.py b/tests/tools/txt2tikztiming.py index cfefe339f..9c6cd3a19 100755 --- a/tests/tools/txt2tikztiming.py +++ b/tests/tools/txt2tikztiming.py @@ -1,7 +1,4 @@ -#!/usr/bin/python - -from __future__ import division -from __future__ import print_function +#!/usr/bin/env python3 import argparse import fileinput |